ipip.c (163849ea9b4c5d50fbd324692461983d18faadad) | ipip.c (2c8c1e7297e19bdef3c178c3ea41d898a7716e3e) |
---|---|
1/* 2 * Linux NET3: IP/IP protocol decoder. 3 * 4 * Authors: 5 * Sam Lantinga (slouken@cs.ucdavis.edu) 02/01/95 6 * 7 * Fixes: 8 * Alan Cox : Merged and made usable non modular (its so tiny its silly as --- 116 unchanged lines hidden (view full) --- 125 struct ip_tunnel *tunnels_r[HASH_SIZE]; 126 struct ip_tunnel *tunnels_l[HASH_SIZE]; 127 struct ip_tunnel *tunnels_wc[1]; 128 struct ip_tunnel **tunnels[4]; 129 130 struct net_device *fb_tunnel_dev; 131}; 132 | 1/* 2 * Linux NET3: IP/IP protocol decoder. 3 * 4 * Authors: 5 * Sam Lantinga (slouken@cs.ucdavis.edu) 02/01/95 6 * 7 * Fixes: 8 * Alan Cox : Merged and made usable non modular (its so tiny its silly as --- 116 unchanged lines hidden (view full) --- 125 struct ip_tunnel *tunnels_r[HASH_SIZE]; 126 struct ip_tunnel *tunnels_l[HASH_SIZE]; 127 struct ip_tunnel *tunnels_wc[1]; 128 struct ip_tunnel **tunnels[4]; 129 130 struct net_device *fb_tunnel_dev; 131}; 132 |
133static void ipip_fb_tunnel_init(struct net_device *dev); | |
134static void ipip_tunnel_init(struct net_device *dev); 135static void ipip_tunnel_setup(struct net_device *dev); 136 137/* 138 * Locking : hash tables are protected by RCU and a spinlock 139 */ 140static DEFINE_SPINLOCK(ipip_lock); 141 --- 583 unchanged lines hidden (view full) --- 725 strcpy(tunnel->parms.name, dev->name); 726 727 memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); 728 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 729 730 ipip_tunnel_bind_dev(dev); 731} 732 | 133static void ipip_tunnel_init(struct net_device *dev); 134static void ipip_tunnel_setup(struct net_device *dev); 135 136/* 137 * Locking : hash tables are protected by RCU and a spinlock 138 */ 139static DEFINE_SPINLOCK(ipip_lock); 140 --- 583 unchanged lines hidden (view full) --- 724 strcpy(tunnel->parms.name, dev->name); 725 726 memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); 727 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 728 729 ipip_tunnel_bind_dev(dev); 730} 731 |
733static void ipip_fb_tunnel_init(struct net_device *dev) | 732static void __net_init ipip_fb_tunnel_init(struct net_device *dev) |
734{ 735 struct ip_tunnel *tunnel = netdev_priv(dev); 736 struct iphdr *iph = &tunnel->parms.iph; 737 struct ipip_net *ipn = net_generic(dev_net(dev), ipip_net_id); 738 739 tunnel->dev = dev; 740 strcpy(tunnel->parms.name, dev->name); 741 --- 26 unchanged lines hidden (view full) --- 768 while (t != NULL) { 769 unregister_netdevice_queue(t->dev, head); 770 t = t->next; 771 } 772 } 773 } 774} 775 | 733{ 734 struct ip_tunnel *tunnel = netdev_priv(dev); 735 struct iphdr *iph = &tunnel->parms.iph; 736 struct ipip_net *ipn = net_generic(dev_net(dev), ipip_net_id); 737 738 tunnel->dev = dev; 739 strcpy(tunnel->parms.name, dev->name); 740 --- 26 unchanged lines hidden (view full) --- 767 while (t != NULL) { 768 unregister_netdevice_queue(t->dev, head); 769 t = t->next; 770 } 771 } 772 } 773} 774 |
776static int ipip_init_net(struct net *net) | 775static int __net_init ipip_init_net(struct net *net) |
777{ 778 struct ipip_net *ipn = net_generic(net, ipip_net_id); 779 int err; 780 781 ipn->tunnels[0] = ipn->tunnels_wc; 782 ipn->tunnels[1] = ipn->tunnels_l; 783 ipn->tunnels[2] = ipn->tunnels_r; 784 ipn->tunnels[3] = ipn->tunnels_r_l; --- 16 unchanged lines hidden (view full) --- 801 802err_reg_dev: 803 free_netdev(ipn->fb_tunnel_dev); 804err_alloc_dev: 805 /* nothing */ 806 return err; 807} 808 | 776{ 777 struct ipip_net *ipn = net_generic(net, ipip_net_id); 778 int err; 779 780 ipn->tunnels[0] = ipn->tunnels_wc; 781 ipn->tunnels[1] = ipn->tunnels_l; 782 ipn->tunnels[2] = ipn->tunnels_r; 783 ipn->tunnels[3] = ipn->tunnels_r_l; --- 16 unchanged lines hidden (view full) --- 800 801err_reg_dev: 802 free_netdev(ipn->fb_tunnel_dev); 803err_alloc_dev: 804 /* nothing */ 805 return err; 806} 807 |
809static void ipip_exit_net(struct net *net) | 808static void __net_exit ipip_exit_net(struct net *net) |
810{ 811 struct ipip_net *ipn = net_generic(net, ipip_net_id); 812 LIST_HEAD(list); 813 814 rtnl_lock(); 815 ipip_destroy_tunnels(ipn, &list); 816 unregister_netdevice_queue(ipn->fb_tunnel_dev, &list); 817 unregister_netdevice_many(&list); --- 39 unchanged lines hidden --- | 809{ 810 struct ipip_net *ipn = net_generic(net, ipip_net_id); 811 LIST_HEAD(list); 812 813 rtnl_lock(); 814 ipip_destroy_tunnels(ipn, &list); 815 unregister_netdevice_queue(ipn->fb_tunnel_dev, &list); 816 unregister_netdevice_many(&list); --- 39 unchanged lines hidden --- |