aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 64ce3d33d9c6..58e2b0d93758 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -74,8 +74,8 @@ MODULE_LICENSE("GPL");
74 (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ 74 (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \
75 (HASH_SIZE - 1)) 75 (HASH_SIZE - 1))
76 76
77static int ip6_fb_tnl_dev_init(struct net_device *dev); 77static void ip6_fb_tnl_dev_init(struct net_device *dev);
78static int ip6_tnl_dev_init(struct net_device *dev); 78static void ip6_tnl_dev_init(struct net_device *dev);
79static void ip6_tnl_dev_setup(struct net_device *dev); 79static void ip6_tnl_dev_setup(struct net_device *dev);
80 80
81static int ip6_tnl_net_id; 81static int ip6_tnl_net_id;
@@ -249,7 +249,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
249 } 249 }
250 250
251 t = netdev_priv(dev); 251 t = netdev_priv(dev);
252 dev->init = ip6_tnl_dev_init; 252 ip6_tnl_dev_init(dev);
253 t->parms = *p; 253 t->parms = *p;
254 254
255 if ((err = register_netdevice(dev)) < 0) 255 if ((err = register_netdevice(dev)) < 0)
@@ -846,6 +846,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
846 int encap_limit, 846 int encap_limit,
847 __u32 *pmtu) 847 __u32 *pmtu)
848{ 848{
849 struct net *net = dev_net(dev);
849 struct ip6_tnl *t = netdev_priv(dev); 850 struct ip6_tnl *t = netdev_priv(dev);
850 struct net_device_stats *stats = &t->dev->stats; 851 struct net_device_stats *stats = &t->dev->stats;
851 struct ipv6hdr *ipv6h = ipv6_hdr(skb); 852 struct ipv6hdr *ipv6h = ipv6_hdr(skb);
@@ -861,9 +862,9 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
861 if ((dst = ip6_tnl_dst_check(t)) != NULL) 862 if ((dst = ip6_tnl_dst_check(t)) != NULL)
862 dst_hold(dst); 863 dst_hold(dst);
863 else { 864 else {
864 dst = ip6_route_output(dev_net(dev), NULL, fl); 865 dst = ip6_route_output(net, NULL, fl);
865 866
866 if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0) 867 if (dst->error || xfrm_lookup(net, &dst, fl, NULL, 0) < 0)
867 goto tx_err_link_failure; 868 goto tx_err_link_failure;
868 } 869 }
869 870
@@ -1150,7 +1151,6 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1150 * ip6_tnl_change - update the tunnel parameters 1151 * ip6_tnl_change - update the tunnel parameters
1151 * @t: tunnel to be changed 1152 * @t: tunnel to be changed
1152 * @p: tunnel configuration parameters 1153 * @p: tunnel configuration parameters
1153 * @active: != 0 if tunnel is ready for use
1154 * 1154 *
1155 * Description: 1155 * Description:
1156 * ip6_tnl_change() updates the tunnel parameters 1156 * ip6_tnl_change() updates the tunnel parameters
@@ -1306,6 +1306,14 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
1306 return 0; 1306 return 0;
1307} 1307}
1308 1308
1309
1310static const struct net_device_ops ip6_tnl_netdev_ops = {
1311 .ndo_uninit = ip6_tnl_dev_uninit,
1312 .ndo_start_xmit = ip6_tnl_xmit,
1313 .ndo_do_ioctl = ip6_tnl_ioctl,
1314 .ndo_change_mtu = ip6_tnl_change_mtu,
1315};
1316
1309/** 1317/**
1310 * ip6_tnl_dev_setup - setup virtual tunnel device 1318 * ip6_tnl_dev_setup - setup virtual tunnel device
1311 * @dev: virtual device associated with tunnel 1319 * @dev: virtual device associated with tunnel
@@ -1316,11 +1324,8 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
1316 1324
1317static void ip6_tnl_dev_setup(struct net_device *dev) 1325static void ip6_tnl_dev_setup(struct net_device *dev)
1318{ 1326{
1319 dev->uninit = ip6_tnl_dev_uninit; 1327 dev->netdev_ops = &ip6_tnl_netdev_ops;
1320 dev->destructor = free_netdev; 1328 dev->destructor = free_netdev;
1321 dev->hard_start_xmit = ip6_tnl_xmit;
1322 dev->do_ioctl = ip6_tnl_ioctl;
1323 dev->change_mtu = ip6_tnl_change_mtu;
1324 1329
1325 dev->type = ARPHRD_TUNNEL6; 1330 dev->type = ARPHRD_TUNNEL6;
1326 dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); 1331 dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr);
@@ -1349,13 +1354,11 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
1349 * @dev: virtual device associated with tunnel 1354 * @dev: virtual device associated with tunnel
1350 **/ 1355 **/
1351 1356
1352static int 1357static void ip6_tnl_dev_init(struct net_device *dev)
1353ip6_tnl_dev_init(struct net_device *dev)
1354{ 1358{
1355 struct ip6_tnl *t = netdev_priv(dev); 1359 struct ip6_tnl *t = netdev_priv(dev);
1356 ip6_tnl_dev_init_gen(dev); 1360 ip6_tnl_dev_init_gen(dev);
1357 ip6_tnl_link_config(t); 1361 ip6_tnl_link_config(t);
1358 return 0;
1359} 1362}
1360 1363
1361/** 1364/**
@@ -1365,8 +1368,7 @@ ip6_tnl_dev_init(struct net_device *dev)
1365 * Return: 0 1368 * Return: 0
1366 **/ 1369 **/
1367 1370
1368static int 1371static void ip6_fb_tnl_dev_init(struct net_device *dev)
1369ip6_fb_tnl_dev_init(struct net_device *dev)
1370{ 1372{
1371 struct ip6_tnl *t = netdev_priv(dev); 1373 struct ip6_tnl *t = netdev_priv(dev);
1372 struct net *net = dev_net(dev); 1374 struct net *net = dev_net(dev);
@@ -1376,7 +1378,6 @@ ip6_fb_tnl_dev_init(struct net_device *dev)
1376 t->parms.proto = IPPROTO_IPV6; 1378 t->parms.proto = IPPROTO_IPV6;
1377 dev_hold(dev); 1379 dev_hold(dev);
1378 ip6n->tnls_wc[0] = t; 1380 ip6n->tnls_wc[0] = t;
1379 return 0;
1380} 1381}
1381 1382
1382static struct xfrm6_tunnel ip4ip6_handler = { 1383static struct xfrm6_tunnel ip4ip6_handler = {
@@ -1428,10 +1429,10 @@ static int ip6_tnl_init_net(struct net *net)
1428 1429
1429 if (!ip6n->fb_tnl_dev) 1430 if (!ip6n->fb_tnl_dev)
1430 goto err_alloc_dev; 1431 goto err_alloc_dev;
1431
1432 ip6n->fb_tnl_dev->init = ip6_fb_tnl_dev_init;
1433 dev_net_set(ip6n->fb_tnl_dev, net); 1432 dev_net_set(ip6n->fb_tnl_dev, net);
1434 1433
1434 ip6_fb_tnl_dev_init(ip6n->fb_tnl_dev);
1435
1435 err = register_netdev(ip6n->fb_tnl_dev); 1436 err = register_netdev(ip6n->fb_tnl_dev);
1436 if (err < 0) 1437 if (err < 0)
1437 goto err_register; 1438 goto err_register;