datapath: Account for "vxlan: Group Policy extension"
[cascardo/ovs.git] / datapath / vport-vxlan.c
index c9e356e..c4b4b99 100644 (file)
@@ -57,8 +57,8 @@ static inline struct vxlan_port *vxlan_vport(const struct vport *vport)
        return vport_priv(vport);
 }
 
-/* Called with rcu_read_lock and BH disabled. */
-static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, __be32 vx_vni)
+static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
+                     struct vxlan_metadata *md)
 {
        struct ovs_tunnel_info tun_info;
        struct vport *vport = vs->data;
@@ -67,7 +67,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, __be32 vx_vni)
 
        /* Save outer tunnel values */
        iph = ip_hdr(skb);
-       key = cpu_to_be64(ntohl(vx_vni) >> 8);
+       key = cpu_to_be64(ntohl(md->vni) >> 8);
        ovs_flow_tun_info_init(&tun_info, iph,
                               udp_hdr(skb)->source, udp_hdr(skb)->dest,
                               key, TUNNEL_KEY, NULL, 0);
@@ -145,6 +145,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
        struct net *net = ovs_dp_get_net(vport->dp);
        struct vxlan_port *vxlan_port = vxlan_vport(vport);
        __be16 dst_port = inet_sport(vxlan_port->vs->sock->sk);
+       struct vxlan_metadata md = {0};
        struct rtable *rt;
        __be16 src_port;
        __be32 saddr;
@@ -173,13 +174,14 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
        skb->ignore_df = 1;
 
        src_port = udp_flow_src_port(net, skb, 0, 0, true);
+       md.vni = htonl(be64_to_cpu(tun_key->tun_id) << 8);
 
        err = vxlan_xmit_skb(vxlan_port->vs, rt, skb,
                             saddr, tun_key->ipv4_dst,
                             tun_key->ipv4_tos,
                             tun_key->ipv4_ttl, df,
                             src_port, dst_port,
-                            htonl(be64_to_cpu(tun_key->tun_id) << 8));
+                            &md);
        if (err < 0)
                ip_rt_put(rt);
        return err;