diff options
author | Ricky Li <ricky.li@intel.com> | 2015-03-26 06:11:28 -0700 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2015-03-26 18:56:12 -0700 |
commit | c876a4bb9bcc881befac5647a1e311b5af09d549 (patch) | |
tree | bbffcce47f06e1943a7b81f0b881b10c0a405f87 /lib/netdev-vport.c | |
parent | e6d9ab56ee1f417e8823a6405d5a085c70fe8982 (diff) | |
download | openvswitch-c876a4bb9bcc881befac5647a1e311b5af09d549.tar.gz |
netdev: Fix user space tunneling for set_tunnel action.
e.g. Set tunnel id for encapsulated VxLAN packet (out_key=flow):
ovs-vsctl add-port int-br vxlan0 -- set interface vxlan0 \
type=vxlan options:remote_ip=172.168.1.2 options:out_key=flow
ovs-ofctl add-flow int-br in_port=LOCAL, icmp,\
actions=set_tunnel:3, output:1 (1 is the port# of vxlan0)
Output tunnel ID should be modified to 3 with this patch.
Signed-off-by: Ricky Li <ricky.li@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'lib/netdev-vport.c')
-rw-r--r-- | lib/netdev-vport.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 954ab9bd5..c7f3437df 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -1011,7 +1011,8 @@ netdev_gre_push_header(const struct netdev *netdev OVS_UNUSED, static int netdev_gre_build_header(const struct netdev *netdev, - struct ovs_action_push_tnl *data) + struct ovs_action_push_tnl *data, + const struct flow *tnl_flow) { struct netdev_vport *dev = netdev_vport_cast(netdev); struct netdev_tunnel_config *tnl_cfg; @@ -1041,7 +1042,7 @@ netdev_gre_build_header(const struct netdev *netdev, if (tnl_cfg->out_key_present) { greh->flags |= htons(GRE_KEY); put_16aligned_be32(options, (OVS_FORCE ovs_be32) - ((OVS_FORCE uint64_t) tnl_cfg->out_key >> 32)); + ((OVS_FORCE uint64_t) tnl_flow->tunnel.tun_id >> 32)); options++; } @@ -1103,7 +1104,8 @@ netdev_vxlan_pop_header(struct netdev *netdev_ OVS_UNUSED, static int netdev_vxlan_build_header(const struct netdev *netdev, - struct ovs_action_push_tnl *data) + struct ovs_action_push_tnl *data, + const struct flow *tnl_flow) { struct netdev_vport *dev = netdev_vport_cast(netdev); struct netdev_tunnel_config *tnl_cfg; @@ -1123,7 +1125,7 @@ netdev_vxlan_build_header(const struct netdev *netdev, vxh = (struct vxlanhdr *) (udp + 1); put_16aligned_be32(&vxh->vx_flags, htonl(VXLAN_FLAGS)); - put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(tnl_cfg->out_key) << 8)); + put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(tnl_flow->tunnel.tun_id) << 8)); ovs_mutex_unlock(&dev->mutex); data->header_len = VXLAN_HLEN; |