aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 15:49:40 -0500
commit0191b625ca5a46206d2fb862bb08f36f2fcb3b31 (patch)
tree454d1842b1833d976da62abcbd5c47521ebe9bd7 /net/ipv6/sit.c
parent54a696bd07c14d3b1192d03ce7269bc59b45209a (diff)
parenteb56092fc168bf5af199d47af50c0d84a96db898 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits) net: Allow dependancies of FDDI & Tokenring to be modular. igb: Fix build warning when DCA is disabled. net: Fix warning fallout from recent NAPI interface changes. gro: Fix potential use after free sfc: If AN is enabled, always read speed/duplex from the AN advertising bits sfc: When disabling the NIC, close the device rather than unregistering it sfc: SFT9001: Add cable diagnostics sfc: Add support for multiple PHY self-tests sfc: Merge top-level functions for self-tests sfc: Clean up PHY mode management in loopback self-test sfc: Fix unreliable link detection in some loopback modes sfc: Generate unique names for per-NIC workqueues 802.3ad: use standard ethhdr instead of ad_header 802.3ad: generalize out mac address initializer 802.3ad: initialize ports LACPDU from const initializer 802.3ad: remove typedef around ad_system 802.3ad: turn ports is_individual into a bool 802.3ad: turn ports is_enabled into a bool 802.3ad: make ntt bool ixgbe: Fix set_ringparam in ixgbe to use the same memory pools. ... Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due to the conversion to %pI (in this networking merge) and the addition of doing IPv6 addresses (from the earlier merge of CIFS).
Diffstat (limited to 'net/ipv6/sit.c')
-rw-r--r--net/ipv6/sit.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index b7a50e968506..d3467e563f02 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -62,8 +62,8 @@
62#define HASH_SIZE 16 62#define HASH_SIZE 16
63#define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF) 63#define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF)
64 64
65static int ipip6_fb_tunnel_init(struct net_device *dev); 65static void ipip6_fb_tunnel_init(struct net_device *dev);
66static int ipip6_tunnel_init(struct net_device *dev); 66static void ipip6_tunnel_init(struct net_device *dev);
67static void ipip6_tunnel_setup(struct net_device *dev); 67static void ipip6_tunnel_setup(struct net_device *dev);
68 68
69static int sit_net_id; 69static int sit_net_id;
@@ -188,7 +188,8 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct net *net,
188 } 188 }
189 189
190 nt = netdev_priv(dev); 190 nt = netdev_priv(dev);
191 dev->init = ipip6_tunnel_init; 191 ipip6_tunnel_init(dev);
192
192 nt->parms = *parms; 193 nt->parms = *parms;
193 194
194 if (parms->i_flags & SIT_ISATAP) 195 if (parms->i_flags & SIT_ISATAP)
@@ -926,13 +927,17 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
926 return 0; 927 return 0;
927} 928}
928 929
930static const struct net_device_ops ipip6_netdev_ops = {
931 .ndo_uninit = ipip6_tunnel_uninit,
932 .ndo_start_xmit = ipip6_tunnel_xmit,
933 .ndo_do_ioctl = ipip6_tunnel_ioctl,
934 .ndo_change_mtu = ipip6_tunnel_change_mtu,
935};
936
929static void ipip6_tunnel_setup(struct net_device *dev) 937static void ipip6_tunnel_setup(struct net_device *dev)
930{ 938{
931 dev->uninit = ipip6_tunnel_uninit; 939 dev->netdev_ops = &ipip6_netdev_ops;
932 dev->destructor = free_netdev; 940 dev->destructor = free_netdev;
933 dev->hard_start_xmit = ipip6_tunnel_xmit;
934 dev->do_ioctl = ipip6_tunnel_ioctl;
935 dev->change_mtu = ipip6_tunnel_change_mtu;
936 941
937 dev->type = ARPHRD_SIT; 942 dev->type = ARPHRD_SIT;
938 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct iphdr); 943 dev->hard_header_len = LL_MAX_HEADER + sizeof(struct iphdr);
@@ -943,11 +948,9 @@ static void ipip6_tunnel_setup(struct net_device *dev)
943 dev->features |= NETIF_F_NETNS_LOCAL; 948 dev->features |= NETIF_F_NETNS_LOCAL;
944} 949}
945 950
946static int ipip6_tunnel_init(struct net_device *dev) 951static void ipip6_tunnel_init(struct net_device *dev)
947{ 952{
948 struct ip_tunnel *tunnel; 953 struct ip_tunnel *tunnel = netdev_priv(dev);
949
950 tunnel = netdev_priv(dev);
951 954
952 tunnel->dev = dev; 955 tunnel->dev = dev;
953 strcpy(tunnel->parms.name, dev->name); 956 strcpy(tunnel->parms.name, dev->name);
@@ -956,11 +959,9 @@ static int ipip6_tunnel_init(struct net_device *dev)
956 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 959 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
957 960
958 ipip6_tunnel_bind_dev(dev); 961 ipip6_tunnel_bind_dev(dev);
959
960 return 0;
961} 962}
962 963
963static int ipip6_fb_tunnel_init(struct net_device *dev) 964static void ipip6_fb_tunnel_init(struct net_device *dev)
964{ 965{
965 struct ip_tunnel *tunnel = netdev_priv(dev); 966 struct ip_tunnel *tunnel = netdev_priv(dev);
966 struct iphdr *iph = &tunnel->parms.iph; 967 struct iphdr *iph = &tunnel->parms.iph;
@@ -977,7 +978,6 @@ static int ipip6_fb_tunnel_init(struct net_device *dev)
977 978
978 dev_hold(dev); 979 dev_hold(dev);
979 sitn->tunnels_wc[0] = tunnel; 980 sitn->tunnels_wc[0] = tunnel;
980 return 0;
981} 981}
982 982
983static struct xfrm_tunnel sit_handler = { 983static struct xfrm_tunnel sit_handler = {
@@ -1025,16 +1025,17 @@ static int sit_init_net(struct net *net)
1025 err = -ENOMEM; 1025 err = -ENOMEM;
1026 goto err_alloc_dev; 1026 goto err_alloc_dev;
1027 } 1027 }
1028
1029 sitn->fb_tunnel_dev->init = ipip6_fb_tunnel_init;
1030 dev_net_set(sitn->fb_tunnel_dev, net); 1028 dev_net_set(sitn->fb_tunnel_dev, net);
1031 1029
1030 ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
1031
1032 if ((err = register_netdev(sitn->fb_tunnel_dev))) 1032 if ((err = register_netdev(sitn->fb_tunnel_dev)))
1033 goto err_reg_dev; 1033 goto err_reg_dev;
1034 1034
1035 return 0; 1035 return 0;
1036 1036
1037err_reg_dev: 1037err_reg_dev:
1038 dev_put(sitn->fb_tunnel_dev);
1038 free_netdev(sitn->fb_tunnel_dev); 1039 free_netdev(sitn->fb_tunnel_dev);
1039err_alloc_dev: 1040err_alloc_dev:
1040 /* nothing */ 1041 /* nothing */