aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_gre.c
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2013-08-13 11:51:12 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-15 04:00:20 -0400
commit0bd8762824e73a3cce7b7560a97463301764b616 (patch)
tree1de2d9f01b9947e87705c7d00082fa474e517c5f /net/ipv6/ip6_gre.c
parent6c742e714d8c282fd8f8b22d3e20b5141738c1ee (diff)
ip6tnl: add x-netns support
This patch allows to switch the netns when packet is encapsulated or decapsulated. In other word, the encapsulated packet is received in a netns, where the lookup is done to find the tunnel. Once the tunnel is found, the packet is decapsulated and injecting into the corresponding interface which stands to another netns. When one of the two netns is removed, the tunnel is destroyed. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_gre.c')
-rw-r--r--net/ipv6/ip6_gre.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index ecd60733e5e2..f2d0a42f8057 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -335,6 +335,7 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
335 dev->rtnl_link_ops = &ip6gre_link_ops; 335 dev->rtnl_link_ops = &ip6gre_link_ops;
336 336
337 nt->dev = dev; 337 nt->dev = dev;
338 nt->net = dev_net(dev);
338 ip6gre_tnl_link_config(nt, 1); 339 ip6gre_tnl_link_config(nt, 1);
339 340
340 if (register_netdevice(dev) < 0) 341 if (register_netdevice(dev) < 0)
@@ -1255,6 +1256,7 @@ static int ip6gre_tunnel_init(struct net_device *dev)
1255 tunnel = netdev_priv(dev); 1256 tunnel = netdev_priv(dev);
1256 1257
1257 tunnel->dev = dev; 1258 tunnel->dev = dev;
1259 tunnel->net = dev_net(dev);
1258 strcpy(tunnel->parms.name, dev->name); 1260 strcpy(tunnel->parms.name, dev->name);
1259 1261
1260 memcpy(dev->dev_addr, &tunnel->parms.laddr, sizeof(struct in6_addr)); 1262 memcpy(dev->dev_addr, &tunnel->parms.laddr, sizeof(struct in6_addr));
@@ -1275,6 +1277,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
1275 struct ip6_tnl *tunnel = netdev_priv(dev); 1277 struct ip6_tnl *tunnel = netdev_priv(dev);
1276 1278
1277 tunnel->dev = dev; 1279 tunnel->dev = dev;
1280 tunnel->net = dev_net(dev);
1278 strcpy(tunnel->parms.name, dev->name); 1281 strcpy(tunnel->parms.name, dev->name);
1279 1282
1280 tunnel->hlen = sizeof(struct ipv6hdr) + 4; 1283 tunnel->hlen = sizeof(struct ipv6hdr) + 4;
@@ -1450,6 +1453,7 @@ static int ip6gre_tap_init(struct net_device *dev)
1450 tunnel = netdev_priv(dev); 1453 tunnel = netdev_priv(dev);
1451 1454
1452 tunnel->dev = dev; 1455 tunnel->dev = dev;
1456 tunnel->net = dev_net(dev);
1453 strcpy(tunnel->parms.name, dev->name); 1457 strcpy(tunnel->parms.name, dev->name);
1454 1458
1455 ip6gre_tnl_link_config(tunnel, 1); 1459 ip6gre_tnl_link_config(tunnel, 1);
@@ -1501,6 +1505,7 @@ static int ip6gre_newlink(struct net *src_net, struct net_device *dev,
1501 eth_hw_addr_random(dev); 1505 eth_hw_addr_random(dev);
1502 1506
1503 nt->dev = dev; 1507 nt->dev = dev;
1508 nt->net = dev_net(dev);
1504 ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); 1509 ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]);
1505 1510
1506 /* Can use a lockless transmit, unless we generate output sequences */ 1511 /* Can use a lockless transmit, unless we generate output sequences */