aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2015-01-15 09:11:17 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-19 14:32:03 -0500
commit1728d4fabd1bc9965728de25dda0b694b8da6450 (patch)
treeded88a9a2a0c6feb7374093f4ba85debcb0ee894
parentd37512a277dfb2cef8a578e25a3246f61399a55a (diff)
tunnels: advertise link netns via netlink
Implement 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>
-rw-r--r--drivers/net/vxlan.c8
-rw-r--r--include/net/ip6_tunnel.h1
-rw-r--r--include/net/ip_tunnels.h1
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_tunnel.c8
-rw-r--r--net/ipv4/ip_vti.c1
-rw-r--r--net/ipv4/ipip.c1
-rw-r--r--net/ipv6/ip6_gre.c1
-rw-r--r--net/ipv6/ip6_tunnel.c9
-rw-r--r--net/ipv6/ip6_vti.c1
-rw-r--r--net/ipv6/sit.c1
11 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index c5f79e7513a6..0346eaa6d236 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2923,6 +2923,13 @@ nla_put_failure:
2923 return -EMSGSIZE; 2923 return -EMSGSIZE;
2924} 2924}
2925 2925
2926static struct net *vxlan_get_link_net(const struct net_device *dev)
2927{
2928 struct vxlan_dev *vxlan = netdev_priv(dev);
2929
2930 return vxlan->net;
2931}
2932
2926static struct rtnl_link_ops vxlan_link_ops __read_mostly = { 2933static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
2927 .kind = "vxlan", 2934 .kind = "vxlan",
2928 .maxtype = IFLA_VXLAN_MAX, 2935 .maxtype = IFLA_VXLAN_MAX,
@@ -2934,6 +2941,7 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = {
2934 .dellink = vxlan_dellink, 2941 .dellink = vxlan_dellink,
2935 .get_size = vxlan_get_size, 2942 .get_size = vxlan_get_size,
2936 .fill_info = vxlan_fill_info, 2943 .fill_info = vxlan_fill_info,
2944 .get_link_net = vxlan_get_link_net,
2937}; 2945};
2938 2946
2939static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, 2947static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 9326c41c2d7f..76c091b53dae 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -70,6 +70,7 @@ int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
70__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); 70__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
71__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, 71__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
72 const struct in6_addr *raddr); 72 const struct in6_addr *raddr);
73struct net *ip6_tnl_get_link_net(const struct net_device *dev);
73 74
74static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 75static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
75{ 76{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index ce4db3cc5647..2c47061a6954 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -141,6 +141,7 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
141int ip_tunnel_init(struct net_device *dev); 141int ip_tunnel_init(struct net_device *dev);
142void ip_tunnel_uninit(struct net_device *dev); 142void ip_tunnel_uninit(struct net_device *dev);
143void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 143void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
144struct net *ip_tunnel_get_link_net(const struct net_device *dev);
144int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, 145int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
145 struct rtnl_link_ops *ops, char *devname); 146 struct rtnl_link_ops *ops, char *devname);
146 147
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 942576e27df1..6e7727f27393 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -829,6 +829,7 @@ static struct rtnl_link_ops ipgre_link_ops __read_mostly = {
829 .dellink = ip_tunnel_dellink, 829 .dellink = ip_tunnel_dellink,
830 .get_size = ipgre_get_size, 830 .get_size = ipgre_get_size,
831 .fill_info = ipgre_fill_info, 831 .fill_info = ipgre_fill_info,
832 .get_link_net = ip_tunnel_get_link_net,
832}; 833};
833 834
834static struct rtnl_link_ops ipgre_tap_ops __read_mostly = { 835static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
@@ -843,6 +844,7 @@ static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
843 .dellink = ip_tunnel_dellink, 844 .dellink = ip_tunnel_dellink,
844 .get_size = ipgre_get_size, 845 .get_size = ipgre_get_size,
845 .fill_info = ipgre_fill_info, 846 .fill_info = ipgre_fill_info,
847 .get_link_net = ip_tunnel_get_link_net,
846}; 848};
847 849
848static int __net_init ipgre_tap_init_net(struct net *net) 850static int __net_init ipgre_tap_init_net(struct net *net)
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index d3e447936720..2cd08280c77b 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -972,6 +972,14 @@ void ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
972} 972}
973EXPORT_SYMBOL_GPL(ip_tunnel_dellink); 973EXPORT_SYMBOL_GPL(ip_tunnel_dellink);
974 974
975struct net *ip_tunnel_get_link_net(const struct net_device *dev)
976{
977 struct ip_tunnel *tunnel = netdev_priv(dev);
978
979 return tunnel->net;
980}
981EXPORT_SYMBOL(ip_tunnel_get_link_net);
982
975int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, 983int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
976 struct rtnl_link_ops *ops, char *devname) 984 struct rtnl_link_ops *ops, char *devname)
977{ 985{
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 1a7e979e80ba..94efe148181c 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -531,6 +531,7 @@ static struct rtnl_link_ops vti_link_ops __read_mostly = {
531 .dellink = ip_tunnel_dellink, 531 .dellink = ip_tunnel_dellink,
532 .get_size = vti_get_size, 532 .get_size = vti_get_size,
533 .fill_info = vti_fill_info, 533 .fill_info = vti_fill_info,
534 .get_link_net = ip_tunnel_get_link_net,
534}; 535};
535 536
536static int __init vti_init(void) 537static int __init vti_init(void)
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 40403114f00a..b58d6689874c 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -498,6 +498,7 @@ static struct rtnl_link_ops ipip_link_ops __read_mostly = {
498 .dellink = ip_tunnel_dellink, 498 .dellink = ip_tunnel_dellink,
499 .get_size = ipip_get_size, 499 .get_size = ipip_get_size,
500 .fill_info = ipip_fill_info, 500 .fill_info = ipip_fill_info,
501 .get_link_net = ip_tunnel_get_link_net,
501}; 502};
502 503
503static struct xfrm_tunnel ipip_handler __read_mostly = { 504static struct xfrm_tunnel ipip_handler __read_mostly = {
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 13cda4c6313b..9306a5ff9149 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1662,6 +1662,7 @@ static struct rtnl_link_ops ip6gre_link_ops __read_mostly = {
1662 .dellink = ip6gre_dellink, 1662 .dellink = ip6gre_dellink,
1663 .get_size = ip6gre_get_size, 1663 .get_size = ip6gre_get_size,
1664 .fill_info = ip6gre_fill_info, 1664 .fill_info = ip6gre_fill_info,
1665 .get_link_net = ip6_tnl_get_link_net,
1665}; 1666};
1666 1667
1667static struct rtnl_link_ops ip6gre_tap_ops __read_mostly = { 1668static struct rtnl_link_ops ip6gre_tap_ops __read_mostly = {
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 92b3da571980..266a264ec212 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1760,6 +1760,14 @@ nla_put_failure:
1760 return -EMSGSIZE; 1760 return -EMSGSIZE;
1761} 1761}
1762 1762
1763struct net *ip6_tnl_get_link_net(const struct net_device *dev)
1764{
1765 struct ip6_tnl *tunnel = netdev_priv(dev);
1766
1767 return tunnel->net;
1768}
1769EXPORT_SYMBOL(ip6_tnl_get_link_net);
1770
1763static const struct nla_policy ip6_tnl_policy[IFLA_IPTUN_MAX + 1] = { 1771static const struct nla_policy ip6_tnl_policy[IFLA_IPTUN_MAX + 1] = {
1764 [IFLA_IPTUN_LINK] = { .type = NLA_U32 }, 1772 [IFLA_IPTUN_LINK] = { .type = NLA_U32 },
1765 [IFLA_IPTUN_LOCAL] = { .len = sizeof(struct in6_addr) }, 1773 [IFLA_IPTUN_LOCAL] = { .len = sizeof(struct in6_addr) },
@@ -1783,6 +1791,7 @@ static struct rtnl_link_ops ip6_link_ops __read_mostly = {
1783 .dellink = ip6_tnl_dellink, 1791 .dellink = ip6_tnl_dellink,
1784 .get_size = ip6_tnl_get_size, 1792 .get_size = ip6_tnl_get_size,
1785 .fill_info = ip6_tnl_fill_info, 1793 .fill_info = ip6_tnl_fill_info,
1794 .get_link_net = ip6_tnl_get_link_net,
1786}; 1795};
1787 1796
1788static struct xfrm6_tunnel ip4ip6_handler __read_mostly = { 1797static struct xfrm6_tunnel ip4ip6_handler __read_mostly = {
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index ace10d0b3aac..5fb9e212eca8 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -1016,6 +1016,7 @@ static struct rtnl_link_ops vti6_link_ops __read_mostly = {
1016 .changelink = vti6_changelink, 1016 .changelink = vti6_changelink,
1017 .get_size = vti6_get_size, 1017 .get_size = vti6_get_size,
1018 .fill_info = vti6_fill_info, 1018 .fill_info = vti6_fill_info,
1019 .get_link_net = ip6_tnl_get_link_net,
1019}; 1020};
1020 1021
1021static void __net_exit vti6_destroy_tunnels(struct vti6_net *ip6n) 1022static void __net_exit vti6_destroy_tunnels(struct vti6_net *ip6n)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 213546bd6d5d..3cc197c72b59 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1763,6 +1763,7 @@ static struct rtnl_link_ops sit_link_ops __read_mostly = {
1763 .get_size = ipip6_get_size, 1763 .get_size = ipip6_get_size,
1764 .fill_info = ipip6_fill_info, 1764 .fill_info = ipip6_fill_info,
1765 .dellink = ipip6_dellink, 1765 .dellink = ipip6_dellink,
1766 .get_link_net = ip_tunnel_get_link_net,
1766}; 1767};
1767 1768
1768static struct xfrm_tunnel sit_handler __read_mostly = { 1769static struct xfrm_tunnel sit_handler __read_mostly = {