Commit e5f4e7b9 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

veth: advertise link netns via netlink

Assign rtnl_link_ops->get_link_net() callback so that IFLA_LINK_NETNSID is
added to rtnetlink messages.
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaca400f
...@@ -469,6 +469,14 @@ static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = { ...@@ -469,6 +469,14 @@ static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
[VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) }, [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
}; };
static struct net *veth_get_link_net(const struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);
struct net_device *peer = rtnl_dereference(priv->peer);
return peer ? dev_net(peer) : dev_net(dev);
}
static struct rtnl_link_ops veth_link_ops = { static struct rtnl_link_ops veth_link_ops = {
.kind = DRV_NAME, .kind = DRV_NAME,
.priv_size = sizeof(struct veth_priv), .priv_size = sizeof(struct veth_priv),
...@@ -478,6 +486,7 @@ static struct rtnl_link_ops veth_link_ops = { ...@@ -478,6 +486,7 @@ static struct rtnl_link_ops veth_link_ops = {
.dellink = veth_dellink, .dellink = veth_dellink,
.policy = veth_policy, .policy = veth_policy,
.maxtype = VETH_INFO_MAX, .maxtype = VETH_INFO_MAX,
.get_link_net = veth_get_link_net,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment