[ovs-discuss] Anybody knows how we can dynamically change vxlan dst_port by openflow load, move or set_field action?
Gerhard Stenzel
gstenzel at linux.vnet.ibm.com
Wed Nov 30 13:39:43 UTC 2016
On 11/26/2016 11:08 PM, Ben Pfaff wrote:
> On Thu, Nov 24, 2016 at 02:39:43AM +0000, Yang, Yi Y wrote:
>> I noticed vxlan module always uses tp_dst from tunnel metadata in preference to vxlan->cfg.dst_port, this isn't the result we want in some use cases, for example, if we create two vxlan port which have different dst_port, when we forward the packet from the first vxlan port to the second one, we need the packet should be sent out with the second vxlan port's dst_port as tp_dst, but current vxlan module will use that one from the first vxlan port, the source code in vxlan module and our experiment have confirmed this.
>>
>> The line in file datapath/linux/compat/vxlan.c is here:
>>
>> dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port;
>>
>> Anybody knows how we can change this? The below change seems more reasonable to me, or do we have some ways to dynamically change it by openflow actions?
>>
>> dst_port = vxlan->cfg.dst_port ? : info->key.tp_dst;
>
> I think that this might be related to the bug that Gerhard reported,
> starting here:
> https://mail.openvswitch.org/pipermail/ovs-discuss/2016-November/042984.html
> Gerhard, does Yang's fix make any difference for you? (I don't know
> whether you're using the compat code, but the upstream code may have the
> same bug.)
>
Ben, I finally managed to create a working setup with a newer kernel (4.8.10-200.fc24.x86_64) and current upstream ovs master. Unless I made a mistake, the fix does not make a difference for my scenario.
Here are the details:
# modinfo openvswitch
filename: /lib/modules/4.8.10-200.fc24.x86_64/extra/openvswitch.ko
alias: net-pf-16-proto-16-family-ovs_packet
alias: net-pf-16-proto-16-family-ovs_flow
alias: net-pf-16-proto-16-family-ovs_vport
alias: net-pf-16-proto-16-family-ovs_datapath
version: 2.6.90
license: GPL
description: Open vSwitch switching datapath
srcversion: 8BF3A000492AA097034609E
depends: nf_conntrack,nf_nat,udp_tunnel,libcrc32c,nf_nat_ipv6,nf_nat_ipv4,nf_defrag_ipv6
vermagic: 4.8.10-200.fc24.x86_64 SMP mod_unload
// Before change:
# ovs-dpctl dump-flows
recirc_id(0),tunnel(tun_id=0x0,src=192.168.122.202,dst=192.168.122.227,ttl=64,flags(-df-csum+key)),in_port(1),skb_mark(0),eth(src=52:f9:67:de:f0:4b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=10.0.0.68,tip=10.0.0.111,op=1/0xff), packets:23, bytes:966, used:0.003s, actions:set(tunnel(tun_id=0x0,dst=192.168.122.21,ttl=64,tp_src=7291,tp_dst=6081,flags(df|key))),3,2
# git diff
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 3abcab1..c84a280 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -1046,7 +1046,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
dev->name);
goto drop;
}
- dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port;
+ dst_port = vxlan->cfg.dst_port ? : info->key.tp_dst;
vni = vxlan_tun_id_to_vni(info->key.tun_id);
remote_ip.sa.sa_family = ip_tunnel_info_af(info);
if (remote_ip.sa.sa_family == AF_INET) {
// Build and install OVS kernel module and reboot:
# ovs-dpctl dump-flows
recirc_id(0),tunnel(tun_id=0x0,src=192.168.122.202,dst=192.168.122.227,ttl=64,flags(-df-csum+key)),in_port(1),skb_mark(0),eth(src=52:f9:67:de:f0:4b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=10.0.0.68,tip=10.0.0.111,op=1/0xff), packets:23, bytes:966, used:0.289s, actions:2,set(tunnel(tun_id=0x0,dst=192.168.122.21,ttl=64,tp_src=7291,tp_dst=6081,flags(df|key))),3
More information about the discuss
mailing list