aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/veth.c
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2015-01-20 09:15:46 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-23 20:51:15 -0500
commite5f4e7b9ff331c6995af826b222681528de574b6 (patch)
tree5932c15efd60c636b89152c39f584aeeaaf8456c /drivers/net/veth.c
parenteaca400f1d14eec98561ab9dad0da03d65c5e8d0 (diff)
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: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r--drivers/net/veth.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 8ad596573d17..4cca36ebc4fb 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -469,6 +469,14 @@ static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
469 [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) }, 469 [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
470}; 470};
471 471
472static struct net *veth_get_link_net(const struct net_device *dev)
473{
474 struct veth_priv *priv = netdev_priv(dev);
475 struct net_device *peer = rtnl_dereference(priv->peer);
476
477 return peer ? dev_net(peer) : dev_net(dev);
478}
479
472static struct rtnl_link_ops veth_link_ops = { 480static struct rtnl_link_ops veth_link_ops = {
473 .kind = DRV_NAME, 481 .kind = DRV_NAME,
474 .priv_size = sizeof(struct veth_priv), 482 .priv_size = sizeof(struct veth_priv),
@@ -478,6 +486,7 @@ static struct rtnl_link_ops veth_link_ops = {
478 .dellink = veth_dellink, 486 .dellink = veth_dellink,
479 .policy = veth_policy, 487 .policy = veth_policy,
480 .maxtype = VETH_INFO_MAX, 488 .maxtype = VETH_INFO_MAX,
489 .get_link_net = veth_get_link_net,
481}; 490};
482 491
483/* 492/*