vxlan: advertise netns of vxlan dev in fdb msg
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Tue, 20 Jan 2015 14:15:47 +0000 (15:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 Jan 2015 01:51:15 +0000 (17:51 -0800)
Netlink FDB messages are sent in the link netns. The header of these messages
contains the ifindex (ndm_ifindex) of the netdevice, but this ifindex is
unusable in case of x-netns vxlan.
I named the new attribute NDA_NDM_IFINDEX_NETNSID, to avoid confusion with
NDA_IFINDEX.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c
include/uapi/linux/neighbour.h
net/core/net_namespace.c

index 0346eaa6d236429ac736eb19c763dfb780bc4fdb..19d3664ab9dd87c19077e47311e2872f016c725e 100644 (file)
@@ -339,6 +339,11 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
        ndm->ndm_flags = fdb->flags;
        ndm->ndm_type = RTN_UNICAST;
 
+       if (!net_eq(dev_net(vxlan->dev), vxlan->net) &&
+           nla_put_s32(skb, NDA_NDM_IFINDEX_NETNSID,
+                       peernet2id(vxlan->net, dev_net(vxlan->dev))))
+               goto nla_put_failure;
+
        if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
                goto nla_put_failure;
 
index f3d77f9f1e0bb582b1f1ca02fd8bd99ff60729dd..38f236853cc0742a3c2e71c0c6137c1d308c2dd4 100644 (file)
@@ -25,6 +25,7 @@ enum {
        NDA_VNI,
        NDA_IFINDEX,
        NDA_MASTER,
+       NDA_NDM_IFINDEX_NETNSID,
        __NDA_MAX
 };
 
index 9d1a4cac83b604cf657f1492628dbc4966db8eca..b7bde551ef76901de0456d811112ba232aa350ba 100644 (file)
@@ -202,6 +202,7 @@ int peernet2id(struct net *net, struct net *peer)
 
        return id >= 0 ? id : NETNSA_NSID_NOT_ASSIGNED;
 }
+EXPORT_SYMBOL(peernet2id);
 
 struct net *get_net_ns_by_id(struct net *net, int id)
 {
This page took 0.029525 seconds and 5 git commands to generate.