diff options
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r-- | net/ipv4/ipip.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 29609d29df76..5079dfbc6f38 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -130,8 +130,8 @@ struct ipip_net { | |||
130 | struct net_device *fb_tunnel_dev; | 130 | struct net_device *fb_tunnel_dev; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static int ipip_fb_tunnel_init(struct net_device *dev); | 133 | static void ipip_fb_tunnel_init(struct net_device *dev); |
134 | static int ipip_tunnel_init(struct net_device *dev); | 134 | static void ipip_tunnel_init(struct net_device *dev); |
135 | static void ipip_tunnel_setup(struct net_device *dev); | 135 | static void ipip_tunnel_setup(struct net_device *dev); |
136 | 136 | ||
137 | static DEFINE_RWLOCK(ipip_lock); | 137 | static DEFINE_RWLOCK(ipip_lock); |
@@ -245,9 +245,10 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net, | |||
245 | } | 245 | } |
246 | 246 | ||
247 | nt = netdev_priv(dev); | 247 | nt = netdev_priv(dev); |
248 | dev->init = ipip_tunnel_init; | ||
249 | nt->parms = *parms; | 248 | nt->parms = *parms; |
250 | 249 | ||
250 | ipip_tunnel_init(dev); | ||
251 | |||
251 | if (register_netdevice(dev) < 0) | 252 | if (register_netdevice(dev) < 0) |
252 | goto failed_free; | 253 | goto failed_free; |
253 | 254 | ||
@@ -281,7 +282,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) | |||
281 | 8 bytes of packet payload. It means, that precise relaying of | 282 | 8 bytes of packet payload. It means, that precise relaying of |
282 | ICMP in the real Internet is absolutely infeasible. | 283 | ICMP in the real Internet is absolutely infeasible. |
283 | */ | 284 | */ |
284 | struct iphdr *iph = (struct iphdr*)skb->data; | 285 | struct iphdr *iph = (struct iphdr *)skb->data; |
285 | const int type = icmp_hdr(skb)->type; | 286 | const int type = icmp_hdr(skb)->type; |
286 | const int code = icmp_hdr(skb)->code; | 287 | const int code = icmp_hdr(skb)->code; |
287 | struct ip_tunnel *t; | 288 | struct ip_tunnel *t; |
@@ -691,12 +692,17 @@ static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) | |||
691 | return 0; | 692 | return 0; |
692 | } | 693 | } |
693 | 694 | ||
695 | static const struct net_device_ops ipip_netdev_ops = { | ||
696 | .ndo_uninit = ipip_tunnel_uninit, | ||
697 | .ndo_start_xmit = ipip_tunnel_xmit, | ||
698 | .ndo_do_ioctl = ipip_tunnel_ioctl, | ||
699 | .ndo_change_mtu = ipip_tunnel_change_mtu, | ||
700 | |||
701 | }; | ||
702 | |||
694 | static void ipip_tunnel_setup(struct net_device *dev) | 703 | static void ipip_tunnel_setup(struct net_device *dev) |
695 | { | 704 | { |
696 | dev->uninit = ipip_tunnel_uninit; | 705 | dev->netdev_ops = &ipip_netdev_ops; |
697 | dev->hard_start_xmit = ipip_tunnel_xmit; | ||
698 | dev->do_ioctl = ipip_tunnel_ioctl; | ||
699 | dev->change_mtu = ipip_tunnel_change_mtu; | ||
700 | dev->destructor = free_netdev; | 706 | dev->destructor = free_netdev; |
701 | 707 | ||
702 | dev->type = ARPHRD_TUNNEL; | 708 | dev->type = ARPHRD_TUNNEL; |
@@ -708,11 +714,9 @@ static void ipip_tunnel_setup(struct net_device *dev) | |||
708 | dev->features |= NETIF_F_NETNS_LOCAL; | 714 | dev->features |= NETIF_F_NETNS_LOCAL; |
709 | } | 715 | } |
710 | 716 | ||
711 | static int ipip_tunnel_init(struct net_device *dev) | 717 | static void ipip_tunnel_init(struct net_device *dev) |
712 | { | 718 | { |
713 | struct ip_tunnel *tunnel; | 719 | struct ip_tunnel *tunnel = netdev_priv(dev); |
714 | |||
715 | tunnel = netdev_priv(dev); | ||
716 | 720 | ||
717 | tunnel->dev = dev; | 721 | tunnel->dev = dev; |
718 | strcpy(tunnel->parms.name, dev->name); | 722 | strcpy(tunnel->parms.name, dev->name); |
@@ -721,11 +725,9 @@ static int ipip_tunnel_init(struct net_device *dev) | |||
721 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); | 725 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); |
722 | 726 | ||
723 | ipip_tunnel_bind_dev(dev); | 727 | ipip_tunnel_bind_dev(dev); |
724 | |||
725 | return 0; | ||
726 | } | 728 | } |
727 | 729 | ||
728 | static int ipip_fb_tunnel_init(struct net_device *dev) | 730 | static void ipip_fb_tunnel_init(struct net_device *dev) |
729 | { | 731 | { |
730 | struct ip_tunnel *tunnel = netdev_priv(dev); | 732 | struct ip_tunnel *tunnel = netdev_priv(dev); |
731 | struct iphdr *iph = &tunnel->parms.iph; | 733 | struct iphdr *iph = &tunnel->parms.iph; |
@@ -740,7 +742,6 @@ static int ipip_fb_tunnel_init(struct net_device *dev) | |||
740 | 742 | ||
741 | dev_hold(dev); | 743 | dev_hold(dev); |
742 | ipn->tunnels_wc[0] = tunnel; | 744 | ipn->tunnels_wc[0] = tunnel; |
743 | return 0; | ||
744 | } | 745 | } |
745 | 746 | ||
746 | static struct xfrm_tunnel ipip_handler = { | 747 | static struct xfrm_tunnel ipip_handler = { |
@@ -792,10 +793,10 @@ static int ipip_init_net(struct net *net) | |||
792 | err = -ENOMEM; | 793 | err = -ENOMEM; |
793 | goto err_alloc_dev; | 794 | goto err_alloc_dev; |
794 | } | 795 | } |
795 | |||
796 | ipn->fb_tunnel_dev->init = ipip_fb_tunnel_init; | ||
797 | dev_net_set(ipn->fb_tunnel_dev, net); | 796 | dev_net_set(ipn->fb_tunnel_dev, net); |
798 | 797 | ||
798 | ipip_fb_tunnel_init(ipn->fb_tunnel_dev); | ||
799 | |||
799 | if ((err = register_netdev(ipn->fb_tunnel_dev))) | 800 | if ((err = register_netdev(ipn->fb_tunnel_dev))) |
800 | goto err_reg_dev; | 801 | goto err_reg_dev; |
801 | 802 | ||