Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 193523bf authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller
Browse files

vxlan: advertise netns of vxlan dev in fdb msg



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: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e5f4e7b9
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -339,6 +339,11 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
	ndm->ndm_flags = fdb->flags;
	ndm->ndm_flags = fdb->flags;
	ndm->ndm_type = RTN_UNICAST;
	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))
	if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
		goto nla_put_failure;
		goto nla_put_failure;


+1 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ enum {
	NDA_VNI,
	NDA_VNI,
	NDA_IFINDEX,
	NDA_IFINDEX,
	NDA_MASTER,
	NDA_MASTER,
	NDA_NDM_IFINDEX_NETNSID,
	__NDA_MAX
	__NDA_MAX
};
};


+1 −0
Original line number Original line Diff line number Diff line
@@ -202,6 +202,7 @@ int peernet2id(struct net *net, struct net *peer)


	return id >= 0 ? id : NETNSA_NSID_NOT_ASSIGNED;
	return id >= 0 ? id : NETNSA_NSID_NOT_ASSIGNED;
}
}
EXPORT_SYMBOL(peernet2id);


struct net *get_net_ns_by_id(struct net *net, int id)
struct net *get_net_ns_by_id(struct net *net, int id)
{
{