aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/ipv6
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c198
-rw-r--r--net/ipv6/af_inet6.c40
-rw-r--r--net/ipv6/ah6.c40
-rw-r--r--net/ipv6/anycast.c4
-rw-r--r--net/ipv6/datagram.c52
-rw-r--r--net/ipv6/esp6.c30
-rw-r--r--net/ipv6/exthdrs.c14
-rw-r--r--net/ipv6/exthdrs_core.c16
-rw-r--r--net/ipv6/icmp.c38
-rw-r--r--net/ipv6/inet6_hashtables.c98
-rw-r--r--net/ipv6/ip6_fib.c66
-rw-r--r--net/ipv6/ip6_flowlabel.c4
-rw-r--r--net/ipv6/ip6_input.c18
-rw-r--r--net/ipv6/ip6_output.c24
-rw-r--r--net/ipv6/ip6_tunnel.c84
-rw-r--r--net/ipv6/ipcomp6.c22
-rw-r--r--net/ipv6/ipv6_sockglue.c12
-rw-r--r--net/ipv6/mcast.c36
-rw-r--r--net/ipv6/mip6.c2
-rw-r--r--net/ipv6/ndisc.c138
-rw-r--r--net/ipv6/netfilter.c4
-rw-r--r--net/ipv6/netfilter/ip6_queue.c152
-rw-r--r--net/ipv6/netfilter/ip6_tables.c40
-rw-r--r--net/ipv6/netfilter/ip6t_HL.c12
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c10
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c36
-rw-r--r--net/ipv6/netfilter/ip6t_ah.c22
-rw-r--r--net/ipv6/netfilter/ip6t_hl.c2
-rw-r--r--net/ipv6/netfilter/ip6t_ipv6header.c2
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c10
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c16
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c4
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c6
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c50
-rw-r--r--net/ipv6/proc.c22
-rw-r--r--net/ipv6/protocol.c2
-rw-r--r--net/ipv6/raw.c78
-rw-r--r--net/ipv6/reassembly.c32
-rw-r--r--net/ipv6/route.c108
-rw-r--r--net/ipv6/sit.c10
-rw-r--r--net/ipv6/sysctl_net_ipv6.c4
-rw-r--r--net/ipv6/tcp_ipv6.c98
-rw-r--r--net/ipv6/udp.c64
-rw-r--r--net/ipv6/udp_impl.h6
-rw-r--r--net/ipv6/xfrm6_input.c18
-rw-r--r--net/ipv6/xfrm6_output.c8
-rw-r--r--net/ipv6/xfrm6_policy.c14
-rw-r--r--net/ipv6/xfrm6_state.c2
-rw-r--r--net/ipv6/xfrm6_tunnel.c22
49 files changed, 896 insertions, 894 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index fe5e1d833871..77e56f2b1af2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3,7 +3,7 @@
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * 8 *
9 * $Id: addrconf.c,v 1.69 2001/10/31 21:55:54 davem Exp $ 9 * $Id: addrconf.c,v 1.69 2001/10/31 21:55:54 davem Exp $
@@ -105,7 +105,7 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p);
105 105
106#ifdef CONFIG_IPV6_PRIVACY 106#ifdef CONFIG_IPV6_PRIVACY
107static int __ipv6_regen_rndid(struct inet6_dev *idev); 107static int __ipv6_regen_rndid(struct inet6_dev *idev);
108static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); 108static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
109static void ipv6_regen_rndid(unsigned long data); 109static void ipv6_regen_rndid(unsigned long data);
110 110
111static int desync_factor = MAX_DESYNC_FACTOR * HZ; 111static int desync_factor = MAX_DESYNC_FACTOR * HZ;
@@ -137,7 +137,7 @@ static void addrconf_rs_timer(unsigned long data);
137static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 137static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
138static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 138static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
139 139
140static void inet6_prefix_notify(int event, struct inet6_dev *idev, 140static void inet6_prefix_notify(int event, struct inet6_dev *idev,
141 struct prefix_info *pinfo); 141 struct prefix_info *pinfo);
142static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); 142static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev);
143 143
@@ -241,7 +241,7 @@ int __ipv6_addr_type(const struct in6_addr *addr)
241 */ 241 */
242 if ((st & htonl(0xE0000000)) != htonl(0x00000000) && 242 if ((st & htonl(0xE0000000)) != htonl(0x00000000) &&
243 (st & htonl(0xE0000000)) != htonl(0xE0000000)) 243 (st & htonl(0xE0000000)) != htonl(0xE0000000))
244 return (IPV6_ADDR_UNICAST | 244 return (IPV6_ADDR_UNICAST |
245 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); 245 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL));
246 246
247 if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) { 247 if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) {
@@ -252,7 +252,7 @@ int __ipv6_addr_type(const struct in6_addr *addr)
252 } 252 }
253 253
254 if ((st & htonl(0xFFC00000)) == htonl(0xFE800000)) 254 if ((st & htonl(0xFFC00000)) == htonl(0xFE800000))
255 return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST | 255 return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST |
256 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.1 */ 256 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.1 */
257 if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) 257 if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000))
258 return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | 258 return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST |
@@ -272,11 +272,11 @@ int __ipv6_addr_type(const struct in6_addr *addr)
272 } 272 }
273 273
274 if (addr->s6_addr32[2] == htonl(0x0000ffff)) 274 if (addr->s6_addr32[2] == htonl(0x0000ffff))
275 return (IPV6_ADDR_MAPPED | 275 return (IPV6_ADDR_MAPPED |
276 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ 276 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */
277 } 277 }
278 278
279 return (IPV6_ADDR_RESERVED | 279 return (IPV6_ADDR_RESERVED |
280 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.4 */ 280 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.4 */
281} 281}
282 282
@@ -348,10 +348,10 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
348 if (dev->mtu < IPV6_MIN_MTU) 348 if (dev->mtu < IPV6_MIN_MTU)
349 return NULL; 349 return NULL;
350 350
351 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); 351 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL);
352 352
353 if (ndev == NULL) 353 if (ndev == NULL)
354 return NULL; 354 return NULL;
355 355
356 rwlock_init(&ndev->lock); 356 rwlock_init(&ndev->lock);
357 ndev->dev = dev; 357 ndev->dev = dev;
@@ -462,7 +462,7 @@ static void dev_forward_change(struct inet6_dev *idev)
462 dev = idev->dev; 462 dev = idev->dev;
463 if (dev && (dev->flags & IFF_MULTICAST)) { 463 if (dev && (dev->flags & IFF_MULTICAST)) {
464 ipv6_addr_all_routers(&addr); 464 ipv6_addr_all_routers(&addr);
465 465
466 if (idev->cnf.forwarding) 466 if (idev->cnf.forwarding)
467 ipv6_dev_mc_inc(dev, &addr); 467 ipv6_dev_mc_inc(dev, &addr);
468 else 468 else
@@ -817,8 +817,8 @@ retry:
817 tmp_valid_lft = min_t(__u32, 817 tmp_valid_lft = min_t(__u32,
818 ifp->valid_lft, 818 ifp->valid_lft,
819 idev->cnf.temp_valid_lft); 819 idev->cnf.temp_valid_lft);
820 tmp_prefered_lft = min_t(__u32, 820 tmp_prefered_lft = min_t(__u32,
821 ifp->prefered_lft, 821 ifp->prefered_lft,
822 idev->cnf.temp_prefered_lft - desync_factor / HZ); 822 idev->cnf.temp_prefered_lft - desync_factor / HZ);
823 tmp_plen = ifp->prefix_len; 823 tmp_plen = ifp->prefix_len;
824 max_addresses = idev->cnf.max_addresses; 824 max_addresses = idev->cnf.max_addresses;
@@ -828,7 +828,7 @@ retry:
828 828
829 write_unlock(&idev->lock); 829 write_unlock(&idev->lock);
830 ift = !max_addresses || 830 ift = !max_addresses ||
831 ipv6_count_addresses(idev) < max_addresses ? 831 ipv6_count_addresses(idev) < max_addresses ?
832 ipv6_add_addr(idev, &addr, tmp_plen, 832 ipv6_add_addr(idev, &addr, tmp_plen,
833 ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, IFA_F_TEMPORARY) : NULL; 833 ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, IFA_F_TEMPORARY) : NULL;
834 if (!ift || IS_ERR(ift)) { 834 if (!ift || IS_ERR(ift)) {
@@ -1160,7 +1160,7 @@ record_it:
1160 1160
1161 if (!ifa_result) 1161 if (!ifa_result)
1162 return -EADDRNOTAVAIL; 1162 return -EADDRNOTAVAIL;
1163 1163
1164 ipv6_addr_copy(saddr, &ifa_result->addr); 1164 ipv6_addr_copy(saddr, &ifa_result->addr);
1165 in6_ifa_put(ifa_result); 1165 in6_ifa_put(ifa_result);
1166 return 0; 1166 return 0;
@@ -1475,7 +1475,7 @@ regen:
1475 * - value 0 1475 * - value 0
1476 * - XXX: already assigned to an address on the device 1476 * - XXX: already assigned to an address on the device
1477 */ 1477 */
1478 if (idev->rndid[0] == 0xfd && 1478 if (idev->rndid[0] == 0xfd &&
1479 (idev->rndid[1]&idev->rndid[2]&idev->rndid[3]&idev->rndid[4]&idev->rndid[5]&idev->rndid[6]) == 0xff && 1479 (idev->rndid[1]&idev->rndid[2]&idev->rndid[3]&idev->rndid[4]&idev->rndid[5]&idev->rndid[6]) == 0xff &&
1480 (idev->rndid[7]&0x80)) 1480 (idev->rndid[7]&0x80))
1481 goto regen; 1481 goto regen;
@@ -1502,9 +1502,9 @@ static void ipv6_regen_rndid(unsigned long data)
1502 1502
1503 if (__ipv6_regen_rndid(idev) < 0) 1503 if (__ipv6_regen_rndid(idev) < 0)
1504 goto out; 1504 goto out;
1505 1505
1506 expires = jiffies + 1506 expires = jiffies +
1507 idev->cnf.temp_prefered_lft * HZ - 1507 idev->cnf.temp_prefered_lft * HZ -
1508 idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - desync_factor; 1508 idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - desync_factor;
1509 if (time_before(expires, jiffies)) { 1509 if (time_before(expires, jiffies)) {
1510 printk(KERN_WARNING 1510 printk(KERN_WARNING
@@ -1630,12 +1630,12 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1630 struct inet6_dev *in6_dev; 1630 struct inet6_dev *in6_dev;
1631 1631
1632 pinfo = (struct prefix_info *) opt; 1632 pinfo = (struct prefix_info *) opt;
1633 1633
1634 if (len < sizeof(struct prefix_info)) { 1634 if (len < sizeof(struct prefix_info)) {
1635 ADBG(("addrconf: prefix option too short\n")); 1635 ADBG(("addrconf: prefix option too short\n"));
1636 return; 1636 return;
1637 } 1637 }
1638 1638
1639 /* 1639 /*
1640 * Validation checks ([ADDRCONF], page 19) 1640 * Validation checks ([ADDRCONF], page 19)
1641 */ 1641 */
@@ -1827,7 +1827,7 @@ ok:
1827 * When a new public address is created as described in [ADDRCONF], 1827 * When a new public address is created as described in [ADDRCONF],
1828 * also create a new temporary address. 1828 * also create a new temporary address.
1829 */ 1829 */
1830 read_unlock_bh(&in6_dev->lock); 1830 read_unlock_bh(&in6_dev->lock);
1831 ipv6_create_tempaddr(ifp, NULL); 1831 ipv6_create_tempaddr(ifp, NULL);
1832 } else { 1832 } else {
1833 read_unlock_bh(&in6_dev->lock); 1833 read_unlock_bh(&in6_dev->lock);
@@ -1913,14 +1913,14 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen,
1913 int scope; 1913 int scope;
1914 1914
1915 ASSERT_RTNL(); 1915 ASSERT_RTNL();
1916 1916
1917 /* check the lifetime */ 1917 /* check the lifetime */
1918 if (!valid_lft || prefered_lft > valid_lft) 1918 if (!valid_lft || prefered_lft > valid_lft)
1919 return -EINVAL; 1919 return -EINVAL;
1920 1920
1921 if ((dev = __dev_get_by_index(ifindex)) == NULL) 1921 if ((dev = __dev_get_by_index(ifindex)) == NULL)
1922 return -ENODEV; 1922 return -ENODEV;
1923 1923
1924 if ((idev = addrconf_add_dev(dev)) == NULL) 1924 if ((idev = addrconf_add_dev(dev)) == NULL)
1925 return -ENOBUFS; 1925 return -ENOBUFS;
1926 1926
@@ -1960,7 +1960,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen)
1960 struct inet6_ifaddr *ifp; 1960 struct inet6_ifaddr *ifp;
1961 struct inet6_dev *idev; 1961 struct inet6_dev *idev;
1962 struct net_device *dev; 1962 struct net_device *dev;
1963 1963
1964 if ((dev = __dev_get_by_index(ifindex)) == NULL) 1964 if ((dev = __dev_get_by_index(ifindex)) == NULL)
1965 return -ENODEV; 1965 return -ENODEV;
1966 1966
@@ -1973,7 +1973,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen)
1973 ipv6_addr_equal(pfx, &ifp->addr)) { 1973 ipv6_addr_equal(pfx, &ifp->addr)) {
1974 in6_ifa_hold(ifp); 1974 in6_ifa_hold(ifp);
1975 read_unlock_bh(&idev->lock); 1975 read_unlock_bh(&idev->lock);
1976 1976
1977 ipv6_del_addr(ifp); 1977 ipv6_del_addr(ifp);
1978 1978
1979 /* If the last address is deleted administratively, 1979 /* If the last address is deleted administratively,
@@ -1993,10 +1993,10 @@ int addrconf_add_ifaddr(void __user *arg)
1993{ 1993{
1994 struct in6_ifreq ireq; 1994 struct in6_ifreq ireq;
1995 int err; 1995 int err;
1996 1996
1997 if (!capable(CAP_NET_ADMIN)) 1997 if (!capable(CAP_NET_ADMIN))
1998 return -EPERM; 1998 return -EPERM;
1999 1999
2000 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq))) 2000 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
2001 return -EFAULT; 2001 return -EFAULT;
2002 2002
@@ -2011,7 +2011,7 @@ int addrconf_del_ifaddr(void __user *arg)
2011{ 2011{
2012 struct in6_ifreq ireq; 2012 struct in6_ifreq ireq;
2013 int err; 2013 int err;
2014 2014
2015 if (!capable(CAP_NET_ADMIN)) 2015 if (!capable(CAP_NET_ADMIN))
2016 return -EPERM; 2016 return -EPERM;
2017 2017
@@ -2056,7 +2056,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2056 return; 2056 return;
2057 } 2057 }
2058 2058
2059 for (dev = dev_base; dev != NULL; dev = dev->next) { 2059 for (dev = dev_base; dev != NULL; dev = dev->next) {
2060 struct in_device * in_dev = __in_dev_get_rtnl(dev); 2060 struct in_device * in_dev = __in_dev_get_rtnl(dev);
2061 if (in_dev && (dev->flags & IFF_UP)) { 2061 if (in_dev && (dev->flags & IFF_UP)) {
2062 struct in_ifaddr * ifa; 2062 struct in_ifaddr * ifa;
@@ -2091,7 +2091,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2091 } 2091 }
2092 } 2092 }
2093 } 2093 }
2094 } 2094 }
2095} 2095}
2096#endif 2096#endif
2097 2097
@@ -2137,7 +2137,7 @@ static void addrconf_dev_config(struct net_device *dev)
2137 2137
2138 ASSERT_RTNL(); 2138 ASSERT_RTNL();
2139 2139
2140 if ((dev->type != ARPHRD_ETHER) && 2140 if ((dev->type != ARPHRD_ETHER) &&
2141 (dev->type != ARPHRD_FDDI) && 2141 (dev->type != ARPHRD_FDDI) &&
2142 (dev->type != ARPHRD_IEEE802_TR) && 2142 (dev->type != ARPHRD_IEEE802_TR) &&
2143 (dev->type != ARPHRD_ARCNET) && 2143 (dev->type != ARPHRD_ARCNET) &&
@@ -2164,9 +2164,9 @@ static void addrconf_sit_config(struct net_device *dev)
2164 2164
2165 ASSERT_RTNL(); 2165 ASSERT_RTNL();
2166 2166
2167 /* 2167 /*
2168 * Configure the tunnel with one of our IPv4 2168 * Configure the tunnel with one of our IPv4
2169 * addresses... we should configure all of 2169 * addresses... we should configure all of
2170 * our v4 addrs in the tunnel 2170 * our v4 addrs in the tunnel
2171 */ 2171 */
2172 2172
@@ -2233,7 +2233,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
2233 ip6_tnl_add_linklocal(idev); 2233 ip6_tnl_add_linklocal(idev);
2234} 2234}
2235 2235
2236static int addrconf_notify(struct notifier_block *this, unsigned long event, 2236static int addrconf_notify(struct notifier_block *this, unsigned long event,
2237 void * data) 2237 void * data)
2238{ 2238{
2239 struct net_device *dev = (struct net_device *) data; 2239 struct net_device *dev = (struct net_device *) data;
@@ -2378,7 +2378,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2378 return -ENODEV; 2378 return -ENODEV;
2379 2379
2380 /* Step 1: remove reference to ipv6 device from parent device. 2380 /* Step 1: remove reference to ipv6 device from parent device.
2381 Do not dev_put! 2381 Do not dev_put!
2382 */ 2382 */
2383 if (how == 1) { 2383 if (how == 1) {
2384 idev->dead = 1; 2384 idev->dead = 1;
@@ -2461,7 +2461,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2461 /* Step 5: netlink notification of this interface */ 2461 /* Step 5: netlink notification of this interface */
2462 idev->tstamp = jiffies; 2462 idev->tstamp = jiffies;
2463 inet6_ifinfo_notify(RTM_DELLINK, idev); 2463 inet6_ifinfo_notify(RTM_DELLINK, idev);
2464 2464
2465 /* Shot the device (if unregistered) */ 2465 /* Shot the device (if unregistered) */
2466 2466
2467 if (how == 1) { 2467 if (how == 1) {
@@ -2850,8 +2850,8 @@ restart:
2850 age = (now - ifp->tstamp) / HZ; 2850 age = (now - ifp->tstamp) / HZ;
2851 2851
2852#ifdef CONFIG_IPV6_PRIVACY 2852#ifdef CONFIG_IPV6_PRIVACY
2853 regen_advance = ifp->idev->cnf.regen_max_retry * 2853 regen_advance = ifp->idev->cnf.regen_max_retry *
2854 ifp->idev->cnf.dad_transmits * 2854 ifp->idev->cnf.dad_transmits *
2855 ifp->idev->nd_parms->retrans_time / HZ; 2855 ifp->idev->nd_parms->retrans_time / HZ;
2856#endif 2856#endif
2857 2857
@@ -3217,7 +3217,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3217 s_idx = cb->args[0]; 3217 s_idx = cb->args[0];
3218 s_ip_idx = ip_idx = cb->args[1]; 3218 s_ip_idx = ip_idx = cb->args[1];
3219 read_lock(&dev_base_lock); 3219 read_lock(&dev_base_lock);
3220 3220
3221 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { 3221 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) {
3222 if (idx < s_idx) 3222 if (idx < s_idx)
3223 continue; 3223 continue;
@@ -3234,8 +3234,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3234 ifa = ifa->if_next, ip_idx++) { 3234 ifa = ifa->if_next, ip_idx++) {
3235 if (ip_idx < s_ip_idx) 3235 if (ip_idx < s_ip_idx)
3236 continue; 3236 continue;
3237 if ((err = inet6_fill_ifaddr(skb, ifa, 3237 if ((err = inet6_fill_ifaddr(skb, ifa,
3238 NETLINK_CB(cb->skb).pid, 3238 NETLINK_CB(cb->skb).pid,
3239 cb->nlh->nlmsg_seq, RTM_NEWADDR, 3239 cb->nlh->nlmsg_seq, RTM_NEWADDR,
3240 NLM_F_MULTI)) <= 0) 3240 NLM_F_MULTI)) <= 0)
3241 goto done; 3241 goto done;
@@ -3243,12 +3243,12 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3243 break; 3243 break;
3244 case MULTICAST_ADDR: 3244 case MULTICAST_ADDR:
3245 /* multicast address */ 3245 /* multicast address */
3246 for (ifmca = idev->mc_list; ifmca; 3246 for (ifmca = idev->mc_list; ifmca;
3247 ifmca = ifmca->next, ip_idx++) { 3247 ifmca = ifmca->next, ip_idx++) {
3248 if (ip_idx < s_ip_idx) 3248 if (ip_idx < s_ip_idx)
3249 continue; 3249 continue;
3250 if ((err = inet6_fill_ifmcaddr(skb, ifmca, 3250 if ((err = inet6_fill_ifmcaddr(skb, ifmca,
3251 NETLINK_CB(cb->skb).pid, 3251 NETLINK_CB(cb->skb).pid,
3252 cb->nlh->nlmsg_seq, RTM_GETMULTICAST, 3252 cb->nlh->nlmsg_seq, RTM_GETMULTICAST,
3253 NLM_F_MULTI)) <= 0) 3253 NLM_F_MULTI)) <= 0)
3254 goto done; 3254 goto done;
@@ -3260,10 +3260,10 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3260 ifaca = ifaca->aca_next, ip_idx++) { 3260 ifaca = ifaca->aca_next, ip_idx++) {
3261 if (ip_idx < s_ip_idx) 3261 if (ip_idx < s_ip_idx)
3262 continue; 3262 continue;
3263 if ((err = inet6_fill_ifacaddr(skb, ifaca, 3263 if ((err = inet6_fill_ifacaddr(skb, ifaca,
3264 NETLINK_CB(cb->skb).pid, 3264 NETLINK_CB(cb->skb).pid,
3265 cb->nlh->nlmsg_seq, RTM_GETANYCAST, 3265 cb->nlh->nlmsg_seq, RTM_GETANYCAST,
3266 NLM_F_MULTI)) <= 0) 3266 NLM_F_MULTI)) <= 0)
3267 goto done; 3267 goto done;
3268 } 3268 }
3269 break; 3269 break;
@@ -3426,7 +3426,7 @@ static inline size_t inet6_if_nlmsg_size(void)
3426 ); 3426 );
3427} 3427}
3428 3428
3429static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, 3429static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
3430 u32 pid, u32 seq, int event, unsigned int flags) 3430 u32 pid, u32 seq, int event, unsigned int flags)
3431{ 3431{
3432 struct net_device *dev = idev->dev; 3432 struct net_device *dev = idev->dev;
@@ -3498,7 +3498,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3498 continue; 3498 continue;
3499 if ((idev = in6_dev_get(dev)) == NULL) 3499 if ((idev = in6_dev_get(dev)) == NULL)
3500 continue; 3500 continue;
3501 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, 3501 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
3502 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI); 3502 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI);
3503 in6_dev_put(idev); 3503 in6_dev_put(idev);
3504 if (err <= 0) 3504 if (err <= 0)
@@ -3514,7 +3514,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3514{ 3514{
3515 struct sk_buff *skb; 3515 struct sk_buff *skb;
3516 int err = -ENOBUFS; 3516 int err = -ENOBUFS;
3517 3517
3518 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); 3518 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC);
3519 if (skb == NULL) 3519 if (skb == NULL)
3520 goto errout; 3520 goto errout;
@@ -3578,7 +3578,7 @@ nla_put_failure:
3578 return -EMSGSIZE; 3578 return -EMSGSIZE;
3579} 3579}
3580 3580
3581static void inet6_prefix_notify(int event, struct inet6_dev *idev, 3581static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3582 struct prefix_info *pinfo) 3582 struct prefix_info *pinfo)
3583{ 3583{
3584 struct sk_buff *skb; 3584 struct sk_buff *skb;
@@ -3675,10 +3675,10 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
3675 rt6_purge_dflt_routers(); 3675 rt6_purge_dflt_routers();
3676 } 3676 }
3677 3677
3678 return ret; 3678 return ret;
3679} 3679}
3680 3680
3681static int addrconf_sysctl_forward_strategy(ctl_table *table, 3681static int addrconf_sysctl_forward_strategy(ctl_table *table,
3682 int __user *name, int nlen, 3682 int __user *name, int nlen,
3683 void __user *oldval, 3683 void __user *oldval,
3684 size_t __user *oldlenp, 3684 size_t __user *oldlenp,
@@ -3743,19 +3743,19 @@ static struct addrconf_sysctl_table
3743} addrconf_sysctl __read_mostly = { 3743} addrconf_sysctl __read_mostly = {
3744 .sysctl_header = NULL, 3744 .sysctl_header = NULL,
3745 .addrconf_vars = { 3745 .addrconf_vars = {
3746 { 3746 {
3747 .ctl_name = NET_IPV6_FORWARDING, 3747 .ctl_name = NET_IPV6_FORWARDING,
3748 .procname = "forwarding", 3748 .procname = "forwarding",
3749 .data = &ipv6_devconf.forwarding, 3749 .data = &ipv6_devconf.forwarding,
3750 .maxlen = sizeof(int), 3750 .maxlen = sizeof(int),
3751 .mode = 0644, 3751 .mode = 0644,
3752 .proc_handler = &addrconf_sysctl_forward, 3752 .proc_handler = &addrconf_sysctl_forward,
3753 .strategy = &addrconf_sysctl_forward_strategy, 3753 .strategy = &addrconf_sysctl_forward_strategy,
3754 }, 3754 },
3755 { 3755 {
3756 .ctl_name = NET_IPV6_HOP_LIMIT, 3756 .ctl_name = NET_IPV6_HOP_LIMIT,
3757 .procname = "hop_limit", 3757 .procname = "hop_limit",
3758 .data = &ipv6_devconf.hop_limit, 3758 .data = &ipv6_devconf.hop_limit,
3759 .maxlen = sizeof(int), 3759 .maxlen = sizeof(int),
3760 .mode = 0644, 3760 .mode = 0644,
3761 .proc_handler = proc_dointvec, 3761 .proc_handler = proc_dointvec,
@@ -3764,116 +3764,116 @@ static struct addrconf_sysctl_table
3764 .ctl_name = NET_IPV6_MTU, 3764 .ctl_name = NET_IPV6_MTU,
3765 .procname = "mtu", 3765 .procname = "mtu",
3766 .data = &ipv6_devconf.mtu6, 3766 .data = &ipv6_devconf.mtu6,
3767 .maxlen = sizeof(int), 3767 .maxlen = sizeof(int),
3768 .mode = 0644, 3768 .mode = 0644,
3769 .proc_handler = &proc_dointvec, 3769 .proc_handler = &proc_dointvec,
3770 }, 3770 },
3771 { 3771 {
3772 .ctl_name = NET_IPV6_ACCEPT_RA, 3772 .ctl_name = NET_IPV6_ACCEPT_RA,
3773 .procname = "accept_ra", 3773 .procname = "accept_ra",
3774 .data = &ipv6_devconf.accept_ra, 3774 .data = &ipv6_devconf.accept_ra,
3775 .maxlen = sizeof(int), 3775 .maxlen = sizeof(int),
3776 .mode = 0644, 3776 .mode = 0644,
3777 .proc_handler = &proc_dointvec, 3777 .proc_handler = &proc_dointvec,
3778 }, 3778 },
3779 { 3779 {
3780 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, 3780 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS,
3781 .procname = "accept_redirects", 3781 .procname = "accept_redirects",
3782 .data = &ipv6_devconf.accept_redirects, 3782 .data = &ipv6_devconf.accept_redirects,
3783 .maxlen = sizeof(int), 3783 .maxlen = sizeof(int),
3784 .mode = 0644, 3784 .mode = 0644,
3785 .proc_handler = &proc_dointvec, 3785 .proc_handler = &proc_dointvec,
3786 }, 3786 },
3787 { 3787 {
3788 .ctl_name = NET_IPV6_AUTOCONF, 3788 .ctl_name = NET_IPV6_AUTOCONF,
3789 .procname = "autoconf", 3789 .procname = "autoconf",
3790 .data = &ipv6_devconf.autoconf, 3790 .data = &ipv6_devconf.autoconf,
3791 .maxlen = sizeof(int), 3791 .maxlen = sizeof(int),
3792 .mode = 0644, 3792 .mode = 0644,
3793 .proc_handler = &proc_dointvec, 3793 .proc_handler = &proc_dointvec,
3794 }, 3794 },
3795 { 3795 {
3796 .ctl_name = NET_IPV6_DAD_TRANSMITS, 3796 .ctl_name = NET_IPV6_DAD_TRANSMITS,
3797 .procname = "dad_transmits", 3797 .procname = "dad_transmits",
3798 .data = &ipv6_devconf.dad_transmits, 3798 .data = &ipv6_devconf.dad_transmits,
3799 .maxlen = sizeof(int), 3799 .maxlen = sizeof(int),
3800 .mode = 0644, 3800 .mode = 0644,
3801 .proc_handler = &proc_dointvec, 3801 .proc_handler = &proc_dointvec,
3802 }, 3802 },
3803 { 3803 {
3804 .ctl_name = NET_IPV6_RTR_SOLICITS, 3804 .ctl_name = NET_IPV6_RTR_SOLICITS,
3805 .procname = "router_solicitations", 3805 .procname = "router_solicitations",
3806 .data = &ipv6_devconf.rtr_solicits, 3806 .data = &ipv6_devconf.rtr_solicits,
3807 .maxlen = sizeof(int), 3807 .maxlen = sizeof(int),
3808 .mode = 0644, 3808 .mode = 0644,
3809 .proc_handler = &proc_dointvec, 3809 .proc_handler = &proc_dointvec,
3810 }, 3810 },
3811 { 3811 {
3812 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, 3812 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL,
3813 .procname = "router_solicitation_interval", 3813 .procname = "router_solicitation_interval",
3814 .data = &ipv6_devconf.rtr_solicit_interval, 3814 .data = &ipv6_devconf.rtr_solicit_interval,
3815 .maxlen = sizeof(int), 3815 .maxlen = sizeof(int),
3816 .mode = 0644, 3816 .mode = 0644,
3817 .proc_handler = &proc_dointvec_jiffies, 3817 .proc_handler = &proc_dointvec_jiffies,
3818 .strategy = &sysctl_jiffies, 3818 .strategy = &sysctl_jiffies,
3819 }, 3819 },
3820 { 3820 {
3821 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, 3821 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY,
3822 .procname = "router_solicitation_delay", 3822 .procname = "router_solicitation_delay",
3823 .data = &ipv6_devconf.rtr_solicit_delay, 3823 .data = &ipv6_devconf.rtr_solicit_delay,
3824 .maxlen = sizeof(int), 3824 .maxlen = sizeof(int),
3825 .mode = 0644, 3825 .mode = 0644,
3826 .proc_handler = &proc_dointvec_jiffies, 3826 .proc_handler = &proc_dointvec_jiffies,
3827 .strategy = &sysctl_jiffies, 3827 .strategy = &sysctl_jiffies,
3828 }, 3828 },
3829 { 3829 {
3830 .ctl_name = NET_IPV6_FORCE_MLD_VERSION, 3830 .ctl_name = NET_IPV6_FORCE_MLD_VERSION,
3831 .procname = "force_mld_version", 3831 .procname = "force_mld_version",
3832 .data = &ipv6_devconf.force_mld_version, 3832 .data = &ipv6_devconf.force_mld_version,
3833 .maxlen = sizeof(int), 3833 .maxlen = sizeof(int),
3834 .mode = 0644, 3834 .mode = 0644,
3835 .proc_handler = &proc_dointvec, 3835 .proc_handler = &proc_dointvec,
3836 }, 3836 },
3837#ifdef CONFIG_IPV6_PRIVACY 3837#ifdef CONFIG_IPV6_PRIVACY
3838 { 3838 {
3839 .ctl_name = NET_IPV6_USE_TEMPADDR, 3839 .ctl_name = NET_IPV6_USE_TEMPADDR,
3840 .procname = "use_tempaddr", 3840 .procname = "use_tempaddr",
3841 .data = &ipv6_devconf.use_tempaddr, 3841 .data = &ipv6_devconf.use_tempaddr,
3842 .maxlen = sizeof(int), 3842 .maxlen = sizeof(int),
3843 .mode = 0644, 3843 .mode = 0644,
3844 .proc_handler = &proc_dointvec, 3844 .proc_handler = &proc_dointvec,
3845 }, 3845 },
3846 { 3846 {
3847 .ctl_name = NET_IPV6_TEMP_VALID_LFT, 3847 .ctl_name = NET_IPV6_TEMP_VALID_LFT,
3848 .procname = "temp_valid_lft", 3848 .procname = "temp_valid_lft",
3849 .data = &ipv6_devconf.temp_valid_lft, 3849 .data = &ipv6_devconf.temp_valid_lft,
3850 .maxlen = sizeof(int), 3850 .maxlen = sizeof(int),
3851 .mode = 0644, 3851 .mode = 0644,
3852 .proc_handler = &proc_dointvec, 3852 .proc_handler = &proc_dointvec,
3853 }, 3853 },
3854 { 3854 {
3855 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, 3855 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT,
3856 .procname = "temp_prefered_lft", 3856 .procname = "temp_prefered_lft",
3857 .data = &ipv6_devconf.temp_prefered_lft, 3857 .data = &ipv6_devconf.temp_prefered_lft,
3858 .maxlen = sizeof(int), 3858 .maxlen = sizeof(int),
3859 .mode = 0644, 3859 .mode = 0644,
3860 .proc_handler = &proc_dointvec, 3860 .proc_handler = &proc_dointvec,
3861 }, 3861 },
3862 { 3862 {
3863 .ctl_name = NET_IPV6_REGEN_MAX_RETRY, 3863 .ctl_name = NET_IPV6_REGEN_MAX_RETRY,
3864 .procname = "regen_max_retry", 3864 .procname = "regen_max_retry",
3865 .data = &ipv6_devconf.regen_max_retry, 3865 .data = &ipv6_devconf.regen_max_retry,
3866 .maxlen = sizeof(int), 3866 .maxlen = sizeof(int),
3867 .mode = 0644, 3867 .mode = 0644,
3868 .proc_handler = &proc_dointvec, 3868 .proc_handler = &proc_dointvec,
3869 }, 3869 },
3870 { 3870 {
3871 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, 3871 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR,
3872 .procname = "max_desync_factor", 3872 .procname = "max_desync_factor",
3873 .data = &ipv6_devconf.max_desync_factor, 3873 .data = &ipv6_devconf.max_desync_factor,
3874 .maxlen = sizeof(int), 3874 .maxlen = sizeof(int),
3875 .mode = 0644, 3875 .mode = 0644,
3876 .proc_handler = &proc_dointvec, 3876 .proc_handler = &proc_dointvec,
3877 }, 3877 },
3878#endif 3878#endif
3879 { 3879 {
@@ -3887,18 +3887,18 @@ static struct addrconf_sysctl_table
3887 { 3887 {
3888 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, 3888 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR,
3889 .procname = "accept_ra_defrtr", 3889 .procname = "accept_ra_defrtr",
3890 .data = &ipv6_devconf.accept_ra_defrtr, 3890 .data = &ipv6_devconf.accept_ra_defrtr,
3891 .maxlen = sizeof(int), 3891 .maxlen = sizeof(int),
3892 .mode = 0644, 3892 .mode = 0644,
3893 .proc_handler = &proc_dointvec, 3893 .proc_handler = &proc_dointvec,
3894 }, 3894 },
3895 { 3895 {
3896 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, 3896 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO,
3897 .procname = "accept_ra_pinfo", 3897 .procname = "accept_ra_pinfo",
3898 .data = &ipv6_devconf.accept_ra_pinfo, 3898 .data = &ipv6_devconf.accept_ra_pinfo,
3899 .maxlen = sizeof(int), 3899 .maxlen = sizeof(int),
3900 .mode = 0644, 3900 .mode = 0644,
3901 .proc_handler = &proc_dointvec, 3901 .proc_handler = &proc_dointvec,
3902 }, 3902 },
3903#ifdef CONFIG_IPV6_ROUTER_PREF 3903#ifdef CONFIG_IPV6_ROUTER_PREF
3904 { 3904 {
@@ -4003,18 +4003,18 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
4003 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ 4003 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */
4004 } 4004 }
4005 if (dev) { 4005 if (dev) {
4006 dev_name = dev->name; 4006 dev_name = dev->name;
4007 t->addrconf_dev[0].ctl_name = dev->ifindex; 4007 t->addrconf_dev[0].ctl_name = dev->ifindex;
4008 } else { 4008 } else {
4009 dev_name = "default"; 4009 dev_name = "default";
4010 t->addrconf_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; 4010 t->addrconf_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT;
4011 } 4011 }
4012 4012
4013 /* 4013 /*
4014 * Make a copy of dev_name, because '.procname' is regarded as const 4014 * Make a copy of dev_name, because '.procname' is regarded as const
4015 * by sysctl and we wouldn't want anyone to change it under our feet 4015 * by sysctl and we wouldn't want anyone to change it under our feet
4016 * (see SIOCSIFNAME). 4016 * (see SIOCSIFNAME).
4017 */ 4017 */
4018 dev_name = kstrdup(dev_name, GFP_KERNEL); 4018 dev_name = kstrdup(dev_name, GFP_KERNEL);
4019 if (!dev_name) 4019 if (!dev_name)
4020 goto free; 4020 goto free;
@@ -4066,12 +4066,12 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p)
4066 4066
4067int register_inet6addr_notifier(struct notifier_block *nb) 4067int register_inet6addr_notifier(struct notifier_block *nb)
4068{ 4068{
4069 return atomic_notifier_chain_register(&inet6addr_chain, nb); 4069 return atomic_notifier_chain_register(&inet6addr_chain, nb);
4070} 4070}
4071 4071
4072int unregister_inet6addr_notifier(struct notifier_block *nb) 4072int unregister_inet6addr_notifier(struct notifier_block *nb)
4073{ 4073{
4074 return atomic_notifier_chain_unregister(&inet6addr_chain,nb); 4074 return atomic_notifier_chain_unregister(&inet6addr_chain,nb);
4075} 4075}
4076 4076
4077/* 4077/*
@@ -4124,9 +4124,9 @@ int __init addrconf_init(void)
4124 4124
4125void __exit addrconf_cleanup(void) 4125void __exit addrconf_cleanup(void)
4126{ 4126{
4127 struct net_device *dev; 4127 struct net_device *dev;
4128 struct inet6_dev *idev; 4128 struct inet6_dev *idev;
4129 struct inet6_ifaddr *ifa; 4129 struct inet6_ifaddr *ifa;
4130 int i; 4130 int i;
4131 4131
4132 unregister_netdevice_notifier(&ipv6_dev_notf); 4132 unregister_netdevice_notifier(&ipv6_dev_notf);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 0e0e4262f4dc..a006d242be76 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * PF_INET6 socket protocol family 2 * PF_INET6 socket protocol family
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * Adapted from linux/net/ipv4/af_inet.c 8 * Adapted from linux/net/ipv4/af_inet.c
9 * 9 *
@@ -191,7 +191,7 @@ lookup_protocol:
191 np->mc_loop = 1; 191 np->mc_loop = 1;
192 np->pmtudisc = IPV6_PMTUDISC_WANT; 192 np->pmtudisc = IPV6_PMTUDISC_WANT;
193 np->ipv6only = sysctl_ipv6_bindv6only; 193 np->ipv6only = sysctl_ipv6_bindv6only;
194 194
195 /* Init the ipv4 part of the socket since we can have sockets 195 /* Init the ipv4 part of the socket since we can have sockets
196 * using v6 API for ipv4. 196 * using v6 API for ipv4.
197 */ 197 */
@@ -206,7 +206,7 @@ lookup_protocol:
206 inet->pmtudisc = IP_PMTUDISC_DONT; 206 inet->pmtudisc = IP_PMTUDISC_DONT;
207 else 207 else
208 inet->pmtudisc = IP_PMTUDISC_WANT; 208 inet->pmtudisc = IP_PMTUDISC_WANT;
209 /* 209 /*
210 * Increment only the relevant sk_prot->socks debug field, this changes 210 * Increment only the relevant sk_prot->socks debug field, this changes
211 * the previous behaviour of incrementing both the equivalent to 211 * the previous behaviour of incrementing both the equivalent to
212 * answer->prot->socks (inet6_sock_nr) and inet_sock_nr. 212 * answer->prot->socks (inet6_sock_nr) and inet_sock_nr.
@@ -293,7 +293,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
293 */ 293 */
294 sk->sk_bound_dev_if = addr->sin6_scope_id; 294 sk->sk_bound_dev_if = addr->sin6_scope_id;
295 } 295 }
296 296
297 /* Binding to link-local address requires an interface */ 297 /* Binding to link-local address requires an interface */
298 if (!sk->sk_bound_dev_if) { 298 if (!sk->sk_bound_dev_if) {
299 err = -EINVAL; 299 err = -EINVAL;
@@ -327,7 +327,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
327 inet->saddr = v4addr; 327 inet->saddr = v4addr;
328 328
329 ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); 329 ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr);
330 330
331 if (!(addr_type & IPV6_ADDR_MULTICAST)) 331 if (!(addr_type & IPV6_ADDR_MULTICAST))
332 ipv6_addr_copy(&np->saddr, &addr->sin6_addr); 332 ipv6_addr_copy(&np->saddr, &addr->sin6_addr);
333 333
@@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(inet6_destroy_sock);
393/* 393/*
394 * This does both peername and sockname. 394 * This does both peername and sockname.
395 */ 395 */
396 396
397int inet6_getname(struct socket *sock, struct sockaddr *uaddr, 397int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
398 int *uaddr_len, int peer) 398 int *uaddr_len, int peer)
399{ 399{
@@ -401,7 +401,7 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
401 struct sock *sk = sock->sk; 401 struct sock *sk = sock->sk;
402 struct inet_sock *inet = inet_sk(sk); 402 struct inet_sock *inet = inet_sk(sk);
403 struct ipv6_pinfo *np = inet6_sk(sk); 403 struct ipv6_pinfo *np = inet6_sk(sk);
404 404
405 sin->sin6_family = AF_INET6; 405 sin->sin6_family = AF_INET6;
406 sin->sin6_flowinfo = 0; 406 sin->sin6_flowinfo = 0;
407 sin->sin6_scope_id = 0; 407 sin->sin6_scope_id = 0;
@@ -433,14 +433,14 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
433{ 433{
434 struct sock *sk = sock->sk; 434 struct sock *sk = sock->sk;
435 435
436 switch(cmd) 436 switch(cmd)
437 { 437 {
438 case SIOCGSTAMP: 438 case SIOCGSTAMP:
439 return sock_get_timestamp(sk, (struct timeval __user *)arg); 439 return sock_get_timestamp(sk, (struct timeval __user *)arg);
440 440
441 case SIOCADDRT: 441 case SIOCADDRT:
442 case SIOCDELRT: 442 case SIOCDELRT:
443 443
444 return(ipv6_route_ioctl(cmd,(void __user *)arg)); 444 return(ipv6_route_ioctl(cmd,(void __user *)arg));
445 445
446 case SIOCSIFADDR: 446 case SIOCSIFADDR:
@@ -584,7 +584,7 @@ inet6_register_protosw(struct inet_protosw *p)
584 /* Add the new entry after the last permanent entry if any, so that 584 /* Add the new entry after the last permanent entry if any, so that
585 * the new entry does not override a permanent entry when matched with 585 * the new entry does not override a permanent entry when matched with
586 * a wild-card protocol. But it is allowed to override any existing 586 * a wild-card protocol. But it is allowed to override any existing
587 * non-permanent entry. This means that when we remove this entry, the 587 * non-permanent entry. This means that when we remove this entry, the
588 * system automatically returns to the old behavior. 588 * system automatically returns to the old behavior.
589 */ 589 */
590 list_add_rcu(&p->list, last_perm); 590 list_add_rcu(&p->list, last_perm);
@@ -749,7 +749,7 @@ err_icmp_mib:
749 snmp6_mib_free((void **)ipv6_statistics); 749 snmp6_mib_free((void **)ipv6_statistics);
750err_ip_mib: 750err_ip_mib:
751 return -ENOMEM; 751 return -ENOMEM;
752 752
753} 753}
754 754
755static void cleanup_ipv6_mibs(void) 755static void cleanup_ipv6_mibs(void)
@@ -763,7 +763,7 @@ static void cleanup_ipv6_mibs(void)
763static int __init inet6_init(void) 763static int __init inet6_init(void)
764{ 764{
765 struct sk_buff *dummy_skb; 765 struct sk_buff *dummy_skb;
766 struct list_head *r; 766 struct list_head *r;
767 int err; 767 int err;
768 768
769 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)); 769 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb));
@@ -814,7 +814,7 @@ static int __init inet6_init(void)
814 err = init_ipv6_mibs(); 814 err = init_ipv6_mibs();
815 if (err) 815 if (err)
816 goto out_unregister_sock; 816 goto out_unregister_sock;
817 817
818 /* 818 /*
819 * ipngwg API draft makes clear that the correct semantics 819 * ipngwg API draft makes clear that the correct semantics
820 * for TCP and UDP is to consider one TCP and UDP instance 820 * for TCP and UDP is to consider one TCP and UDP instance
@@ -933,11 +933,11 @@ static void __exit inet6_exit(void)
933#ifdef CONFIG_PROC_FS 933#ifdef CONFIG_PROC_FS
934 if6_proc_exit(); 934 if6_proc_exit();
935 ac6_proc_exit(); 935 ac6_proc_exit();
936 ipv6_misc_proc_exit(); 936 ipv6_misc_proc_exit();
937 udp6_proc_exit(); 937 udp6_proc_exit();
938 udplite6_proc_exit(); 938 udplite6_proc_exit();
939 tcp6_proc_exit(); 939 tcp6_proc_exit();
940 raw6_proc_exit(); 940 raw6_proc_exit();
941#endif 941#endif
942#ifdef CONFIG_IPV6_MIP6 942#ifdef CONFIG_IPV6_MIP6
943 mip6_fini(); 943 mip6_fini();
@@ -952,7 +952,7 @@ static void __exit inet6_exit(void)
952 ndisc_cleanup(); 952 ndisc_cleanup();
953 icmpv6_cleanup(); 953 icmpv6_cleanup();
954#ifdef CONFIG_SYSCTL 954#ifdef CONFIG_SYSCTL
955 ipv6_sysctl_unregister(); 955 ipv6_sysctl_unregister();
956#endif 956#endif
957 cleanup_ipv6_mibs(); 957 cleanup_ipv6_mibs();
958 proto_unregister(&rawv6_prot); 958 proto_unregister(&rawv6_prot);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 12c5a4dec09e..dc68b7269c3c 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -1,26 +1,26 @@
1/* 1/*
2 * Copyright (C)2002 USAGI/WIDE Project 2 * Copyright (C)2002 USAGI/WIDE Project
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * 17 *
18 * Authors 18 * Authors
19 * 19 *
20 * Mitsuru KANDA @USAGI : IPv6 Support 20 * Mitsuru KANDA @USAGI : IPv6 Support
21 * Kazunori MIYAZAWA @USAGI : 21 * Kazunori MIYAZAWA @USAGI :
22 * Kunihiro Ishiguro <kunihiro@ipinfusion.com> 22 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>
23 * 23 *
24 * This file is derived from net/ipv4/ah.c. 24 * This file is derived from net/ipv4/ah.c.
25 */ 25 */
26 26
@@ -54,7 +54,7 @@ static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
54 optlen = 1; 54 optlen = 1;
55 break; 55 break;
56 default: 56 default:
57 if (len < 2) 57 if (len < 2)
58 goto bad; 58 goto bad;
59 optlen = opt[off+1]+2; 59 optlen = opt[off+1]+2;
60 if (len < optlen) 60 if (len < optlen)
@@ -152,7 +152,7 @@ static void ipv6_rearrange_rthdr(struct ipv6hdr *iph, struct ipv6_rt_hdr *rthdr)
152 segments_left = rthdr->segments_left; 152 segments_left = rthdr->segments_left;
153 if (segments_left == 0) 153 if (segments_left == 0)
154 return; 154 return;
155 rthdr->segments_left = 0; 155 rthdr->segments_left = 0;
156 156
157 /* The value of rthdr->hdrlen has been verified either by the system 157 /* The value of rthdr->hdrlen has been verified either by the system
158 * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming 158 * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming
@@ -278,7 +278,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
278 top_iph->hop_limit = 0; 278 top_iph->hop_limit = 0;
279 279
280 ahp = x->data; 280 ahp = x->data;
281 ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + 281 ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) +
282 ahp->icv_trunc_len) >> 2) - 2; 282 ahp->icv_trunc_len) >> 2) - 2;
283 283
284 ah->reserved = 0; 284 ah->reserved = 0;
@@ -319,7 +319,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
319 * Moving the pointer of skb->nh.raw by using skb_pull as long as AH 319 * Moving the pointer of skb->nh.raw by using skb_pull as long as AH
320 * header length. Then copy back the copy as long as hdr_len 320 * header length. Then copy back the copy as long as hdr_len
321 * If destination header following AH exists, copy it into after [Ext2]. 321 * If destination header following AH exists, copy it into after [Ext2].
322 * 322 *
323 * |<>|[IPv6][Ext1][Ext2][Dest][Payload] 323 * |<>|[IPv6][Ext1][Ext2][Dest][Payload]
324 * There is offset of AH before IPv6 header after the process. 324 * There is offset of AH before IPv6 header after the process.
325 */ 325 */
@@ -347,9 +347,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
347 nexthdr = ah->nexthdr; 347 nexthdr = ah->nexthdr;
348 ah_hlen = (ah->hdrlen + 2) << 2; 348 ah_hlen = (ah->hdrlen + 2) << 2;
349 349
350 if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && 350 if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) &&
351 ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) 351 ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len))
352 goto out; 352 goto out;
353 353
354 if (!pskb_may_pull(skb, ah_hlen)) 354 if (!pskb_may_pull(skb, ah_hlen))
355 goto out; 355 goto out;
@@ -365,7 +365,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
365 skb->nh.ipv6h->flow_lbl[2] = 0; 365 skb->nh.ipv6h->flow_lbl[2] = 0;
366 skb->nh.ipv6h->hop_limit = 0; 366 skb->nh.ipv6h->hop_limit = 0;
367 367
368 { 368 {
369 u8 auth_data[MAX_AH_AUTH_LEN]; 369 u8 auth_data[MAX_AH_AUTH_LEN];
370 370
371 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); 371 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
@@ -395,8 +395,8 @@ out:
395 return err; 395 return err;
396} 396}
397 397
398static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 398static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
399 int type, int code, int offset, __be32 info) 399 int type, int code, int offset, __be32 info)
400{ 400{
401 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; 401 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
402 struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); 402 struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset);
@@ -445,7 +445,7 @@ static int ah6_init_state(struct xfrm_state *x)
445 ahp->tfm = tfm; 445 ahp->tfm = tfm;
446 if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) 446 if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len))
447 goto error; 447 goto error;
448 448
449 /* 449 /*
450 * Lookup the algorithm description maintained by xfrm_algo, 450 * Lookup the algorithm description maintained by xfrm_algo,
451 * verify crypto transform properties, and store information 451 * verify crypto transform properties, and store information
@@ -462,16 +462,16 @@ static int ah6_init_state(struct xfrm_state *x)
462 aalg_desc->uinfo.auth.icv_fullbits/8); 462 aalg_desc->uinfo.auth.icv_fullbits/8);
463 goto error; 463 goto error;
464 } 464 }
465 465
466 ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 466 ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
467 ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 467 ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
468 468
469 BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); 469 BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
470 470
471 ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); 471 ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL);
472 if (!ahp->work_icv) 472 if (!ahp->work_icv)
473 goto error; 473 goto error;
474 474
475 x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); 475 x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len);
476 if (x->props.mode == XFRM_MODE_TUNNEL) 476 if (x->props.mode == XFRM_MODE_TUNNEL)
477 x->props.header_len += sizeof(struct ipv6hdr); 477 x->props.header_len += sizeof(struct ipv6hdr);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index a9604764e015..e2dc1c41bbf5 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Anycast support for IPv6 2 * Anycast support for IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * David L Stevens (dlstevens@us.ibm.com) 6 * David L Stevens (dlstevens@us.ibm.com)
@@ -397,7 +397,7 @@ static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
397 in6_dev_put(idev); 397 in6_dev_put(idev);
398 return ret; 398 return ret;
399} 399}
400 400
401/* 401/*
402 * check if the interface has this anycast address 402 * check if the interface has this anycast address
403 */ 403 */
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index ecde30140f4a..5f54dec3e205 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * common UDP/RAW code 2 * common UDP/RAW code
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: datagram.c,v 1.24 2002/02/01 22:01:04 davem Exp $ 8 * $Id: datagram.c,v 1.24 2002/02/01 22:01:04 davem Exp $
9 * 9 *
@@ -55,10 +55,10 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
55 } 55 }
56 56
57 if (addr_len < SIN6_LEN_RFC2133) 57 if (addr_len < SIN6_LEN_RFC2133)
58 return -EINVAL; 58 return -EINVAL;
59 59
60 if (usin->sin6_family != AF_INET6) 60 if (usin->sin6_family != AF_INET6)
61 return -EAFNOSUPPORT; 61 return -EAFNOSUPPORT;
62 62
63 memset(&fl, 0, sizeof(fl)); 63 memset(&fl, 0, sizeof(fl));
64 if (np->sndflow) { 64 if (np->sndflow) {
@@ -93,14 +93,14 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
93 sin.sin_addr.s_addr = daddr->s6_addr32[3]; 93 sin.sin_addr.s_addr = daddr->s6_addr32[3];
94 sin.sin_port = usin->sin6_port; 94 sin.sin_port = usin->sin6_port;
95 95
96 err = ip4_datagram_connect(sk, 96 err = ip4_datagram_connect(sk,
97 (struct sockaddr*) &sin, 97 (struct sockaddr*) &sin,
98 sizeof(sin)); 98 sizeof(sin));
99 99
100ipv4_connected: 100ipv4_connected:
101 if (err) 101 if (err)
102 goto out; 102 goto out;
103 103
104 ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr); 104 ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr);
105 105
106 if (ipv6_addr_any(&np->saddr)) { 106 if (ipv6_addr_any(&np->saddr)) {
@@ -206,7 +206,7 @@ out:
206 return err; 206 return err;
207} 207}
208 208
209void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 209void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
210 __be16 port, u32 info, u8 *payload) 210 __be16 port, u32 info, u8 *payload)
211{ 211{
212 struct ipv6_pinfo *np = inet6_sk(sk); 212 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -223,7 +223,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
223 serr = SKB_EXT_ERR(skb); 223 serr = SKB_EXT_ERR(skb);
224 serr->ee.ee_errno = err; 224 serr->ee.ee_errno = err;
225 serr->ee.ee_origin = SO_EE_ORIGIN_ICMP6; 225 serr->ee.ee_origin = SO_EE_ORIGIN_ICMP6;
226 serr->ee.ee_type = icmph->icmp6_type; 226 serr->ee.ee_type = icmph->icmp6_type;
227 serr->ee.ee_code = icmph->icmp6_code; 227 serr->ee.ee_code = icmph->icmp6_code;
228 serr->ee.ee_pad = 0; 228 serr->ee.ee_pad = 0;
229 serr->ee.ee_info = info; 229 serr->ee.ee_info = info;
@@ -259,7 +259,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
259 serr = SKB_EXT_ERR(skb); 259 serr = SKB_EXT_ERR(skb);
260 serr->ee.ee_errno = err; 260 serr->ee.ee_errno = err;
261 serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL; 261 serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL;
262 serr->ee.ee_type = 0; 262 serr->ee.ee_type = 0;
263 serr->ee.ee_code = 0; 263 serr->ee.ee_code = 0;
264 serr->ee.ee_pad = 0; 264 serr->ee.ee_pad = 0;
265 serr->ee.ee_info = info; 265 serr->ee.ee_info = info;
@@ -274,7 +274,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
274 kfree_skb(skb); 274 kfree_skb(skb);
275} 275}
276 276
277/* 277/*
278 * Handle MSG_ERRQUEUE 278 * Handle MSG_ERRQUEUE
279 */ 279 */
280int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) 280int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
@@ -312,7 +312,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
312 if (sin) { 312 if (sin) {
313 sin->sin6_family = AF_INET6; 313 sin->sin6_family = AF_INET6;
314 sin->sin6_flowinfo = 0; 314 sin->sin6_flowinfo = 0;
315 sin->sin6_port = serr->port; 315 sin->sin6_port = serr->port;
316 sin->sin6_scope_id = 0; 316 sin->sin6_scope_id = 0;
317 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) { 317 if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
318 ipv6_addr_copy(&sin->sin6_addr, 318 ipv6_addr_copy(&sin->sin6_addr,
@@ -370,7 +370,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
370 spin_unlock_bh(&sk->sk_error_queue.lock); 370 spin_unlock_bh(&sk->sk_error_queue.lock);
371 } 371 }
372 372
373out_free_skb: 373out_free_skb:
374 kfree_skb(skb); 374 kfree_skb(skb);
375out: 375out:
376 return err; 376 return err;
@@ -419,7 +419,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
419 * report extension headers (except for HbH) 419 * report extension headers (except for HbH)
420 * in order. 420 * in order.
421 * 421 *
422 * Also note that IPV6_RECVRTHDRDSTOPTS is NOT 422 * Also note that IPV6_RECVRTHDRDSTOPTS is NOT
423 * (and WILL NOT be) defined because 423 * (and WILL NOT be) defined because
424 * IPV6_RECVDSTOPTS is more generic. --yoshfuji 424 * IPV6_RECVDSTOPTS is more generic. --yoshfuji
425 */ 425 */
@@ -512,15 +512,15 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
512 continue; 512 continue;
513 513
514 switch (cmsg->cmsg_type) { 514 switch (cmsg->cmsg_type) {
515 case IPV6_PKTINFO: 515 case IPV6_PKTINFO:
516 case IPV6_2292PKTINFO: 516 case IPV6_2292PKTINFO:
517 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) { 517 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) {
518 err = -EINVAL; 518 err = -EINVAL;
519 goto exit_f; 519 goto exit_f;
520 } 520 }
521 521
522 src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg); 522 src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
523 523
524 if (src_info->ipi6_ifindex) { 524 if (src_info->ipi6_ifindex) {
525 if (fl->oif && src_info->ipi6_ifindex != fl->oif) 525 if (fl->oif && src_info->ipi6_ifindex != fl->oif)
526 return -EINVAL; 526 return -EINVAL;
@@ -531,7 +531,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
531 531
532 if (addr_type == IPV6_ADDR_ANY) 532 if (addr_type == IPV6_ADDR_ANY)
533 break; 533 break;
534 534
535 if (addr_type & IPV6_ADDR_LINKLOCAL) { 535 if (addr_type & IPV6_ADDR_LINKLOCAL) {
536 if (!src_info->ipi6_ifindex) 536 if (!src_info->ipi6_ifindex)
537 return -EINVAL; 537 return -EINVAL;
@@ -554,7 +554,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
554 break; 554 break;
555 555
556 case IPV6_FLOWINFO: 556 case IPV6_FLOWINFO:
557 if (cmsg->cmsg_len < CMSG_LEN(4)) { 557 if (cmsg->cmsg_len < CMSG_LEN(4)) {
558 err = -EINVAL; 558 err = -EINVAL;
559 goto exit_f; 559 goto exit_f;
560 } 560 }
@@ -570,7 +570,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
570 570
571 case IPV6_2292HOPOPTS: 571 case IPV6_2292HOPOPTS:
572 case IPV6_HOPOPTS: 572 case IPV6_HOPOPTS:
573 if (opt->hopopt || cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { 573 if (opt->hopopt || cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) {
574 err = -EINVAL; 574 err = -EINVAL;
575 goto exit_f; 575 goto exit_f;
576 } 576 }
@@ -590,7 +590,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
590 break; 590 break;
591 591
592 case IPV6_2292DSTOPTS: 592 case IPV6_2292DSTOPTS:
593 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) { 593 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_opt_hdr))) {
594 err = -EINVAL; 594 err = -EINVAL;
595 goto exit_f; 595 goto exit_f;
596 } 596 }
@@ -641,7 +641,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
641 641
642 case IPV6_2292RTHDR: 642 case IPV6_2292RTHDR:
643 case IPV6_RTHDR: 643 case IPV6_RTHDR:
644 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_rt_hdr))) { 644 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct ipv6_rt_hdr))) {
645 err = -EINVAL; 645 err = -EINVAL;
646 goto exit_f; 646 goto exit_f;
647 } 647 }
@@ -661,7 +661,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
661 661
662 len = ((rthdr->hdrlen + 1) << 3); 662 len = ((rthdr->hdrlen + 1) << 3);
663 663
664 if (cmsg->cmsg_len < CMSG_LEN(len)) { 664 if (cmsg->cmsg_len < CMSG_LEN(len)) {
665 err = -EINVAL; 665 err = -EINVAL;
666 goto exit_f; 666 goto exit_f;
667 } 667 }
@@ -716,7 +716,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
716 } 716 }
717 default: 717 default:
718 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n", 718 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
719 cmsg->cmsg_type); 719 cmsg->cmsg_type);
720 err = -EINVAL; 720 err = -EINVAL;
721 break; 721 break;
722 }; 722 };
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 25dcf69cd807..363e63ffecca 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -1,26 +1,26 @@
1/* 1/*
2 * Copyright (C)2002 USAGI/WIDE Project 2 * Copyright (C)2002 USAGI/WIDE Project
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * 17 *
18 * Authors 18 * Authors
19 * 19 *
20 * Mitsuru KANDA @USAGI : IPv6 Support 20 * Mitsuru KANDA @USAGI : IPv6 Support
21 * Kazunori MIYAZAWA @USAGI : 21 * Kazunori MIYAZAWA @USAGI :
22 * Kunihiro Ishiguro <kunihiro@ipinfusion.com> 22 * Kunihiro Ishiguro <kunihiro@ipinfusion.com>
23 * 23 *
24 * This file is derived from net/ipv4/esp.c 24 * This file is derived from net/ipv4/esp.c
25 */ 25 */
26 26
@@ -166,7 +166,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
166 } 166 }
167 167
168 /* If integrity check is required, do this. */ 168 /* If integrity check is required, do this. */
169 if (esp->auth.icv_full_len) { 169 if (esp->auth.icv_full_len) {
170 u8 sum[alen]; 170 u8 sum[alen];
171 171
172 ret = esp_mac_digest(esp, skb, 0, skb->len - alen); 172 ret = esp_mac_digest(esp, skb, 0, skb->len - alen);
@@ -197,7 +197,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
197 if (esp->conf.ivlen) 197 if (esp->conf.ivlen)
198 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen); 198 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen);
199 199
200 { 200 {
201 u8 nexthdr[2]; 201 u8 nexthdr[2];
202 struct scatterlist *sg = &esp->sgbuf[0]; 202 struct scatterlist *sg = &esp->sgbuf[0];
203 u8 padlen; 203 u8 padlen;
@@ -225,7 +225,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
225 ret = -EINVAL; 225 ret = -EINVAL;
226 goto out; 226 goto out;
227 } 227 }
228 /* ... check padding bits here. Silly. :-) */ 228 /* ... check padding bits here. Silly. :-) */
229 229
230 pskb_trim(skb, skb->len - alen - padlen - 2); 230 pskb_trim(skb, skb->len - alen - padlen - 2);
231 ret = nexthdr[1]; 231 ret = nexthdr[1];
@@ -256,20 +256,20 @@ static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
256} 256}
257 257
258static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 258static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
259 int type, int code, int offset, __be32 info) 259 int type, int code, int offset, __be32 info)
260{ 260{
261 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; 261 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
262 struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset); 262 struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset);
263 struct xfrm_state *x; 263 struct xfrm_state *x;
264 264
265 if (type != ICMPV6_DEST_UNREACH && 265 if (type != ICMPV6_DEST_UNREACH &&
266 type != ICMPV6_PKT_TOOBIG) 266 type != ICMPV6_PKT_TOOBIG)
267 return; 267 return;
268 268
269 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); 269 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6);
270 if (!x) 270 if (!x)
271 return; 271 return;
272 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", 272 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n",
273 ntohl(esph->spi), NIP6(iph->daddr)); 273 ntohl(esph->spi), NIP6(iph->daddr));
274 xfrm_state_put(x); 274 xfrm_state_put(x);
275} 275}
@@ -326,10 +326,10 @@ static int esp6_init_state(struct xfrm_state *x)
326 esp->auth.tfm = hash; 326 esp->auth.tfm = hash;
327 if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len)) 327 if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len))
328 goto error; 328 goto error;
329 329
330 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); 330 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
331 BUG_ON(!aalg_desc); 331 BUG_ON(!aalg_desc);
332 332
333 if (aalg_desc->uinfo.auth.icv_fullbits/8 != 333 if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
334 crypto_hash_digestsize(hash)) { 334 crypto_hash_digestsize(hash)) {
335 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n", 335 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n",
@@ -338,10 +338,10 @@ static int esp6_init_state(struct xfrm_state *x)
338 aalg_desc->uinfo.auth.icv_fullbits/8); 338 aalg_desc->uinfo.auth.icv_fullbits/8);
339 goto error; 339 goto error;
340 } 340 }
341 341
342 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 342 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
343 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 343 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
344 344
345 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL); 345 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL);
346 if (!esp->auth.work_icv) 346 if (!esp->auth.work_icv)
347 goto error; 347 goto error;
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 0711f92d6a12..08313efc48c8 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -16,7 +16,7 @@
16 */ 16 */
17 17
18/* Changes: 18/* Changes:
19 * yoshfuji : ensure not to overrun while parsing 19 * yoshfuji : ensure not to overrun while parsing
20 * tlv options. 20 * tlv options.
21 * Mitsuru KANDA @USAGI and: Remove ipv6_parse_exthdrs(). 21 * Mitsuru KANDA @USAGI and: Remove ipv6_parse_exthdrs().
22 * YOSHIFUJI Hideaki @USAGI Register inbound extension header 22 * YOSHIFUJI Hideaki @USAGI Register inbound extension header
@@ -167,8 +167,8 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
167 goto bad; 167 goto bad;
168 for (curr=procs; curr->type >= 0; curr++) { 168 for (curr=procs; curr->type >= 0; curr++) {
169 if (curr->type == skb->nh.raw[off]) { 169 if (curr->type == skb->nh.raw[off]) {
170 /* type specific length/alignment 170 /* type specific length/alignment
171 checks will be performed in the 171 checks will be performed in the
172 func(). */ 172 func(). */
173 if (curr->func(skbp, off) == 0) 173 if (curr->func(skbp, off) == 0)
174 return 0; 174 return 0;
@@ -572,7 +572,7 @@ void __init ipv6_rthdr_init(void)
572 For now we need to test the engine, so that I created 572 For now we need to test the engine, so that I created
573 temporary (or permanent) backdoor. 573 temporary (or permanent) backdoor.
574 If listening socket set IPV6_RTHDR to 2, then we invert header. 574 If listening socket set IPV6_RTHDR to 2, then we invert header.
575 --ANK (980729) 575 --ANK (980729)
576 */ 576 */
577 577
578struct ipv6_txoptions * 578struct ipv6_txoptions *
@@ -635,7 +635,7 @@ static int ipv6_hop_ra(struct sk_buff **skbp, int optoff)
635 return 1; 635 return 1;
636 } 636 }
637 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n", 637 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n",
638 skb->nh.raw[optoff+1]); 638 skb->nh.raw[optoff+1]);
639 kfree_skb(skb); 639 kfree_skb(skb);
640 return 0; 640 return 0;
641} 641}
@@ -649,7 +649,7 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
649 649
650 if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) { 650 if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) {
651 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", 651 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
652 skb->nh.raw[optoff+1]); 652 skb->nh.raw[optoff+1]);
653 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 653 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
654 IPSTATS_MIB_INHDRERRORS); 654 IPSTATS_MIB_INHDRERRORS);
655 goto drop; 655 goto drop;
@@ -740,7 +740,7 @@ static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto,
740 int hops; 740 int hops;
741 741
742 ihdr = (struct rt0_hdr *) opt; 742 ihdr = (struct rt0_hdr *) opt;
743 743
744 phdr = (struct rt0_hdr *) skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3); 744 phdr = (struct rt0_hdr *) skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3);
745 memcpy(phdr, ihdr, sizeof(struct rt0_hdr)); 745 memcpy(phdr, ihdr, sizeof(struct rt0_hdr));
746 746
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 21cbbbddaf4d..e1caa5d526c2 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -4,13 +4,13 @@
4 */ 4 */
5#include <net/ipv6.h> 5#include <net/ipv6.h>
6 6
7/* 7/*
8 * find out if nexthdr is a well-known extension header or a protocol 8 * find out if nexthdr is a well-known extension header or a protocol
9 */ 9 */
10 10
11int ipv6_ext_hdr(u8 nexthdr) 11int ipv6_ext_hdr(u8 nexthdr)
12{ 12{
13 /* 13 /*
14 * find out if nexthdr is an extension header or a protocol 14 * find out if nexthdr is an extension header or a protocol
15 */ 15 */
16 return ( (nexthdr == NEXTHDR_HOP) || 16 return ( (nexthdr == NEXTHDR_HOP) ||
@@ -25,18 +25,18 @@ int ipv6_ext_hdr(u8 nexthdr)
25 * Skip any extension headers. This is used by the ICMP module. 25 * Skip any extension headers. This is used by the ICMP module.
26 * 26 *
27 * Note that strictly speaking this conflicts with RFC 2460 4.0: 27 * Note that strictly speaking this conflicts with RFC 2460 4.0:
28 * ...The contents and semantics of each extension header determine whether 28 * ...The contents and semantics of each extension header determine whether
29 * or not to proceed to the next header. Therefore, extension headers must 29 * or not to proceed to the next header. Therefore, extension headers must
30 * be processed strictly in the order they appear in the packet; a 30 * be processed strictly in the order they appear in the packet; a
31 * receiver must not, for example, scan through a packet looking for a 31 * receiver must not, for example, scan through a packet looking for a
32 * particular kind of extension header and process that header prior to 32 * particular kind of extension header and process that header prior to
33 * processing all preceding ones. 33 * processing all preceding ones.
34 * 34 *
35 * We do exactly this. This is a protocol bug. We can't decide after a 35 * We do exactly this. This is a protocol bug. We can't decide after a
36 * seeing an unknown discard-with-error flavour TLV option if it's a 36 * seeing an unknown discard-with-error flavour TLV option if it's a
37 * ICMP error message or not (errors should never be send in reply to 37 * ICMP error message or not (errors should never be send in reply to
38 * ICMP error messages). 38 * ICMP error messages).
39 * 39 *
40 * But I see no other way to do this. This might need to be reexamined 40 * But I see no other way to do this. This might need to be reexamined
41 * when Linux implements ESP (and maybe AUTH) headers. 41 * when Linux implements ESP (and maybe AUTH) headers.
42 * --AK 42 * --AK
@@ -90,9 +90,9 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp)
90 break; 90 break;
91 hdrlen = 8; 91 hdrlen = 8;
92 } else if (nexthdr == NEXTHDR_AUTH) 92 } else if (nexthdr == NEXTHDR_AUTH)
93 hdrlen = (hp->hdrlen+2)<<2; 93 hdrlen = (hp->hdrlen+2)<<2;
94 else 94 else
95 hdrlen = ipv6_optlen(hp); 95 hdrlen = ipv6_optlen(hp);
96 96
97 nexthdr = hp->nexthdr; 97 nexthdr = hp->nexthdr;
98 start += hdrlen; 98 start += hdrlen;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 3dcc4b7f41b4..9377fea02682 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -107,7 +107,7 @@ static __inline__ void icmpv6_xmit_unlock(void)
107 spin_unlock_bh(&icmpv6_socket->sk->sk_lock.slock); 107 spin_unlock_bh(&icmpv6_socket->sk->sk_lock.slock);
108} 108}
109 109
110/* 110/*
111 * Slightly more convenient version of icmpv6_send. 111 * Slightly more convenient version of icmpv6_send.
112 */ 112 */
113void icmpv6_param_prob(struct sk_buff *skb, int code, int pos) 113void icmpv6_param_prob(struct sk_buff *skb, int code, int pos)
@@ -153,8 +153,8 @@ static int is_ineligible(struct sk_buff *skb)
153 153
154static int sysctl_icmpv6_time __read_mostly = 1*HZ; 154static int sysctl_icmpv6_time __read_mostly = 1*HZ;
155 155
156/* 156/*
157 * Check the ICMP output rate limit 157 * Check the ICMP output rate limit
158 */ 158 */
159static inline int icmpv6_xrlim_allow(struct sock *sk, int type, 159static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
160 struct flowi *fl) 160 struct flowi *fl)
@@ -170,7 +170,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
170 if (type == ICMPV6_PKT_TOOBIG) 170 if (type == ICMPV6_PKT_TOOBIG)
171 return 1; 171 return 1;
172 172
173 /* 173 /*
174 * Look up the output route. 174 * Look up the output route.
175 * XXX: perhaps the expire for routing entries cloned by 175 * XXX: perhaps the expire for routing entries cloned by
176 * this lookup should be more aggressive (not longer than timeout). 176 * this lookup should be more aggressive (not longer than timeout).
@@ -198,7 +198,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
198/* 198/*
199 * an inline helper for the "simple" if statement below 199 * an inline helper for the "simple" if statement below
200 * checks if parameter problem report is caused by an 200 * checks if parameter problem report is caused by an
201 * unrecognized IPv6 option that has the Option Type 201 * unrecognized IPv6 option that has the Option Type
202 * highest-order two bits set to 10 202 * highest-order two bits set to 10
203 */ 203 */
204 204
@@ -298,7 +298,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
298/* 298/*
299 * Send an ICMP message in response to a packet in error 299 * Send an ICMP message in response to a packet in error
300 */ 300 */
301void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, 301void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
302 struct net_device *dev) 302 struct net_device *dev)
303{ 303{
304 struct inet6_dev *idev = NULL; 304 struct inet6_dev *idev = NULL;
@@ -320,7 +320,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
320 return; 320 return;
321 321
322 /* 322 /*
323 * Make sure we respect the rules 323 * Make sure we respect the rules
324 * i.e. RFC 1885 2.4(e) 324 * i.e. RFC 1885 2.4(e)
325 * Rule (e.1) is enforced by not using icmpv6_send 325 * Rule (e.1) is enforced by not using icmpv6_send
326 * in any code that processes icmp errors. 326 * in any code that processes icmp errors.
@@ -336,8 +336,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
336 336
337 if ((addr_type & IPV6_ADDR_MULTICAST || skb->pkt_type != PACKET_HOST)) { 337 if ((addr_type & IPV6_ADDR_MULTICAST || skb->pkt_type != PACKET_HOST)) {
338 if (type != ICMPV6_PKT_TOOBIG && 338 if (type != ICMPV6_PKT_TOOBIG &&
339 !(type == ICMPV6_PARAMPROB && 339 !(type == ICMPV6_PARAMPROB &&
340 code == ICMPV6_UNK_OPTION && 340 code == ICMPV6_UNK_OPTION &&
341 (opt_unrec(skb, info)))) 341 (opt_unrec(skb, info))))
342 return; 342 return;
343 343
@@ -364,7 +364,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
364 return; 364 return;
365 } 365 }
366 366
367 /* 367 /*
368 * Never answer to a ICMP packet. 368 * Never answer to a ICMP packet.
369 */ 369 */
370 if (is_ineligible(skb)) { 370 if (is_ineligible(skb)) {
@@ -543,14 +543,14 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
543 } 543 }
544 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr)); 544 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr));
545 545
546 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES); 546 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES);
547 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); 547 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
548 548
549out_put: 549out_put:
550 if (likely(idev != NULL)) 550 if (likely(idev != NULL))
551 in6_dev_put(idev); 551 in6_dev_put(idev);
552 dst_release(dst); 552 dst_release(dst);
553out: 553out:
554 icmpv6_xmit_unlock(); 554 icmpv6_xmit_unlock();
555} 555}
556 556
@@ -608,7 +608,7 @@ static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info)
608 } 608 }
609 read_unlock(&raw_v6_lock); 609 read_unlock(&raw_v6_lock);
610} 610}
611 611
612/* 612/*
613 * Handle icmp messages 613 * Handle icmp messages
614 */ 614 */
@@ -722,9 +722,9 @@ static int icmpv6_rcv(struct sk_buff **pskb)
722 if (type & ICMPV6_INFOMSG_MASK) 722 if (type & ICMPV6_INFOMSG_MASK)
723 break; 723 break;
724 724
725 /* 725 /*
726 * error of unknown type. 726 * error of unknown type.
727 * must pass to upper level 727 * must pass to upper level
728 */ 728 */
729 729
730 icmpv6_notify(skb, type, hdr->icmp6_code, hdr->icmp6_mtu); 730 icmpv6_notify(skb, type, hdr->icmp6_code, hdr->icmp6_mtu);
@@ -852,7 +852,7 @@ int icmpv6_err_convert(int type, int code, int *err)
852 case ICMPV6_PKT_TOOBIG: 852 case ICMPV6_PKT_TOOBIG:
853 *err = EMSGSIZE; 853 *err = EMSGSIZE;
854 break; 854 break;
855 855
856 case ICMPV6_PARAMPROB: 856 case ICMPV6_PARAMPROB:
857 *err = EPROTO; 857 *err = EPROTO;
858 fatal = 1; 858 fatal = 1;
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index e61116949bee..30b16da739c2 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -115,7 +115,7 @@ struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
115 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { 115 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) {
116 if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) { 116 if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) {
117 const struct ipv6_pinfo *np = inet6_sk(sk); 117 const struct ipv6_pinfo *np = inet6_sk(sk);
118 118
119 score = 1; 119 score = 1;
120 if (!ipv6_addr_any(&np->rcv_saddr)) { 120 if (!ipv6_addr_any(&np->rcv_saddr)) {
121 if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) 121 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
@@ -249,81 +249,81 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row,
249{ 249{
250 struct inet_hashinfo *hinfo = death_row->hashinfo; 250 struct inet_hashinfo *hinfo = death_row->hashinfo;
251 const unsigned short snum = inet_sk(sk)->num; 251 const unsigned short snum = inet_sk(sk)->num;
252 struct inet_bind_hashbucket *head; 252 struct inet_bind_hashbucket *head;
253 struct inet_bind_bucket *tb; 253 struct inet_bind_bucket *tb;
254 int ret; 254 int ret;
255 255
256 if (snum == 0) { 256 if (snum == 0) {
257 const int low = sysctl_local_port_range[0]; 257 const int low = sysctl_local_port_range[0];
258 const int high = sysctl_local_port_range[1]; 258 const int high = sysctl_local_port_range[1];
259 const int range = high - low; 259 const int range = high - low;
260 int i, port; 260 int i, port;
261 static u32 hint; 261 static u32 hint;
262 const u32 offset = hint + inet6_sk_port_offset(sk); 262 const u32 offset = hint + inet6_sk_port_offset(sk);
263 struct hlist_node *node; 263 struct hlist_node *node;
264 struct inet_timewait_sock *tw = NULL; 264 struct inet_timewait_sock *tw = NULL;
265 265
266 local_bh_disable(); 266 local_bh_disable();
267 for (i = 1; i <= range; i++) { 267 for (i = 1; i <= range; i++) {
268 port = low + (i + offset) % range; 268 port = low + (i + offset) % range;
269 head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; 269 head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
270 spin_lock(&head->lock); 270 spin_lock(&head->lock);
271 271
272 /* Does not bother with rcv_saddr checks, 272 /* Does not bother with rcv_saddr checks,
273 * because the established check is already 273 * because the established check is already
274 * unique enough. 274 * unique enough.
275 */ 275 */
276 inet_bind_bucket_for_each(tb, node, &head->chain) { 276 inet_bind_bucket_for_each(tb, node, &head->chain) {
277 if (tb->port == port) { 277 if (tb->port == port) {
278 BUG_TRAP(!hlist_empty(&tb->owners)); 278 BUG_TRAP(!hlist_empty(&tb->owners));
279 if (tb->fastreuse >= 0) 279 if (tb->fastreuse >= 0)
280 goto next_port; 280 goto next_port;
281 if (!__inet6_check_established(death_row, 281 if (!__inet6_check_established(death_row,
282 sk, port, 282 sk, port,
283 &tw)) 283 &tw))
284 goto ok; 284 goto ok;
285 goto next_port; 285 goto next_port;
286 } 286 }
287 } 287 }
288 288
289 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, 289 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep,
290 head, port); 290 head, port);
291 if (!tb) { 291 if (!tb) {
292 spin_unlock(&head->lock); 292 spin_unlock(&head->lock);
293 break; 293 break;
294 } 294 }
295 tb->fastreuse = -1; 295 tb->fastreuse = -1;
296 goto ok; 296 goto ok;
297 297
298 next_port: 298 next_port:
299 spin_unlock(&head->lock); 299 spin_unlock(&head->lock);
300 } 300 }
301 local_bh_enable(); 301 local_bh_enable();
302 302
303 return -EADDRNOTAVAIL; 303 return -EADDRNOTAVAIL;
304 304
305ok: 305ok:
306 hint += i; 306 hint += i;
307 307
308 /* Head lock still held and bh's disabled */ 308 /* Head lock still held and bh's disabled */
309 inet_bind_hash(sk, tb, port); 309 inet_bind_hash(sk, tb, port);
310 if (sk_unhashed(sk)) { 310 if (sk_unhashed(sk)) {
311 inet_sk(sk)->sport = htons(port); 311 inet_sk(sk)->sport = htons(port);
312 __inet6_hash(hinfo, sk); 312 __inet6_hash(hinfo, sk);
313 } 313 }
314 spin_unlock(&head->lock); 314 spin_unlock(&head->lock);
315 315
316 if (tw) { 316 if (tw) {
317 inet_twsk_deschedule(tw, death_row); 317 inet_twsk_deschedule(tw, death_row);
318 inet_twsk_put(tw); 318 inet_twsk_put(tw);
319 } 319 }
320 320
321 ret = 0; 321 ret = 0;
322 goto out; 322 goto out;
323 } 323 }
324 324
325 head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; 325 head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)];
326 tb = inet_csk(sk)->icsk_bind_hash; 326 tb = inet_csk(sk)->icsk_bind_hash;
327 spin_lock_bh(&head->lock); 327 spin_lock_bh(&head->lock);
328 328
329 if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { 329 if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) {
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 827f8842b578..f4d7be77eb0f 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Linux INET6 implementation 2 * Linux INET6 implementation
3 * Forwarding Information Database 3 * Forwarding Information Database
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: ip6_fib.c,v 1.25 2001/10/31 21:55:55 davem Exp $ 8 * $Id: ip6_fib.c,v 1.25 2001/10/31 21:55:55 davem Exp $
9 * 9 *
@@ -97,7 +97,7 @@ static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0);
97 97
98static struct fib6_walker_t fib6_walker_list = { 98static struct fib6_walker_t fib6_walker_list = {
99 .prev = &fib6_walker_list, 99 .prev = &fib6_walker_list,
100 .next = &fib6_walker_list, 100 .next = &fib6_walker_list,
101}; 101};
102 102
103#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next) 103#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next)
@@ -131,7 +131,7 @@ static __inline__ u32 fib6_new_sernum(void)
131/* 131/*
132 * Auxiliary address test functions for the radix tree. 132 * Auxiliary address test functions for the radix tree.
133 * 133 *
134 * These assume a 32bit processor (although it will work on 134 * These assume a 32bit processor (although it will work on
135 * 64bit processors) 135 * 64bit processors)
136 */ 136 */
137 137
@@ -297,7 +297,7 @@ static int fib6_dump_node(struct fib6_walker_t *w)
297 int res; 297 int res;
298 struct rt6_info *rt; 298 struct rt6_info *rt;
299 299
300 for (rt = w->leaf; rt; rt = rt->u.next) { 300 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
301 res = rt6_dump_route(rt, w->args); 301 res = rt6_dump_route(rt, w->args);
302 if (res < 0) { 302 if (res < 0) {
303 /* Frame is full, suspend walking */ 303 /* Frame is full, suspend walking */
@@ -433,7 +433,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr,
433 struct fib6_node *pn = NULL; 433 struct fib6_node *pn = NULL;
434 struct rt6key *key; 434 struct rt6key *key;
435 int bit; 435 int bit;
436 __be32 dir = 0; 436 __be32 dir = 0;
437 __u32 sernum = fib6_new_sernum(); 437 __u32 sernum = fib6_new_sernum();
438 438
439 RT6_TRACE("fib6_add_1\n"); 439 RT6_TRACE("fib6_add_1\n");
@@ -451,27 +451,27 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr,
451 if (plen < fn->fn_bit || 451 if (plen < fn->fn_bit ||
452 !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit)) 452 !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit))
453 goto insert_above; 453 goto insert_above;
454 454
455 /* 455 /*
456 * Exact match ? 456 * Exact match ?
457 */ 457 */
458 458
459 if (plen == fn->fn_bit) { 459 if (plen == fn->fn_bit) {
460 /* clean up an intermediate node */ 460 /* clean up an intermediate node */
461 if ((fn->fn_flags & RTN_RTINFO) == 0) { 461 if ((fn->fn_flags & RTN_RTINFO) == 0) {
462 rt6_release(fn->leaf); 462 rt6_release(fn->leaf);
463 fn->leaf = NULL; 463 fn->leaf = NULL;
464 } 464 }
465 465
466 fn->fn_sernum = sernum; 466 fn->fn_sernum = sernum;
467 467
468 return fn; 468 return fn;
469 } 469 }
470 470
471 /* 471 /*
472 * We have more bits to go 472 * We have more bits to go
473 */ 473 */
474 474
475 /* Try to walk down on tree. */ 475 /* Try to walk down on tree. */
476 fn->fn_sernum = sernum; 476 fn->fn_sernum = sernum;
477 dir = addr_bit_set(addr, fn->fn_bit); 477 dir = addr_bit_set(addr, fn->fn_bit);
@@ -489,7 +489,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr,
489 if (ln == NULL) 489 if (ln == NULL)
490 return NULL; 490 return NULL;
491 ln->fn_bit = plen; 491 ln->fn_bit = plen;
492 492
493 ln->parent = pn; 493 ln->parent = pn;
494 ln->fn_sernum = sernum; 494 ln->fn_sernum = sernum;
495 495
@@ -503,7 +503,7 @@ static struct fib6_node * fib6_add_1(struct fib6_node *root, void *addr,
503 503
504insert_above: 504insert_above:
505 /* 505 /*
506 * split since we don't have a common prefix anymore or 506 * split since we don't have a common prefix anymore or
507 * we have a less significant route. 507 * we have a less significant route.
508 * we've to insert an intermediate node on the list 508 * we've to insert an intermediate node on the list
509 * this new node will point to the one we need to create 509 * this new node will point to the one we need to create
@@ -517,18 +517,18 @@ insert_above:
517 See comment in __ipv6_addr_diff: bit may be an invalid value, 517 See comment in __ipv6_addr_diff: bit may be an invalid value,
518 but if it is >= plen, the value is ignored in any case. 518 but if it is >= plen, the value is ignored in any case.
519 */ 519 */
520 520
521 bit = __ipv6_addr_diff(addr, &key->addr, addrlen); 521 bit = __ipv6_addr_diff(addr, &key->addr, addrlen);
522 522
523 /* 523 /*
524 * (intermediate)[in] 524 * (intermediate)[in]
525 * / \ 525 * / \
526 * (new leaf node)[ln] (old node)[fn] 526 * (new leaf node)[ln] (old node)[fn]
527 */ 527 */
528 if (plen > bit) { 528 if (plen > bit) {
529 in = node_alloc(); 529 in = node_alloc();
530 ln = node_alloc(); 530 ln = node_alloc();
531 531
532 if (in == NULL || ln == NULL) { 532 if (in == NULL || ln == NULL) {
533 if (in) 533 if (in)
534 node_free(in); 534 node_free(in);
@@ -537,8 +537,8 @@ insert_above:
537 return NULL; 537 return NULL;
538 } 538 }
539 539
540 /* 540 /*
541 * new intermediate node. 541 * new intermediate node.
542 * RTN_RTINFO will 542 * RTN_RTINFO will
543 * be off since that an address that chooses one of 543 * be off since that an address that chooses one of
544 * the branches would not match less specific routes 544 * the branches would not match less specific routes
@@ -575,7 +575,7 @@ insert_above:
575 } 575 }
576 } else { /* plen <= bit */ 576 } else { /* plen <= bit */
577 577
578 /* 578 /*
579 * (new leaf node)[ln] 579 * (new leaf node)[ln]
580 * / \ 580 * / \
581 * (old node)[fn] NULL 581 * (old node)[fn] NULL
@@ -591,7 +591,7 @@ insert_above:
591 ln->parent = pn; 591 ln->parent = pn;
592 592
593 ln->fn_sernum = sernum; 593 ln->fn_sernum = sernum;
594 594
595 if (dir) 595 if (dir)
596 pn->right = ln; 596 pn->right = ln;
597 else 597 else
@@ -623,11 +623,11 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
623 fn->leaf == &ip6_null_entry && 623 fn->leaf == &ip6_null_entry &&
624 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){ 624 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){
625 fn->leaf = rt; 625 fn->leaf = rt;
626 rt->u.next = NULL; 626 rt->u.dst.rt6_next = NULL;
627 goto out; 627 goto out;
628 } 628 }
629 629
630 for (iter = fn->leaf; iter; iter=iter->u.next) { 630 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {
631 /* 631 /*
632 * Search for duplicates 632 * Search for duplicates
633 */ 633 */
@@ -655,7 +655,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
655 if (iter->rt6i_metric > rt->rt6i_metric) 655 if (iter->rt6i_metric > rt->rt6i_metric)
656 break; 656 break;
657 657
658 ins = &iter->u.next; 658 ins = &iter->u.dst.rt6_next;
659 } 659 }
660 660
661 /* 661 /*
@@ -663,7 +663,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
663 */ 663 */
664 664
665out: 665out:
666 rt->u.next = iter; 666 rt->u.dst.rt6_next = iter;
667 *ins = rt; 667 *ins = rt;
668 rt->rt6i_node = fn; 668 rt->rt6i_node = fn;
669 atomic_inc(&rt->rt6i_ref); 669 atomic_inc(&rt->rt6i_ref);
@@ -1104,7 +1104,7 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1104 RT6_TRACE("fib6_del_route\n"); 1104 RT6_TRACE("fib6_del_route\n");
1105 1105
1106 /* Unlink it */ 1106 /* Unlink it */
1107 *rtp = rt->u.next; 1107 *rtp = rt->u.dst.rt6_next;
1108 rt->rt6i_node = NULL; 1108 rt->rt6i_node = NULL;
1109 rt6_stats.fib_rt_entries--; 1109 rt6_stats.fib_rt_entries--;
1110 rt6_stats.fib_discarded_routes++; 1110 rt6_stats.fib_discarded_routes++;
@@ -1114,14 +1114,14 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1114 FOR_WALKERS(w) { 1114 FOR_WALKERS(w) {
1115 if (w->state == FWS_C && w->leaf == rt) { 1115 if (w->state == FWS_C && w->leaf == rt) {
1116 RT6_TRACE("walker %p adjusted by delroute\n", w); 1116 RT6_TRACE("walker %p adjusted by delroute\n", w);
1117 w->leaf = rt->u.next; 1117 w->leaf = rt->u.dst.rt6_next;
1118 if (w->leaf == NULL) 1118 if (w->leaf == NULL)
1119 w->state = FWS_U; 1119 w->state = FWS_U;
1120 } 1120 }
1121 } 1121 }
1122 read_unlock(&fib6_walker_lock); 1122 read_unlock(&fib6_walker_lock);
1123 1123
1124 rt->u.next = NULL; 1124 rt->u.dst.rt6_next = NULL;
1125 1125
1126 if (fn->leaf == NULL && fn->fn_flags&RTN_TL_ROOT) 1126 if (fn->leaf == NULL && fn->fn_flags&RTN_TL_ROOT)
1127 fn->leaf = &ip6_null_entry; 1127 fn->leaf = &ip6_null_entry;
@@ -1189,7 +1189,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
1189 * Walk the leaf entries looking for ourself 1189 * Walk the leaf entries looking for ourself
1190 */ 1190 */
1191 1191
1192 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.next) { 1192 for (rtp = &fn->leaf; *rtp; rtp = &(*rtp)->u.dst.rt6_next) {
1193 if (*rtp == rt) { 1193 if (*rtp == rt) {
1194 fib6_del_route(fn, rtp, info); 1194 fib6_del_route(fn, rtp, info);
1195 return 0; 1195 return 0;
@@ -1205,7 +1205,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
1205 * However, it is internally reenterable wrt itself and fib6_add/fib6_del. 1205 * However, it is internally reenterable wrt itself and fib6_add/fib6_del.
1206 * It means, that we can modify tree during walking 1206 * It means, that we can modify tree during walking
1207 * and use this function for garbage collection, clone pruning, 1207 * and use this function for garbage collection, clone pruning,
1208 * cleaning tree when a device goes down etc. etc. 1208 * cleaning tree when a device goes down etc. etc.
1209 * 1209 *
1210 * It guarantees that every node will be traversed, 1210 * It guarantees that every node will be traversed,
1211 * and that it will be traversed only once. 1211 * and that it will be traversed only once.
@@ -1244,7 +1244,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w)
1244 continue; 1244 continue;
1245 } 1245 }
1246 w->state = FWS_L; 1246 w->state = FWS_L;
1247#endif 1247#endif
1248 case FWS_L: 1248 case FWS_L:
1249 if (fn->left) { 1249 if (fn->left) {
1250 w->node = fn->left; 1250 w->node = fn->left;
@@ -1316,7 +1316,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1316 struct rt6_info *rt; 1316 struct rt6_info *rt;
1317 struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w; 1317 struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w;
1318 1318
1319 for (rt = w->leaf; rt; rt = rt->u.next) { 1319 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
1320 res = c->func(rt, c->arg); 1320 res = c->func(rt, c->arg);
1321 if (res < 0) { 1321 if (res < 0) {
1322 w->leaf = rt; 1322 w->leaf = rt;
@@ -1337,7 +1337,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1337 1337
1338/* 1338/*
1339 * Convenient frontend to tree walker. 1339 * Convenient frontend to tree walker.
1340 * 1340 *
1341 * func is called on each route. 1341 * func is called on each route.
1342 * It may return -1 -> delete this route. 1342 * It may return -1 -> delete this route.
1343 * 0 -> continue walking 1343 * 0 -> continue walking
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 624fae251f4e..1551ab3890a3 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -228,10 +228,10 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
228 struct ipv6_txoptions * fopt) 228 struct ipv6_txoptions * fopt)
229{ 229{
230 struct ipv6_txoptions * fl_opt = fl->opt; 230 struct ipv6_txoptions * fl_opt = fl->opt;
231 231
232 if (fopt == NULL || fopt->opt_flen == 0) 232 if (fopt == NULL || fopt->opt_flen == 0)
233 return fl_opt; 233 return fl_opt;
234 234
235 if (fl_opt != NULL) { 235 if (fl_opt != NULL) {
236 opt_space->hopopt = fl_opt->hopopt; 236 opt_space->hopopt = fl_opt->hopopt;
237 opt_space->dst0opt = fl_opt->dst0opt; 237 opt_space->dst0opt = fl_opt->dst0opt;
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index ad0b8abcdf4b..4fdded0e545a 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * IPv6 input 2 * IPv6 input
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
@@ -48,7 +48,7 @@
48 48
49 49
50 50
51inline int ip6_rcv_finish( struct sk_buff *skb) 51inline int ip6_rcv_finish( struct sk_buff *skb)
52{ 52{
53 if (skb->dst == NULL) 53 if (skb->dst == NULL)
54 ip6_route_input(skb); 54 ip6_route_input(skb);
@@ -173,9 +173,9 @@ resubmit:
173 hash = nexthdr & (MAX_INET_PROTOS - 1); 173 hash = nexthdr & (MAX_INET_PROTOS - 1);
174 if ((ipprot = rcu_dereference(inet6_protos[hash])) != NULL) { 174 if ((ipprot = rcu_dereference(inet6_protos[hash])) != NULL) {
175 int ret; 175 int ret;
176 176
177 if (ipprot->flags & INET6_PROTO_FINAL) { 177 if (ipprot->flags & INET6_PROTO_FINAL) {
178 struct ipv6hdr *hdr; 178 struct ipv6hdr *hdr;
179 179
180 /* Free reference early: we don't need it any more, 180 /* Free reference early: we don't need it any more,
181 and it may hold ip_conntrack module loaded 181 and it may hold ip_conntrack module loaded
@@ -192,9 +192,9 @@ resubmit:
192 goto discard; 192 goto discard;
193 } 193 }
194 if (!(ipprot->flags & INET6_PROTO_NOPOLICY) && 194 if (!(ipprot->flags & INET6_PROTO_NOPOLICY) &&
195 !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) 195 !xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
196 goto discard; 196 goto discard;
197 197
198 ret = ipprot->handler(&skb); 198 ret = ipprot->handler(&skb);
199 if (ret > 0) 199 if (ret > 0)
200 goto resubmit; 200 goto resubmit;
@@ -205,8 +205,8 @@ resubmit:
205 if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 205 if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
206 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INUNKNOWNPROTOS); 206 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INUNKNOWNPROTOS);
207 icmpv6_send(skb, ICMPV6_PARAMPROB, 207 icmpv6_send(skb, ICMPV6_PARAMPROB,
208 ICMPV6_UNK_NEXTHDR, nhoff, 208 ICMPV6_UNK_NEXTHDR, nhoff,
209 skb->dev); 209 skb->dev);
210 } 210 }
211 } else 211 } else
212 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS); 212 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INDELIVERS);
@@ -253,7 +253,7 @@ int ip6_mc_input(struct sk_buff *skb)
253 struct dst_entry *dst; 253 struct dst_entry *dst;
254 254
255 dst = skb->dst; 255 dst = skb->dst;
256 256
257 if (deliver) { 257 if (deliver) {
258 skb2 = skb_clone(skb, GFP_ATOMIC); 258 skb2 = skb_clone(skb, GFP_ATOMIC);
259 dst_output(skb2); 259 dst_output(skb2);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 7b7bd44fbf47..305516921aa8 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * IPv6 output functions 2 * IPv6 output functions
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: ip6_output.c,v 1.34 2002/02/01 22:01:04 davem Exp $ 8 * $Id: ip6_output.c,v 1.34 2002/02/01 22:01:04 davem Exp $
9 * 9 *
@@ -363,7 +363,7 @@ int ip6_forward(struct sk_buff *skb)
363 struct dst_entry *dst = skb->dst; 363 struct dst_entry *dst = skb->dst;
364 struct ipv6hdr *hdr = skb->nh.ipv6h; 364 struct ipv6hdr *hdr = skb->nh.ipv6h;
365 struct inet6_skb_parm *opt = IP6CB(skb); 365 struct inet6_skb_parm *opt = IP6CB(skb);
366 366
367 if (ipv6_devconf.forwarding == 0) 367 if (ipv6_devconf.forwarding == 0)
368 goto error; 368 goto error;
369 369
@@ -473,7 +473,7 @@ int ip6_forward(struct sk_buff *skb)
473 hdr = skb->nh.ipv6h; 473 hdr = skb->nh.ipv6h;
474 474
475 /* Mangling hops number delayed to point after skb COW */ 475 /* Mangling hops number delayed to point after skb COW */
476 476
477 hdr->hop_limit--; 477 hdr->hop_limit--;
478 478
479 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS); 479 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS);
@@ -659,7 +659,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
659 frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); 659 frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
660 ip6_copy_metadata(frag, skb); 660 ip6_copy_metadata(frag, skb);
661 } 661 }
662 662
663 err = output(skb); 663 err = output(skb);
664 if(!err) 664 if(!err)
665 IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES); 665 IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES);
@@ -792,7 +792,7 @@ slow_path:
792fail: 792fail:
793 IP6_INC_STATS(ip6_dst_idev(skb->dst), 793 IP6_INC_STATS(ip6_dst_idev(skb->dst),
794 IPSTATS_MIB_FRAGFAILS); 794 IPSTATS_MIB_FRAGFAILS);
795 kfree_skb(skb); 795 kfree_skb(skb);
796 return err; 796 return err;
797} 797}
798 798
@@ -955,7 +955,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
955 struct frag_hdr fhdr; 955 struct frag_hdr fhdr;
956 956
957 /* specify the length of each IP datagram fragment*/ 957 /* specify the length of each IP datagram fragment*/
958 skb_shinfo(skb)->gso_size = mtu - fragheaderlen - 958 skb_shinfo(skb)->gso_size = mtu - fragheaderlen -
959 sizeof(struct frag_hdr); 959 sizeof(struct frag_hdr);
960 skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 960 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
961 ipv6_select_ident(skb, &fhdr); 961 ipv6_select_ident(skb, &fhdr);
@@ -1058,13 +1058,13 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1058 * fragment alignment (= 8-15 octects, in total). 1058 * fragment alignment (= 8-15 octects, in total).
1059 * 1059 *
1060 * Note that we may need to "move" the data from the tail of 1060 * Note that we may need to "move" the data from the tail of
1061 * of the buffer to the new fragment when we split 1061 * of the buffer to the new fragment when we split
1062 * the message. 1062 * the message.
1063 * 1063 *
1064 * FIXME: It may be fragmented into multiple chunks 1064 * FIXME: It may be fragmented into multiple chunks
1065 * at once if non-fragmentable extension headers 1065 * at once if non-fragmentable extension headers
1066 * are too large. 1066 * are too large.
1067 * --yoshfuji 1067 * --yoshfuji
1068 */ 1068 */
1069 1069
1070 inet->cork.length += length; 1070 inet->cork.length += length;
@@ -1129,7 +1129,7 @@ alloc_new_skb:
1129 1129
1130 /* 1130 /*
1131 * We just reserve space for fragment header. 1131 * We just reserve space for fragment header.
1132 * Note: this may be overallocation if the message 1132 * Note: this may be overallocation if the message
1133 * (without MSG_MORE) fits into the MTU. 1133 * (without MSG_MORE) fits into the MTU.
1134 */ 1134 */
1135 alloclen += sizeof(struct frag_hdr); 1135 alloclen += sizeof(struct frag_hdr);
@@ -1310,7 +1310,7 @@ int ip6_push_pending_frames(struct sock *sk)
1310 ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst); 1310 ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst);
1311 1311
1312 skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr)); 1312 skb->nh.ipv6h = hdr = (struct ipv6hdr*) skb_push(skb, sizeof(struct ipv6hdr));
1313 1313
1314 *(__be32*)hdr = fl->fl6_flowlabel | 1314 *(__be32*)hdr = fl->fl6_flowlabel |
1315 htonl(0x60000000 | ((int)np->cork.tclass << 20)); 1315 htonl(0x60000000 | ((int)np->cork.tclass << 20));
1316 1316
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 2b9e3bb7da65..367b74832986 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -3,7 +3,7 @@
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Ville Nuorvala <vnuorval@tcs.hut.fi> 6 * Ville Nuorvala <vnuorval@tcs.hut.fi>
7 * 7 *
8 * $Id$ 8 * $Id$
9 * 9 *
@@ -67,8 +67,8 @@ MODULE_LICENSE("GPL");
67#define HASH_SIZE 32 67#define HASH_SIZE 32
68 68
69#define HASH(addr) ((__force u32)((addr)->s6_addr32[0] ^ (addr)->s6_addr32[1] ^ \ 69#define HASH(addr) ((__force u32)((addr)->s6_addr32[0] ^ (addr)->s6_addr32[1] ^ \
70 (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ 70 (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \
71 (HASH_SIZE - 1)) 71 (HASH_SIZE - 1))
72 72
73static int ip6ip6_fb_tnl_dev_init(struct net_device *dev); 73static int ip6ip6_fb_tnl_dev_init(struct net_device *dev);
74static int ip6ip6_tnl_dev_init(struct net_device *dev); 74static int ip6ip6_tnl_dev_init(struct net_device *dev);
@@ -90,7 +90,7 @@ static inline struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
90{ 90{
91 struct dst_entry *dst = t->dst_cache; 91 struct dst_entry *dst = t->dst_cache;
92 92
93 if (dst && dst->obsolete && 93 if (dst && dst->obsolete &&
94 dst->ops->check(dst, t->dst_cookie) == NULL) { 94 dst->ops->check(dst, t->dst_cookie) == NULL) {
95 t->dst_cache = NULL; 95 t->dst_cache = NULL;
96 dst_release(dst); 96 dst_release(dst);
@@ -116,12 +116,12 @@ static inline void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst)
116 116
117/** 117/**
118 * ip6ip6_tnl_lookup - fetch tunnel matching the end-point addresses 118 * ip6ip6_tnl_lookup - fetch tunnel matching the end-point addresses
119 * @remote: the address of the tunnel exit-point 119 * @remote: the address of the tunnel exit-point
120 * @local: the address of the tunnel entry-point 120 * @local: the address of the tunnel entry-point
121 * 121 *
122 * Return: 122 * Return:
123 * tunnel matching given end-points if found, 123 * tunnel matching given end-points if found,
124 * else fallback tunnel if its device is up, 124 * else fallback tunnel if its device is up,
125 * else %NULL 125 * else %NULL
126 **/ 126 **/
127 127
@@ -146,13 +146,13 @@ ip6ip6_tnl_lookup(struct in6_addr *remote, struct in6_addr *local)
146 146
147/** 147/**
148 * ip6ip6_bucket - get head of list matching given tunnel parameters 148 * ip6ip6_bucket - get head of list matching given tunnel parameters
149 * @p: parameters containing tunnel end-points 149 * @p: parameters containing tunnel end-points
150 * 150 *
151 * Description: 151 * Description:
152 * ip6ip6_bucket() returns the head of the list matching the 152 * ip6ip6_bucket() returns the head of the list matching the
153 * &struct in6_addr entries laddr and raddr in @p. 153 * &struct in6_addr entries laddr and raddr in @p.
154 * 154 *
155 * Return: head of IPv6 tunnel list 155 * Return: head of IPv6 tunnel list
156 **/ 156 **/
157 157
158static struct ip6_tnl ** 158static struct ip6_tnl **
@@ -213,8 +213,8 @@ ip6ip6_tnl_unlink(struct ip6_tnl *t)
213 * 213 *
214 * Description: 214 * Description:
215 * Create tunnel matching given parameters. 215 * Create tunnel matching given parameters.
216 * 216 *
217 * Return: 217 * Return:
218 * created tunnel or NULL 218 * created tunnel or NULL
219 **/ 219 **/
220 220
@@ -234,7 +234,7 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
234 if (__dev_get_by_name(name) == NULL) 234 if (__dev_get_by_name(name) == NULL)
235 break; 235 break;
236 } 236 }
237 if (i == IP6_TNL_MAX) 237 if (i == IP6_TNL_MAX)
238 goto failed; 238 goto failed;
239 } 239 }
240 dev = alloc_netdev(sizeof (*t), name, ip6ip6_tnl_dev_setup); 240 dev = alloc_netdev(sizeof (*t), name, ip6ip6_tnl_dev_setup);
@@ -258,7 +258,7 @@ failed:
258 258
259/** 259/**
260 * ip6ip6_tnl_locate - find or create tunnel matching given parameters 260 * ip6ip6_tnl_locate - find or create tunnel matching given parameters
261 * @p: tunnel parameters 261 * @p: tunnel parameters
262 * @create: != 0 if allowed to create new tunnel if no match found 262 * @create: != 0 if allowed to create new tunnel if no match found
263 * 263 *
264 * Description: 264 * Description:
@@ -289,7 +289,7 @@ static struct ip6_tnl *ip6ip6_tnl_locate(struct ip6_tnl_parm *p, int create)
289/** 289/**
290 * ip6ip6_tnl_dev_uninit - tunnel device uninitializer 290 * ip6ip6_tnl_dev_uninit - tunnel device uninitializer
291 * @dev: the device to be destroyed 291 * @dev: the device to be destroyed
292 * 292 *
293 * Description: 293 * Description:
294 * ip6ip6_tnl_dev_uninit() removes tunnel from its list 294 * ip6ip6_tnl_dev_uninit() removes tunnel from its list
295 **/ 295 **/
@@ -314,8 +314,8 @@ ip6ip6_tnl_dev_uninit(struct net_device *dev)
314 * parse_tvl_tnl_enc_lim - handle encapsulation limit option 314 * parse_tvl_tnl_enc_lim - handle encapsulation limit option
315 * @skb: received socket buffer 315 * @skb: received socket buffer
316 * 316 *
317 * Return: 317 * Return:
318 * 0 if none was found, 318 * 0 if none was found,
319 * else index to encapsulation limit 319 * else index to encapsulation limit
320 **/ 320 **/
321 321
@@ -392,8 +392,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
392 __u16 len; 392 __u16 len;
393 int err = -ENOENT; 393 int err = -ENOENT;
394 394
395 /* If the packet doesn't contain the original IPv6 header we are 395 /* If the packet doesn't contain the original IPv6 header we are
396 in trouble since we might need the source address for further 396 in trouble since we might need the source address for further
397 processing of the error. */ 397 processing of the error. */
398 398
399 read_lock(&ip6ip6_lock); 399 read_lock(&ip6ip6_lock);
@@ -418,7 +418,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
418 if (net_ratelimit()) 418 if (net_ratelimit())
419 printk(KERN_WARNING 419 printk(KERN_WARNING
420 "%s: Too small hop limit or " 420 "%s: Too small hop limit or "
421 "routing loop in tunnel!\n", 421 "routing loop in tunnel!\n",
422 t->parms.name); 422 t->parms.name);
423 rel_msg = 1; 423 rel_msg = 1;
424 } 424 }
@@ -502,7 +502,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
502 int ret = 0; 502 int ret = 0;
503 503
504 if (p->flags & IP6_TNL_F_CAP_RCV) { 504 if (p->flags & IP6_TNL_F_CAP_RCV) {
505 struct net_device *ldev = NULL; 505 struct net_device *ldev = NULL;
506 506
507 if (p->link) 507 if (p->link)
508 ldev = dev_get_by_index(p->link); 508 ldev = dev_get_by_index(p->link);
@@ -525,7 +525,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
525 * Return: 0 525 * Return: 0
526 **/ 526 **/
527 527
528static int 528static int
529ip6ip6_rcv(struct sk_buff *skb) 529ip6ip6_rcv(struct sk_buff *skb)
530{ 530{
531 struct ipv6hdr *ipv6h; 531 struct ipv6hdr *ipv6h;
@@ -595,13 +595,13 @@ static void init_tel_txopt(struct ipv6_tel_txoption *opt, __u8 encap_limit)
595/** 595/**
596 * ip6ip6_tnl_addr_conflict - compare packet addresses to tunnel's own 596 * ip6ip6_tnl_addr_conflict - compare packet addresses to tunnel's own
597 * @t: the outgoing tunnel device 597 * @t: the outgoing tunnel device
598 * @hdr: IPv6 header from the incoming packet 598 * @hdr: IPv6 header from the incoming packet
599 * 599 *
600 * Description: 600 * Description:
601 * Avoid trivial tunneling loop by checking that tunnel exit-point 601 * Avoid trivial tunneling loop by checking that tunnel exit-point
602 * doesn't match source of incoming packet. 602 * doesn't match source of incoming packet.
603 * 603 *
604 * Return: 604 * Return:
605 * 1 if conflict, 605 * 1 if conflict,
606 * 0 else 606 * 0 else
607 **/ 607 **/
@@ -617,7 +617,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
617 struct ip6_tnl_parm *p = &t->parms; 617 struct ip6_tnl_parm *p = &t->parms;
618 int ret = 0; 618 int ret = 0;
619 619
620 if (p->flags & IP6_TNL_F_CAP_XMIT) { 620 if (p->flags & IP6_TNL_F_CAP_XMIT) {
621 struct net_device *ldev = NULL; 621 struct net_device *ldev = NULL;
622 622
623 if (p->link) 623 if (p->link)
@@ -641,19 +641,19 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
641 return ret; 641 return ret;
642} 642}
643/** 643/**
644 * ip6ip6_tnl_xmit - encapsulate packet and send 644 * ip6ip6_tnl_xmit - encapsulate packet and send
645 * @skb: the outgoing socket buffer 645 * @skb: the outgoing socket buffer
646 * @dev: the outgoing tunnel device 646 * @dev: the outgoing tunnel device
647 * 647 *
648 * Description: 648 * Description:
649 * Build new header and do some sanity checks on the packet before sending 649 * Build new header and do some sanity checks on the packet before sending
650 * it. 650 * it.
651 * 651 *
652 * Return: 652 * Return:
653 * 0 653 * 0
654 **/ 654 **/
655 655
656static int 656static int
657ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) 657ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
658{ 658{
659 struct ip6_tnl *t = netdev_priv(dev); 659 struct ip6_tnl *t = netdev_priv(dev);
@@ -715,7 +715,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
715 if (tdev == dev) { 715 if (tdev == dev) {
716 stats->collisions++; 716 stats->collisions++;
717 if (net_ratelimit()) 717 if (net_ratelimit())
718 printk(KERN_WARNING 718 printk(KERN_WARNING
719 "%s: Local routing loop detected!\n", 719 "%s: Local routing loop detected!\n",
720 t->parms.name); 720 t->parms.name);
721 goto tx_err_dst_release; 721 goto tx_err_dst_release;
@@ -741,11 +741,11 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
741 * Okay, now see if we can stuff it in the buffer as-is. 741 * Okay, now see if we can stuff it in the buffer as-is.
742 */ 742 */
743 max_headroom += LL_RESERVED_SPACE(tdev); 743 max_headroom += LL_RESERVED_SPACE(tdev);
744 744
745 if (skb_headroom(skb) < max_headroom || 745 if (skb_headroom(skb) < max_headroom ||
746 skb_cloned(skb) || skb_shared(skb)) { 746 skb_cloned(skb) || skb_shared(skb)) {
747 struct sk_buff *new_skb; 747 struct sk_buff *new_skb;
748 748
749 if (!(new_skb = skb_realloc_headroom(skb, max_headroom))) 749 if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))
750 goto tx_err_dst_release; 750 goto tx_err_dst_release;
751 751
@@ -775,7 +775,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
775 ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst); 775 ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst);
776 nf_reset(skb); 776 nf_reset(skb);
777 pkt_len = skb->len; 777 pkt_len = skb->len;
778 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, 778 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL,
779 skb->dst->dev, dst_output); 779 skb->dst->dev, dst_output);
780 780
781 if (net_xmit_eval(err) == 0) { 781 if (net_xmit_eval(err) == 0) {
@@ -898,14 +898,14 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p)
898} 898}
899 899
900/** 900/**
901 * ip6ip6_tnl_ioctl - configure ipv6 tunnels from userspace 901 * ip6ip6_tnl_ioctl - configure ipv6 tunnels from userspace
902 * @dev: virtual device associated with tunnel 902 * @dev: virtual device associated with tunnel
903 * @ifr: parameters passed from userspace 903 * @ifr: parameters passed from userspace
904 * @cmd: command to be performed 904 * @cmd: command to be performed
905 * 905 *
906 * Description: 906 * Description:
907 * ip6ip6_tnl_ioctl() is used for managing IPv6 tunnels 907 * ip6ip6_tnl_ioctl() is used for managing IPv6 tunnels
908 * from userspace. 908 * from userspace.
909 * 909 *
910 * The possible commands are the following: 910 * The possible commands are the following:
911 * %SIOCGETTUNNEL: get tunnel parameters for device 911 * %SIOCGETTUNNEL: get tunnel parameters for device
@@ -913,7 +913,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p)
913 * %SIOCCHGTUNNEL: change tunnel parameters to those given 913 * %SIOCCHGTUNNEL: change tunnel parameters to those given
914 * %SIOCDELTUNNEL: delete tunnel 914 * %SIOCDELTUNNEL: delete tunnel
915 * 915 *
916 * The fallback device "ip6tnl0", created during module 916 * The fallback device "ip6tnl0", created during module
917 * initialization, can be used for creating other tunnel devices. 917 * initialization, can be used for creating other tunnel devices.
918 * 918 *
919 * Return: 919 * Return:
@@ -1009,7 +1009,7 @@ ip6ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1009} 1009}
1010 1010
1011/** 1011/**
1012 * ip6ip6_tnl_get_stats - return the stats for tunnel device 1012 * ip6ip6_tnl_get_stats - return the stats for tunnel device
1013 * @dev: virtual device associated with tunnel 1013 * @dev: virtual device associated with tunnel
1014 * 1014 *
1015 * Return: stats for device 1015 * Return: stats for device
@@ -1102,7 +1102,7 @@ ip6ip6_tnl_dev_init(struct net_device *dev)
1102 * Return: 0 1102 * Return: 0
1103 **/ 1103 **/
1104 1104
1105static int 1105static int
1106ip6ip6_fb_tnl_dev_init(struct net_device *dev) 1106ip6ip6_fb_tnl_dev_init(struct net_device *dev)
1107{ 1107{
1108 struct ip6_tnl *t = netdev_priv(dev); 1108 struct ip6_tnl *t = netdev_priv(dev);
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 511730b67e97..5724ba9f75de 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -9,25 +9,25 @@
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22/* 22/*
23 * [Memo] 23 * [Memo]
24 * 24 *
25 * Outbound: 25 * Outbound:
26 * The compression of IP datagram MUST be done before AH/ESP processing, 26 * The compression of IP datagram MUST be done before AH/ESP processing,
27 * fragmentation, and the addition of Hop-by-Hop/Routing header. 27 * fragmentation, and the addition of Hop-by-Hop/Routing header.
28 * 28 *
29 * Inbound: 29 * Inbound:
30 * The decompression of IP datagram MUST be done after the reassembly, 30 * The decompression of IP datagram MUST be done after the reassembly,
31 * AH/ESP processing. 31 * AH/ESP processing.
32 */ 32 */
33#include <linux/module.h> 33#include <linux/module.h>
@@ -176,7 +176,7 @@ out_ok:
176} 176}
177 177
178static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 178static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
179 int type, int code, int offset, __be32 info) 179 int type, int code, int offset, __be32 info)
180{ 180{
181 __be32 spi; 181 __be32 spi;
182 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; 182 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
@@ -422,7 +422,7 @@ static int ipcomp6_init_state(struct xfrm_state *x)
422 x->props.header_len = 0; 422 x->props.header_len = 0;
423 if (x->props.mode == XFRM_MODE_TUNNEL) 423 if (x->props.mode == XFRM_MODE_TUNNEL)
424 x->props.header_len += sizeof(struct ipv6hdr); 424 x->props.header_len += sizeof(struct ipv6hdr);
425 425
426 mutex_lock(&ipcomp6_resource_mutex); 426 mutex_lock(&ipcomp6_resource_mutex);
427 if (!ipcomp6_alloc_scratches()) 427 if (!ipcomp6_alloc_scratches())
428 goto error; 428 goto error;
@@ -455,7 +455,7 @@ error:
455 goto out; 455 goto out;
456} 456}
457 457
458static struct xfrm_type ipcomp6_type = 458static struct xfrm_type ipcomp6_type =
459{ 459{
460 .description = "IPCOMP6", 460 .description = "IPCOMP6",
461 .owner = THIS_MODULE, 461 .owner = THIS_MODULE,
@@ -467,7 +467,7 @@ static struct xfrm_type ipcomp6_type =
467 .hdr_offset = xfrm6_find_1stfragopt, 467 .hdr_offset = xfrm6_find_1stfragopt,
468}; 468};
469 469
470static struct inet6_protocol ipcomp6_protocol = 470static struct inet6_protocol ipcomp6_protocol =
471{ 471{
472 .handler = xfrm6_rcv, 472 .handler = xfrm6_rcv,
473 .err_handler = ipcomp6_err, 473 .err_handler = ipcomp6_err,
@@ -490,7 +490,7 @@ static int __init ipcomp6_init(void)
490 490
491static void __exit ipcomp6_fini(void) 491static void __exit ipcomp6_fini(void)
492{ 492{
493 if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0) 493 if (inet6_del_protocol(&ipcomp6_protocol, IPPROTO_COMP) < 0)
494 printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n"); 494 printk(KERN_INFO "ipv6 ipcomp close: can't remove protocol\n");
495 if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0) 495 if (xfrm_unregister_type(&ipcomp6_type, AF_INET6) < 0)
496 printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n"); 496 printk(KERN_INFO "ipv6 ipcomp close: can't remove xfrm type\n");
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 352690e2ab82..3f1e779ea5c5 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * IPv6 BSD socket options interface 2 * IPv6 BSD socket options interface
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * Based on linux/net/ipv4/ip_sockglue.c 8 * Based on linux/net/ipv4/ip_sockglue.c
9 * 9 *
@@ -164,7 +164,7 @@ out:
164} 164}
165 165
166static struct packet_type ipv6_packet_type = { 166static struct packet_type ipv6_packet_type = {
167 .type = __constant_htons(ETH_P_IPV6), 167 .type = __constant_htons(ETH_P_IPV6),
168 .func = ipv6_rcv, 168 .func = ipv6_rcv,
169 .gso_send_check = ipv6_gso_send_check, 169 .gso_send_check = ipv6_gso_send_check,
170 .gso_segment = ipv6_gso_segment, 170 .gso_segment = ipv6_gso_segment,
@@ -320,7 +320,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
320 np->rxopt.bits.rxinfo = valbool; 320 np->rxopt.bits.rxinfo = valbool;
321 retv = 0; 321 retv = 0;
322 break; 322 break;
323 323
324 case IPV6_2292PKTINFO: 324 case IPV6_2292PKTINFO:
325 np->rxopt.bits.rxoinfo = valbool; 325 np->rxopt.bits.rxoinfo = valbool;
326 retv = 0; 326 retv = 0;
@@ -376,7 +376,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
376 np->tclass = val; 376 np->tclass = val;
377 retv = 0; 377 retv = 0;
378 break; 378 break;
379 379
380 case IPV6_RECVTCLASS: 380 case IPV6_RECVTCLASS:
381 np->rxopt.bits.rxtclass = valbool; 381 np->rxopt.bits.rxtclass = valbool;
382 retv = 0; 382 retv = 0;
@@ -893,7 +893,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
893 case IPV6_MTU: 893 case IPV6_MTU:
894 { 894 {
895 struct dst_entry *dst; 895 struct dst_entry *dst;
896 val = 0; 896 val = 0;
897 lock_sock(sk); 897 lock_sock(sk);
898 dst = sk_dst_get(sk); 898 dst = sk_dst_get(sk);
899 if (dst) { 899 if (dst) {
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index e3ec21695832..c9db5bc5b0f9 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * Multicast support for IPv6 2 * Multicast support for IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: mcast.c,v 1.40 2002/02/08 03:57:19 davem Exp $ 8 * $Id: mcast.c,v 1.40 2002/02/08 03:57:19 davem Exp $
9 * 9 *
10 * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c 10 * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -644,7 +644,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
644 memset(&ss, 0, sizeof(ss)); 644 memset(&ss, 0, sizeof(ss));
645 psin6->sin6_family = AF_INET6; 645 psin6->sin6_family = AF_INET6;
646 psin6->sin6_addr = psl->sl_addr[i]; 646 psin6->sin6_addr = psl->sl_addr[i];
647 if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss))) 647 if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss)))
648 return -EFAULT; 648 return -EFAULT;
649 } 649 }
650 return 0; 650 return 0;
@@ -1168,7 +1168,7 @@ int igmp6_event_query(struct sk_buff *skb)
1168 1168
1169 /* compute payload length excluding extension headers */ 1169 /* compute payload length excluding extension headers */
1170 len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); 1170 len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
1171 len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; 1171 len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h;
1172 1172
1173 /* Drop queries with not link local source */ 1173 /* Drop queries with not link local source */
1174 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL)) 1174 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL))
@@ -1206,7 +1206,7 @@ int igmp6_event_query(struct sk_buff *skb)
1206 /* clear deleted report items */ 1206 /* clear deleted report items */
1207 mld_clear_delrec(idev); 1207 mld_clear_delrec(idev);
1208 } else if (len >= 28) { 1208 } else if (len >= 28) {
1209 int srcs_offset = sizeof(struct mld2_query) - 1209 int srcs_offset = sizeof(struct mld2_query) -
1210 sizeof(struct icmp6hdr); 1210 sizeof(struct icmp6hdr);
1211 if (!pskb_may_pull(skb, srcs_offset)) { 1211 if (!pskb_may_pull(skb, srcs_offset)) {
1212 in6_dev_put(idev); 1212 in6_dev_put(idev);
@@ -1230,7 +1230,7 @@ int igmp6_event_query(struct sk_buff *skb)
1230 } 1230 }
1231 /* mark sources to include, if group & source-specific */ 1231 /* mark sources to include, if group & source-specific */
1232 if (mlh2->nsrcs != 0) { 1232 if (mlh2->nsrcs != 0) {
1233 if (!pskb_may_pull(skb, srcs_offset + 1233 if (!pskb_may_pull(skb, srcs_offset +
1234 ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) { 1234 ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) {
1235 in6_dev_put(idev); 1235 in6_dev_put(idev);
1236 return -EINVAL; 1236 return -EINVAL;
@@ -1304,7 +1304,7 @@ int igmp6_event_report(struct sk_buff *skb)
1304 1304
1305 /* Drop reports with not link local source */ 1305 /* Drop reports with not link local source */
1306 addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr); 1306 addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr);
1307 if (addr_type != IPV6_ADDR_ANY && 1307 if (addr_type != IPV6_ADDR_ANY &&
1308 !(addr_type&IPV6_ADDR_LINKLOCAL)) 1308 !(addr_type&IPV6_ADDR_LINKLOCAL))
1309 return -EINVAL; 1309 return -EINVAL;
1310 1310
@@ -1413,7 +1413,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1413 1413
1414 if (ipv6_get_lladdr(dev, &addr_buf)) { 1414 if (ipv6_get_lladdr(dev, &addr_buf)) {
1415 /* <draft-ietf-magma-mld-source-05.txt>: 1415 /* <draft-ietf-magma-mld-source-05.txt>:
1416 * use unspecified address as the source address 1416 * use unspecified address as the source address
1417 * when a valid link-local address is not available. 1417 * when a valid link-local address is not available.
1418 */ 1418 */
1419 memset(&addr_buf, 0, sizeof(addr_buf)); 1419 memset(&addr_buf, 0, sizeof(addr_buf));
@@ -1454,7 +1454,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
1454static inline int mld_dev_queue_xmit(struct sk_buff *skb) 1454static inline int mld_dev_queue_xmit(struct sk_buff *skb)
1455{ 1455{
1456 return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev, 1456 return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev,
1457 mld_dev_queue_xmit2); 1457 mld_dev_queue_xmit2);
1458} 1458}
1459 1459
1460static void mld_sendpack(struct sk_buff *skb) 1460static void mld_sendpack(struct sk_buff *skb)
@@ -1754,8 +1754,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1754{ 1754{
1755 struct sock *sk = igmp6_socket->sk; 1755 struct sock *sk = igmp6_socket->sk;
1756 struct inet6_dev *idev; 1756 struct inet6_dev *idev;
1757 struct sk_buff *skb; 1757 struct sk_buff *skb;
1758 struct icmp6hdr *hdr; 1758 struct icmp6hdr *hdr;
1759 struct in6_addr *snd_addr; 1759 struct in6_addr *snd_addr;
1760 struct in6_addr *addrp; 1760 struct in6_addr *addrp;
1761 struct in6_addr addr_buf; 1761 struct in6_addr addr_buf;
@@ -1793,7 +1793,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1793 1793
1794 if (ipv6_get_lladdr(dev, &addr_buf)) { 1794 if (ipv6_get_lladdr(dev, &addr_buf)) {
1795 /* <draft-ietf-magma-mld-source-05.txt>: 1795 /* <draft-ietf-magma-mld-source-05.txt>:
1796 * use unspecified address as the source address 1796 * use unspecified address as the source address
1797 * when a valid link-local address is not available. 1797 * when a valid link-local address is not available.
1798 */ 1798 */
1799 memset(&addr_buf, 0, sizeof(addr_buf)); 1799 memset(&addr_buf, 0, sizeof(addr_buf));
@@ -2330,7 +2330,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq)
2330 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2330 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2331 2331
2332 for (state->dev = dev_base, state->idev = NULL; 2332 for (state->dev = dev_base, state->idev = NULL;
2333 state->dev; 2333 state->dev;
2334 state->dev = state->dev->next) { 2334 state->dev = state->dev->next) {
2335 struct inet6_dev *idev; 2335 struct inet6_dev *idev;
2336 idev = in6_dev_get(state->dev); 2336 idev = in6_dev_get(state->dev);
@@ -2413,7 +2413,7 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
2413 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2413 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2414 2414
2415 seq_printf(seq, 2415 seq_printf(seq,
2416 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", 2416 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n",
2417 state->dev->ifindex, state->dev->name, 2417 state->dev->ifindex, state->dev->name,
2418 NIP6(im->mca_addr), 2418 NIP6(im->mca_addr),
2419 im->mca_users, im->mca_flags, 2419 im->mca_users, im->mca_flags,
@@ -2474,7 +2474,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq)
2474 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2474 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2475 2475
2476 for (state->dev = dev_base, state->idev = NULL, state->im = NULL; 2476 for (state->dev = dev_base, state->idev = NULL, state->im = NULL;
2477 state->dev; 2477 state->dev;
2478 state->dev = state->dev->next) { 2478 state->dev = state->dev->next) {
2479 struct inet6_dev *idev; 2479 struct inet6_dev *idev;
2480 idev = in6_dev_get(state->dev); 2480 idev = in6_dev_get(state->dev);
@@ -2579,7 +2579,7 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
2579 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2579 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2580 2580
2581 if (v == SEQ_START_TOKEN) { 2581 if (v == SEQ_START_TOKEN) {
2582 seq_printf(seq, 2582 seq_printf(seq,
2583 "%3s %6s " 2583 "%3s %6s "
2584 "%32s %32s %6s %6s\n", "Idx", 2584 "%32s %32s %6s %6s\n", "Idx",
2585 "Device", "Multicast Address", 2585 "Device", "Multicast Address",
@@ -2608,7 +2608,7 @@ static int igmp6_mcf_seq_open(struct inode *inode, struct file *file)
2608 struct seq_file *seq; 2608 struct seq_file *seq;
2609 int rc = -ENOMEM; 2609 int rc = -ENOMEM;
2610 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); 2610 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2611 2611
2612 if (!s) 2612 if (!s)
2613 goto out; 2613 goto out;
2614 2614
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 681bb077eacc..0afcabdd8ed6 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -333,7 +333,7 @@ static struct xfrm_type mip6_destopt_type =
333 .destructor = mip6_destopt_destroy, 333 .destructor = mip6_destopt_destroy,
334 .input = mip6_destopt_input, 334 .input = mip6_destopt_input,
335 .output = mip6_destopt_output, 335 .output = mip6_destopt_output,
336 .reject = mip6_destopt_reject, 336 .reject = mip6_destopt_reject,
337 .hdr_offset = mip6_destopt_offset, 337 .hdr_offset = mip6_destopt_offset,
338 .local_addr = mip6_xfrm_addr, 338 .local_addr = mip6_xfrm_addr,
339}; 339};
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 39bb658f3c44..121f31c283f8 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Neighbour Discovery for IPv6 2 * Neighbour Discovery for IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * Mike Shaver <shaver@ingenia.com> 7 * Mike Shaver <shaver@ingenia.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -427,25 +427,25 @@ static inline void ndisc_flow_init(struct flowi *fl, u8 type,
427 427
428static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, 428static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
429 struct in6_addr *daddr, struct in6_addr *solicited_addr, 429 struct in6_addr *daddr, struct in6_addr *solicited_addr,
430 int router, int solicited, int override, int inc_opt) 430 int router, int solicited, int override, int inc_opt)
431{ 431{
432 struct in6_addr tmpaddr; 432 struct in6_addr tmpaddr;
433 struct inet6_ifaddr *ifp; 433 struct inet6_ifaddr *ifp;
434 struct inet6_dev *idev; 434 struct inet6_dev *idev;
435 struct flowi fl; 435 struct flowi fl;
436 struct dst_entry* dst; 436 struct dst_entry* dst;
437 struct sock *sk = ndisc_socket->sk; 437 struct sock *sk = ndisc_socket->sk;
438 struct in6_addr *src_addr; 438 struct in6_addr *src_addr;
439 struct nd_msg *msg; 439 struct nd_msg *msg;
440 int len; 440 int len;
441 struct sk_buff *skb; 441 struct sk_buff *skb;
442 int err; 442 int err;
443 443
444 len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); 444 len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
445 445
446 /* for anycast or proxy, solicited_addr != src_addr */ 446 /* for anycast or proxy, solicited_addr != src_addr */
447 ifp = ipv6_get_ifaddr(solicited_addr, dev, 1); 447 ifp = ipv6_get_ifaddr(solicited_addr, dev, 1);
448 if (ifp) { 448 if (ifp) {
449 src_addr = solicited_addr; 449 src_addr = solicited_addr;
450 in6_ifa_put(ifp); 450 in6_ifa_put(ifp);
451 } else { 451 } else {
@@ -479,7 +479,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
479 479
480 if (skb == NULL) { 480 if (skb == NULL) {
481 ND_PRINTK0(KERN_ERR 481 ND_PRINTK0(KERN_ERR
482 "ICMPv6 NA: %s() failed to allocate an skb.\n", 482 "ICMPv6 NA: %s() failed to allocate an skb.\n",
483 __FUNCTION__); 483 __FUNCTION__);
484 dst_release(dst); 484 dst_release(dst);
485 return; 485 return;
@@ -491,16 +491,16 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
491 msg = (struct nd_msg *)skb_put(skb, len); 491 msg = (struct nd_msg *)skb_put(skb, len);
492 skb->h.raw = (unsigned char*)msg; 492 skb->h.raw = (unsigned char*)msg;
493 493
494 msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; 494 msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT;
495 msg->icmph.icmp6_code = 0; 495 msg->icmph.icmp6_code = 0;
496 msg->icmph.icmp6_cksum = 0; 496 msg->icmph.icmp6_cksum = 0;
497 497
498 msg->icmph.icmp6_unused = 0; 498 msg->icmph.icmp6_unused = 0;
499 msg->icmph.icmp6_router = router; 499 msg->icmph.icmp6_router = router;
500 msg->icmph.icmp6_solicited = solicited; 500 msg->icmph.icmp6_solicited = solicited;
501 msg->icmph.icmp6_override = override; 501 msg->icmph.icmp6_override = override;
502 502
503 /* Set the target address. */ 503 /* Set the target address. */
504 ipv6_addr_copy(&msg->target, solicited_addr); 504 ipv6_addr_copy(&msg->target, solicited_addr);
505 505
506 if (inc_opt) 506 if (inc_opt)
@@ -508,9 +508,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
508 dev->addr_len, dev->type); 508 dev->addr_len, dev->type);
509 509
510 /* checksum */ 510 /* checksum */
511 msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, len, 511 msg->icmph.icmp6_cksum = csum_ipv6_magic(src_addr, daddr, len,
512 IPPROTO_ICMPV6, 512 IPPROTO_ICMPV6,
513 csum_partial((__u8 *) msg, 513 csum_partial((__u8 *) msg,
514 len, 0)); 514 len, 0));
515 515
516 skb->dst = dst; 516 skb->dst = dst;
@@ -524,20 +524,20 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
524 524
525 if (likely(idev != NULL)) 525 if (likely(idev != NULL))
526 in6_dev_put(idev); 526 in6_dev_put(idev);
527} 527}
528 528
529void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, 529void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
530 struct in6_addr *solicit, 530 struct in6_addr *solicit,
531 struct in6_addr *daddr, struct in6_addr *saddr) 531 struct in6_addr *daddr, struct in6_addr *saddr)
532{ 532{
533 struct flowi fl; 533 struct flowi fl;
534 struct dst_entry* dst; 534 struct dst_entry* dst;
535 struct inet6_dev *idev; 535 struct inet6_dev *idev;
536 struct sock *sk = ndisc_socket->sk; 536 struct sock *sk = ndisc_socket->sk;
537 struct sk_buff *skb; 537 struct sk_buff *skb;
538 struct nd_msg *msg; 538 struct nd_msg *msg;
539 struct in6_addr addr_buf; 539 struct in6_addr addr_buf;
540 int len; 540 int len;
541 int err; 541 int err;
542 int send_llinfo; 542 int send_llinfo;
543 543
@@ -569,7 +569,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
569 1, &err); 569 1, &err);
570 if (skb == NULL) { 570 if (skb == NULL) {
571 ND_PRINTK0(KERN_ERR 571 ND_PRINTK0(KERN_ERR
572 "ICMPv6 NA: %s() failed to allocate an skb.\n", 572 "ICMPv6 NA: %s() failed to allocate an skb.\n",
573 __FUNCTION__); 573 __FUNCTION__);
574 dst_release(dst); 574 dst_release(dst);
575 return; 575 return;
@@ -594,9 +594,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
594 594
595 /* checksum */ 595 /* checksum */
596 msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, 596 msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr,
597 daddr, len, 597 daddr, len,
598 IPPROTO_ICMPV6, 598 IPPROTO_ICMPV6,
599 csum_partial((__u8 *) msg, 599 csum_partial((__u8 *) msg,
600 len, 0)); 600 len, 0));
601 /* send it! */ 601 /* send it! */
602 skb->dst = dst; 602 skb->dst = dst;
@@ -619,10 +619,10 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
619 struct dst_entry* dst; 619 struct dst_entry* dst;
620 struct inet6_dev *idev; 620 struct inet6_dev *idev;
621 struct sock *sk = ndisc_socket->sk; 621 struct sock *sk = ndisc_socket->sk;
622 struct sk_buff *skb; 622 struct sk_buff *skb;
623 struct icmp6hdr *hdr; 623 struct icmp6hdr *hdr;
624 __u8 * opt; 624 __u8 * opt;
625 int len; 625 int len;
626 int err; 626 int err;
627 627
628 ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr, 628 ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr,
@@ -640,13 +640,13 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
640 if (dev->addr_len) 640 if (dev->addr_len)
641 len += ndisc_opt_addr_space(dev); 641 len += ndisc_opt_addr_space(dev);
642 642
643 skb = sock_alloc_send_skb(sk, 643 skb = sock_alloc_send_skb(sk,
644 (MAX_HEADER + sizeof(struct ipv6hdr) + 644 (MAX_HEADER + sizeof(struct ipv6hdr) +
645 len + LL_RESERVED_SPACE(dev)), 645 len + LL_RESERVED_SPACE(dev)),
646 1, &err); 646 1, &err);
647 if (skb == NULL) { 647 if (skb == NULL) {
648 ND_PRINTK0(KERN_ERR 648 ND_PRINTK0(KERN_ERR
649 "ICMPv6 RS: %s() failed to allocate an skb.\n", 649 "ICMPv6 RS: %s() failed to allocate an skb.\n",
650 __FUNCTION__); 650 __FUNCTION__);
651 dst_release(dst); 651 dst_release(dst);
652 return; 652 return;
@@ -655,12 +655,12 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
655 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 655 skb_reserve(skb, LL_RESERVED_SPACE(dev));
656 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); 656 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
657 657
658 hdr = (struct icmp6hdr *)skb_put(skb, len); 658 hdr = (struct icmp6hdr *)skb_put(skb, len);
659 skb->h.raw = (unsigned char*)hdr; 659 skb->h.raw = (unsigned char*)hdr;
660 hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; 660 hdr->icmp6_type = NDISC_ROUTER_SOLICITATION;
661 hdr->icmp6_code = 0; 661 hdr->icmp6_code = 0;
662 hdr->icmp6_cksum = 0; 662 hdr->icmp6_cksum = 0;
663 hdr->icmp6_unused = 0; 663 hdr->icmp6_unused = 0;
664 664
665 opt = (u8*) (hdr + 1); 665 opt = (u8*) (hdr + 1);
666 666
@@ -686,7 +686,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
686 if (likely(idev != NULL)) 686 if (likely(idev != NULL))
687 in6_dev_put(idev); 687 in6_dev_put(idev);
688} 688}
689 689
690 690
691static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) 691static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb)
692{ 692{
@@ -748,7 +748,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
748 int is_router; 748 int is_router;
749 749
750 if (ipv6_addr_is_multicast(&msg->target)) { 750 if (ipv6_addr_is_multicast(&msg->target)) {
751 ND_PRINTK2(KERN_WARNING 751 ND_PRINTK2(KERN_WARNING
752 "ICMPv6 NS: multicast target address"); 752 "ICMPv6 NS: multicast target address");
753 return; 753 return;
754 } 754 }
@@ -768,7 +768,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
768 } 768 }
769 769
770 if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) { 770 if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) {
771 ND_PRINTK2(KERN_WARNING 771 ND_PRINTK2(KERN_WARNING
772 "ICMPv6 NS: invalid ND options\n"); 772 "ICMPv6 NS: invalid ND options\n");
773 return; 773 return;
774 } 774 }
@@ -782,12 +782,12 @@ static void ndisc_recv_ns(struct sk_buff *skb)
782 } 782 }
783 783
784 /* RFC2461 7.1.1: 784 /* RFC2461 7.1.1:
785 * If the IP source address is the unspecified address, 785 * If the IP source address is the unspecified address,
786 * there MUST NOT be source link-layer address option 786 * there MUST NOT be source link-layer address option
787 * in the message. 787 * in the message.
788 */ 788 */
789 if (dad) { 789 if (dad) {
790 ND_PRINTK2(KERN_WARNING 790 ND_PRINTK2(KERN_WARNING
791 "ICMPv6 NS: bad DAD packet (link-layer address option)\n"); 791 "ICMPv6 NS: bad DAD packet (link-layer address option)\n");
792 return; 792 return;
793 } 793 }
@@ -816,7 +816,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
816 goto out; 816 goto out;
817 } 817 }
818 } 818 }
819 addrconf_dad_failure(ifp); 819 addrconf_dad_failure(ifp);
820 return; 820 return;
821 } 821 }
822 822
@@ -829,7 +829,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
829 } 829 }
830 830
831 if (ipv6_chk_acast_addr(dev, &msg->target) || 831 if (ipv6_chk_acast_addr(dev, &msg->target) ||
832 (idev->cnf.forwarding && 832 (idev->cnf.forwarding &&
833 (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && 833 (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) &&
834 (pneigh = pneigh_lookup(&nd_tbl, 834 (pneigh = pneigh_lookup(&nd_tbl,
835 &msg->target, dev, 0)) != NULL)) { 835 &msg->target, dev, 0)) != NULL)) {
@@ -839,8 +839,8 @@ static void ndisc_recv_ns(struct sk_buff *skb)
839 idev->nd_parms->proxy_delay != 0) { 839 idev->nd_parms->proxy_delay != 0) {
840 /* 840 /*
841 * for anycast or proxy, 841 * for anycast or proxy,
842 * sender should delay its response 842 * sender should delay its response
843 * by a random time between 0 and 843 * by a random time between 0 and
844 * MAX_ANYCAST_DELAY_TIME seconds. 844 * MAX_ANYCAST_DELAY_TIME seconds.
845 * (RFC2461) -- yoshfuji 845 * (RFC2461) -- yoshfuji
846 */ 846 */
@@ -869,14 +869,14 @@ static void ndisc_recv_ns(struct sk_buff *skb)
869 else 869 else
870 NEIGH_CACHE_STAT_INC(&nd_tbl, rcv_probes_ucast); 870 NEIGH_CACHE_STAT_INC(&nd_tbl, rcv_probes_ucast);
871 871
872 /* 872 /*
873 * update / create cache entry 873 * update / create cache entry
874 * for the source address 874 * for the source address
875 */ 875 */
876 neigh = __neigh_lookup(&nd_tbl, saddr, dev, 876 neigh = __neigh_lookup(&nd_tbl, saddr, dev,
877 !inc || lladdr || !dev->addr_len); 877 !inc || lladdr || !dev->addr_len);
878 if (neigh) 878 if (neigh)
879 neigh_update(neigh, lladdr, NUD_STALE, 879 neigh_update(neigh, lladdr, NUD_STALE,
880 NEIGH_UPDATE_F_WEAK_OVERRIDE| 880 NEIGH_UPDATE_F_WEAK_OVERRIDE|
881 NEIGH_UPDATE_F_OVERRIDE); 881 NEIGH_UPDATE_F_OVERRIDE);
882 if (neigh || !dev->hard_header) { 882 if (neigh || !dev->hard_header) {
@@ -926,7 +926,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
926 "ICMPv6 NA: solicited NA is multicasted.\n"); 926 "ICMPv6 NA: solicited NA is multicasted.\n");
927 return; 927 return;
928 } 928 }
929 929
930 if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) { 930 if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) {
931 ND_PRINTK2(KERN_WARNING 931 ND_PRINTK2(KERN_WARNING
932 "ICMPv6 NS: invalid ND option\n"); 932 "ICMPv6 NS: invalid ND option\n");
@@ -1057,7 +1057,7 @@ out:
1057 1057
1058static void ndisc_router_discovery(struct sk_buff *skb) 1058static void ndisc_router_discovery(struct sk_buff *skb)
1059{ 1059{
1060 struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw; 1060 struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw;
1061 struct neighbour *neigh = NULL; 1061 struct neighbour *neigh = NULL;
1062 struct inet6_dev *in6_dev; 1062 struct inet6_dev *in6_dev;
1063 struct rt6_info *rt = NULL; 1063 struct rt6_info *rt = NULL;
@@ -1076,7 +1076,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1076 return; 1076 return;
1077 } 1077 }
1078 if (optlen < 0) { 1078 if (optlen < 0) {
1079 ND_PRINTK2(KERN_WARNING 1079 ND_PRINTK2(KERN_WARNING
1080 "ICMPv6 RA: packet too short\n"); 1080 "ICMPv6 RA: packet too short\n");
1081 return; 1081 return;
1082 } 1082 }
@@ -1286,7 +1286,7 @@ skip_defrtr:
1286 rt6_mtu_change(skb->dev, mtu); 1286 rt6_mtu_change(skb->dev, mtu);
1287 } 1287 }
1288 } 1288 }
1289 1289
1290 if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) { 1290 if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
1291 ND_PRINTK2(KERN_WARNING 1291 ND_PRINTK2(KERN_WARNING
1292 "ICMPv6 RA: invalid RA options"); 1292 "ICMPv6 RA: invalid RA options");
@@ -1339,7 +1339,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1339 if (ipv6_addr_equal(dest, target)) { 1339 if (ipv6_addr_equal(dest, target)) {
1340 on_link = 1; 1340 on_link = 1;
1341 } else if (!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { 1341 } else if (!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
1342 ND_PRINTK2(KERN_WARNING 1342 ND_PRINTK2(KERN_WARNING
1343 "ICMPv6 Redirect: target address is not link-local.\n"); 1343 "ICMPv6 Redirect: target address is not link-local.\n");
1344 return; 1344 return;
1345 } 1345 }
@@ -1352,11 +1352,11 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1352 return; 1352 return;
1353 } 1353 }
1354 1354
1355 /* RFC2461 8.1: 1355 /* RFC2461 8.1:
1356 * The IP source address of the Redirect MUST be the same as the current 1356 * The IP source address of the Redirect MUST be the same as the current
1357 * first-hop router for the specified ICMP Destination Address. 1357 * first-hop router for the specified ICMP Destination Address.
1358 */ 1358 */
1359 1359
1360 if (!ndisc_parse_options((u8*)(dest + 1), optlen, &ndopts)) { 1360 if (!ndisc_parse_options((u8*)(dest + 1), optlen, &ndopts)) {
1361 ND_PRINTK2(KERN_WARNING 1361 ND_PRINTK2(KERN_WARNING
1362 "ICMPv6 Redirect: invalid ND options\n"); 1362 "ICMPv6 Redirect: invalid ND options\n");
@@ -1410,8 +1410,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1410 ND_PRINTK2(KERN_WARNING 1410 ND_PRINTK2(KERN_WARNING
1411 "ICMPv6 Redirect: no link-local address on %s\n", 1411 "ICMPv6 Redirect: no link-local address on %s\n",
1412 dev->name); 1412 dev->name);
1413 return; 1413 return;
1414 } 1414 }
1415 1415
1416 if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) && 1416 if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) &&
1417 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { 1417 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
@@ -1507,7 +1507,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1507 * build redirect option and copy skb over to the new packet. 1507 * build redirect option and copy skb over to the new packet.
1508 */ 1508 */
1509 1509
1510 memset(opt, 0, 8); 1510 memset(opt, 0, 8);
1511 *(opt++) = ND_OPT_REDIRECT_HDR; 1511 *(opt++) = ND_OPT_REDIRECT_HDR;
1512 *(opt++) = (rd_len >> 3); 1512 *(opt++) = (rd_len >> 3);
1513 opt += 6; 1513 opt += 6;
@@ -1556,7 +1556,7 @@ int ndisc_rcv(struct sk_buff *skb)
1556 } 1556 }
1557 1557
1558 if (msg->icmph.icmp6_code != 0) { 1558 if (msg->icmph.icmp6_code != 0) {
1559 ND_PRINTK2(KERN_WARNING 1559 ND_PRINTK2(KERN_WARNING
1560 "ICMPv6 NDISC: invalid ICMPv6 code: %d\n", 1560 "ICMPv6 NDISC: invalid ICMPv6 code: %d\n",
1561 msg->icmph.icmp6_code); 1561 msg->icmph.icmp6_code);
1562 return 0; 1562 return 0;
@@ -1717,12 +1717,12 @@ int __init ndisc_init(struct net_proto_family *ops)
1717{ 1717{
1718 struct ipv6_pinfo *np; 1718 struct ipv6_pinfo *np;
1719 struct sock *sk; 1719 struct sock *sk;
1720 int err; 1720 int err;
1721 1721
1722 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &ndisc_socket); 1722 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &ndisc_socket);
1723 if (err < 0) { 1723 if (err < 0) {
1724 ND_PRINTK0(KERN_ERR 1724 ND_PRINTK0(KERN_ERR
1725 "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n", 1725 "ICMPv6 NDISC: Failed to initialize the control socket (err %d).\n",
1726 err); 1726 err);
1727 ndisc_socket = NULL; /* For safety. */ 1727 ndisc_socket = NULL; /* For safety. */
1728 return err; 1728 return err;
@@ -1736,14 +1736,14 @@ int __init ndisc_init(struct net_proto_family *ops)
1736 np->mc_loop = 0; 1736 np->mc_loop = 0;
1737 sk->sk_prot->unhash(sk); 1737 sk->sk_prot->unhash(sk);
1738 1738
1739 /* 1739 /*
1740 * Initialize the neighbour table 1740 * Initialize the neighbour table
1741 */ 1741 */
1742 1742
1743 neigh_table_init(&nd_tbl); 1743 neigh_table_init(&nd_tbl);
1744 1744
1745#ifdef CONFIG_SYSCTL 1745#ifdef CONFIG_SYSCTL
1746 neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH, 1746 neigh_sysctl_register(NULL, &nd_tbl.parms, NET_IPV6, NET_IPV6_NEIGH,
1747 "ipv6", 1747 "ipv6",
1748 &ndisc_ifinfo_sysctl_change, 1748 &ndisc_ifinfo_sysctl_change,
1749 &ndisc_ifinfo_sysctl_strategy); 1749 &ndisc_ifinfo_sysctl_strategy);
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index f6294e5bcb31..0b2d265e7da7 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -91,7 +91,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
91 if (hook != NF_IP6_PRE_ROUTING && hook != NF_IP6_LOCAL_IN) 91 if (hook != NF_IP6_PRE_ROUTING && hook != NF_IP6_LOCAL_IN)
92 break; 92 break;
93 if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, 93 if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
94 skb->len - dataoff, protocol, 94 skb->len - dataoff, protocol,
95 csum_sub(skb->csum, 95 csum_sub(skb->csum,
96 skb_checksum(skb, 0, 96 skb_checksum(skb, 0,
97 dataoff, 0)))) { 97 dataoff, 0)))) {
@@ -106,7 +106,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
106 protocol, 106 protocol,
107 csum_sub(0, 107 csum_sub(0,
108 skb_checksum(skb, 0, 108 skb_checksum(skb, 0,
109 dataoff, 0)))); 109 dataoff, 0))));
110 csum = __skb_checksum_complete(skb); 110 csum = __skb_checksum_complete(skb);
111 } 111 }
112 return csum; 112 return csum;
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index d4d9f182441a..58847d3b61e5 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -95,7 +95,7 @@ __ipq_find_entry(ipq_cmpfn cmpfn, unsigned long data)
95 95
96 list_for_each_prev(p, &queue_list) { 96 list_for_each_prev(p, &queue_list) {
97 struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p; 97 struct ipq_queue_entry *entry = (struct ipq_queue_entry *)p;
98 98
99 if (!cmpfn || cmpfn(entry, data)) 99 if (!cmpfn || cmpfn(entry, data))
100 return entry; 100 return entry;
101 } 101 }
@@ -127,7 +127,7 @@ static inline void
127__ipq_flush(int verdict) 127__ipq_flush(int verdict)
128{ 128{
129 struct ipq_queue_entry *entry; 129 struct ipq_queue_entry *entry;
130 130
131 while ((entry = __ipq_find_dequeue_entry(NULL, 0))) 131 while ((entry = __ipq_find_dequeue_entry(NULL, 0)))
132 ipq_issue_verdict(entry, verdict); 132 ipq_issue_verdict(entry, verdict);
133} 133}
@@ -136,21 +136,21 @@ static inline int
136__ipq_set_mode(unsigned char mode, unsigned int range) 136__ipq_set_mode(unsigned char mode, unsigned int range)
137{ 137{
138 int status = 0; 138 int status = 0;
139 139
140 switch(mode) { 140 switch(mode) {
141 case IPQ_COPY_NONE: 141 case IPQ_COPY_NONE:
142 case IPQ_COPY_META: 142 case IPQ_COPY_META:
143 copy_mode = mode; 143 copy_mode = mode;
144 copy_range = 0; 144 copy_range = 0;
145 break; 145 break;
146 146
147 case IPQ_COPY_PACKET: 147 case IPQ_COPY_PACKET:
148 copy_mode = mode; 148 copy_mode = mode;
149 copy_range = range; 149 copy_range = range;
150 if (copy_range > 0xFFFF) 150 if (copy_range > 0xFFFF)
151 copy_range = 0xFFFF; 151 copy_range = 0xFFFF;
152 break; 152 break;
153 153
154 default: 154 default:
155 status = -EINVAL; 155 status = -EINVAL;
156 156
@@ -171,7 +171,7 @@ static struct ipq_queue_entry *
171ipq_find_dequeue_entry(ipq_cmpfn cmpfn, unsigned long data) 171ipq_find_dequeue_entry(ipq_cmpfn cmpfn, unsigned long data)
172{ 172{
173 struct ipq_queue_entry *entry; 173 struct ipq_queue_entry *entry;
174 174
175 write_lock_bh(&queue_lock); 175 write_lock_bh(&queue_lock);
176 entry = __ipq_find_dequeue_entry(cmpfn, data); 176 entry = __ipq_find_dequeue_entry(cmpfn, data);
177 write_unlock_bh(&queue_lock); 177 write_unlock_bh(&queue_lock);
@@ -197,14 +197,14 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
197 struct nlmsghdr *nlh; 197 struct nlmsghdr *nlh;
198 198
199 read_lock_bh(&queue_lock); 199 read_lock_bh(&queue_lock);
200 200
201 switch (copy_mode) { 201 switch (copy_mode) {
202 case IPQ_COPY_META: 202 case IPQ_COPY_META:
203 case IPQ_COPY_NONE: 203 case IPQ_COPY_NONE:
204 size = NLMSG_SPACE(sizeof(*pmsg)); 204 size = NLMSG_SPACE(sizeof(*pmsg));
205 data_len = 0; 205 data_len = 0;
206 break; 206 break;
207 207
208 case IPQ_COPY_PACKET: 208 case IPQ_COPY_PACKET:
209 if ((entry->skb->ip_summed == CHECKSUM_PARTIAL || 209 if ((entry->skb->ip_summed == CHECKSUM_PARTIAL ||
210 entry->skb->ip_summed == CHECKSUM_COMPLETE) && 210 entry->skb->ip_summed == CHECKSUM_COMPLETE) &&
@@ -216,10 +216,10 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
216 data_len = entry->skb->len; 216 data_len = entry->skb->len;
217 else 217 else
218 data_len = copy_range; 218 data_len = copy_range;
219 219
220 size = NLMSG_SPACE(sizeof(*pmsg) + data_len); 220 size = NLMSG_SPACE(sizeof(*pmsg) + data_len);
221 break; 221 break;
222 222
223 default: 223 default:
224 *errp = -EINVAL; 224 *errp = -EINVAL;
225 read_unlock_bh(&queue_lock); 225 read_unlock_bh(&queue_lock);
@@ -231,7 +231,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
231 skb = alloc_skb(size, GFP_ATOMIC); 231 skb = alloc_skb(size, GFP_ATOMIC);
232 if (!skb) 232 if (!skb)
233 goto nlmsg_failure; 233 goto nlmsg_failure;
234 234
235 old_tail= skb->tail; 235 old_tail= skb->tail;
236 nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); 236 nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
237 pmsg = NLMSG_DATA(nlh); 237 pmsg = NLMSG_DATA(nlh);
@@ -244,29 +244,29 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
244 pmsg->mark = entry->skb->mark; 244 pmsg->mark = entry->skb->mark;
245 pmsg->hook = entry->info->hook; 245 pmsg->hook = entry->info->hook;
246 pmsg->hw_protocol = entry->skb->protocol; 246 pmsg->hw_protocol = entry->skb->protocol;
247 247
248 if (entry->info->indev) 248 if (entry->info->indev)
249 strcpy(pmsg->indev_name, entry->info->indev->name); 249 strcpy(pmsg->indev_name, entry->info->indev->name);
250 else 250 else
251 pmsg->indev_name[0] = '\0'; 251 pmsg->indev_name[0] = '\0';
252 252
253 if (entry->info->outdev) 253 if (entry->info->outdev)
254 strcpy(pmsg->outdev_name, entry->info->outdev->name); 254 strcpy(pmsg->outdev_name, entry->info->outdev->name);
255 else 255 else
256 pmsg->outdev_name[0] = '\0'; 256 pmsg->outdev_name[0] = '\0';
257 257
258 if (entry->info->indev && entry->skb->dev) { 258 if (entry->info->indev && entry->skb->dev) {
259 pmsg->hw_type = entry->skb->dev->type; 259 pmsg->hw_type = entry->skb->dev->type;
260 if (entry->skb->dev->hard_header_parse) 260 if (entry->skb->dev->hard_header_parse)
261 pmsg->hw_addrlen = 261 pmsg->hw_addrlen =
262 entry->skb->dev->hard_header_parse(entry->skb, 262 entry->skb->dev->hard_header_parse(entry->skb,
263 pmsg->hw_addr); 263 pmsg->hw_addr);
264 } 264 }
265 265
266 if (data_len) 266 if (data_len)
267 if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len)) 267 if (skb_copy_bits(entry->skb, 0, pmsg->payload, data_len))
268 BUG(); 268 BUG();
269 269
270 nlh->nlmsg_len = skb->tail - old_tail; 270 nlh->nlmsg_len = skb->tail - old_tail;
271 return skb; 271 return skb;
272 272
@@ -279,7 +279,7 @@ nlmsg_failure:
279} 279}
280 280
281static int 281static int
282ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, 282ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info,
283 unsigned int queuenum, void *data) 283 unsigned int queuenum, void *data)
284{ 284{
285 int status = -EINVAL; 285 int status = -EINVAL;
@@ -301,37 +301,37 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info,
301 nskb = ipq_build_packet_message(entry, &status); 301 nskb = ipq_build_packet_message(entry, &status);
302 if (nskb == NULL) 302 if (nskb == NULL)
303 goto err_out_free; 303 goto err_out_free;
304 304
305 write_lock_bh(&queue_lock); 305 write_lock_bh(&queue_lock);
306 306
307 if (!peer_pid) 307 if (!peer_pid)
308 goto err_out_free_nskb; 308 goto err_out_free_nskb;
309 309
310 if (queue_total >= queue_maxlen) { 310 if (queue_total >= queue_maxlen) {
311 queue_dropped++; 311 queue_dropped++;
312 status = -ENOSPC; 312 status = -ENOSPC;
313 if (net_ratelimit()) 313 if (net_ratelimit())
314 printk (KERN_WARNING "ip6_queue: fill at %d entries, " 314 printk (KERN_WARNING "ip6_queue: fill at %d entries, "
315 "dropping packet(s). Dropped: %d\n", queue_total, 315 "dropping packet(s). Dropped: %d\n", queue_total,
316 queue_dropped); 316 queue_dropped);
317 goto err_out_free_nskb; 317 goto err_out_free_nskb;
318 } 318 }
319 319
320 /* netlink_unicast will either free the nskb or attach it to a socket */ 320 /* netlink_unicast will either free the nskb or attach it to a socket */
321 status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT); 321 status = netlink_unicast(ipqnl, nskb, peer_pid, MSG_DONTWAIT);
322 if (status < 0) { 322 if (status < 0) {
323 queue_user_dropped++; 323 queue_user_dropped++;
324 goto err_out_unlock; 324 goto err_out_unlock;
325 } 325 }
326 326
327 __ipq_enqueue_entry(entry); 327 __ipq_enqueue_entry(entry);
328 328
329 write_unlock_bh(&queue_lock); 329 write_unlock_bh(&queue_lock);
330 return status; 330 return status;
331 331
332err_out_free_nskb: 332err_out_free_nskb:
333 kfree_skb(nskb); 333 kfree_skb(nskb);
334 334
335err_out_unlock: 335err_out_unlock:
336 write_unlock_bh(&queue_lock); 336 write_unlock_bh(&queue_lock);
337 337
@@ -357,11 +357,11 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
357 return -EINVAL; 357 return -EINVAL;
358 if (diff > skb_tailroom(e->skb)) { 358 if (diff > skb_tailroom(e->skb)) {
359 struct sk_buff *newskb; 359 struct sk_buff *newskb;
360 360
361 newskb = skb_copy_expand(e->skb, 361 newskb = skb_copy_expand(e->skb,
362 skb_headroom(e->skb), 362 skb_headroom(e->skb),
363 diff, 363 diff,
364 GFP_ATOMIC); 364 GFP_ATOMIC);
365 if (newskb == NULL) { 365 if (newskb == NULL) {
366 printk(KERN_WARNING "ip6_queue: OOM " 366 printk(KERN_WARNING "ip6_queue: OOM "
367 "in mangle, dropping packet\n"); 367 "in mangle, dropping packet\n");
@@ -401,11 +401,11 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len)
401 return -ENOENT; 401 return -ENOENT;
402 else { 402 else {
403 int verdict = vmsg->value; 403 int verdict = vmsg->value;
404 404
405 if (vmsg->data_len && vmsg->data_len == len) 405 if (vmsg->data_len && vmsg->data_len == len)
406 if (ipq_mangle_ipv6(vmsg, entry) < 0) 406 if (ipq_mangle_ipv6(vmsg, entry) < 0)
407 verdict = NF_DROP; 407 verdict = NF_DROP;
408 408
409 ipq_issue_verdict(entry, verdict); 409 ipq_issue_verdict(entry, verdict);
410 return 0; 410 return 0;
411 } 411 }
@@ -424,7 +424,7 @@ ipq_set_mode(unsigned char mode, unsigned int range)
424 424
425static int 425static int
426ipq_receive_peer(struct ipq_peer_msg *pmsg, 426ipq_receive_peer(struct ipq_peer_msg *pmsg,
427 unsigned char type, unsigned int len) 427 unsigned char type, unsigned int len)
428{ 428{
429 int status = 0; 429 int status = 0;
430 430
@@ -434,15 +434,15 @@ ipq_receive_peer(struct ipq_peer_msg *pmsg,
434 switch (type) { 434 switch (type) {
435 case IPQM_MODE: 435 case IPQM_MODE:
436 status = ipq_set_mode(pmsg->msg.mode.value, 436 status = ipq_set_mode(pmsg->msg.mode.value,
437 pmsg->msg.mode.range); 437 pmsg->msg.mode.range);
438 break; 438 break;
439 439
440 case IPQM_VERDICT: 440 case IPQM_VERDICT:
441 if (pmsg->msg.verdict.value > NF_MAX_VERDICT) 441 if (pmsg->msg.verdict.value > NF_MAX_VERDICT)
442 status = -EINVAL; 442 status = -EINVAL;
443 else 443 else
444 status = ipq_set_verdict(&pmsg->msg.verdict, 444 status = ipq_set_verdict(&pmsg->msg.verdict,
445 len - sizeof(*pmsg)); 445 len - sizeof(*pmsg));
446 break; 446 break;
447 default: 447 default:
448 status = -EINVAL; 448 status = -EINVAL;
@@ -456,7 +456,7 @@ dev_cmp(struct ipq_queue_entry *entry, unsigned long ifindex)
456 if (entry->info->indev) 456 if (entry->info->indev)
457 if (entry->info->indev->ifindex == ifindex) 457 if (entry->info->indev->ifindex == ifindex)
458 return 1; 458 return 1;
459 459
460 if (entry->info->outdev) 460 if (entry->info->outdev)
461 if (entry->info->outdev->ifindex == ifindex) 461 if (entry->info->outdev->ifindex == ifindex)
462 return 1; 462 return 1;
@@ -468,7 +468,7 @@ static void
468ipq_dev_drop(int ifindex) 468ipq_dev_drop(int ifindex)
469{ 469{
470 struct ipq_queue_entry *entry; 470 struct ipq_queue_entry *entry;
471 471
472 while ((entry = ipq_find_dequeue_entry(dev_cmp, ifindex)) != NULL) 472 while ((entry = ipq_find_dequeue_entry(dev_cmp, ifindex)) != NULL)
473 ipq_issue_verdict(entry, NF_DROP); 473 ipq_issue_verdict(entry, NF_DROP);
474} 474}
@@ -492,25 +492,25 @@ ipq_rcv_skb(struct sk_buff *skb)
492 492
493 pid = nlh->nlmsg_pid; 493 pid = nlh->nlmsg_pid;
494 flags = nlh->nlmsg_flags; 494 flags = nlh->nlmsg_flags;
495 495
496 if(pid <= 0 || !(flags & NLM_F_REQUEST) || flags & NLM_F_MULTI) 496 if(pid <= 0 || !(flags & NLM_F_REQUEST) || flags & NLM_F_MULTI)
497 RCV_SKB_FAIL(-EINVAL); 497 RCV_SKB_FAIL(-EINVAL);
498 498
499 if (flags & MSG_TRUNC) 499 if (flags & MSG_TRUNC)
500 RCV_SKB_FAIL(-ECOMM); 500 RCV_SKB_FAIL(-ECOMM);
501 501
502 type = nlh->nlmsg_type; 502 type = nlh->nlmsg_type;
503 if (type < NLMSG_NOOP || type >= IPQM_MAX) 503 if (type < NLMSG_NOOP || type >= IPQM_MAX)
504 RCV_SKB_FAIL(-EINVAL); 504 RCV_SKB_FAIL(-EINVAL);
505 505
506 if (type <= IPQM_BASE) 506 if (type <= IPQM_BASE)
507 return; 507 return;
508 508
509 if (security_netlink_recv(skb, CAP_NET_ADMIN)) 509 if (security_netlink_recv(skb, CAP_NET_ADMIN))
510 RCV_SKB_FAIL(-EPERM); 510 RCV_SKB_FAIL(-EPERM);
511 511
512 write_lock_bh(&queue_lock); 512 write_lock_bh(&queue_lock);
513 513
514 if (peer_pid) { 514 if (peer_pid) {
515 if (peer_pid != pid) { 515 if (peer_pid != pid) {
516 write_unlock_bh(&queue_lock); 516 write_unlock_bh(&queue_lock);
@@ -520,17 +520,17 @@ ipq_rcv_skb(struct sk_buff *skb)
520 net_enable_timestamp(); 520 net_enable_timestamp();
521 peer_pid = pid; 521 peer_pid = pid;
522 } 522 }
523 523
524 write_unlock_bh(&queue_lock); 524 write_unlock_bh(&queue_lock);
525 525
526 status = ipq_receive_peer(NLMSG_DATA(nlh), type, 526 status = ipq_receive_peer(NLMSG_DATA(nlh), type,
527 nlmsglen - NLMSG_LENGTH(0)); 527 nlmsglen - NLMSG_LENGTH(0));
528 if (status < 0) 528 if (status < 0)
529 RCV_SKB_FAIL(status); 529 RCV_SKB_FAIL(status);
530 530
531 if (flags & NLM_F_ACK) 531 if (flags & NLM_F_ACK)
532 netlink_ack(skb, nlh, 0); 532 netlink_ack(skb, nlh, 0);
533 return; 533 return;
534} 534}
535 535
536static void 536static void
@@ -540,19 +540,19 @@ ipq_rcv_sk(struct sock *sk, int len)
540 unsigned int qlen; 540 unsigned int qlen;
541 541
542 mutex_lock(&ipqnl_mutex); 542 mutex_lock(&ipqnl_mutex);
543 543
544 for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { 544 for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) {
545 skb = skb_dequeue(&sk->sk_receive_queue); 545 skb = skb_dequeue(&sk->sk_receive_queue);
546 ipq_rcv_skb(skb); 546 ipq_rcv_skb(skb);
547 kfree_skb(skb); 547 kfree_skb(skb);
548 } 548 }
549 549
550 mutex_unlock(&ipqnl_mutex); 550 mutex_unlock(&ipqnl_mutex);
551} 551}
552 552
553static int 553static int
554ipq_rcv_dev_event(struct notifier_block *this, 554ipq_rcv_dev_event(struct notifier_block *this,
555 unsigned long event, void *ptr) 555 unsigned long event, void *ptr)
556{ 556{
557 struct net_device *dev = ptr; 557 struct net_device *dev = ptr;
558 558
@@ -568,7 +568,7 @@ static struct notifier_block ipq_dev_notifier = {
568 568
569static int 569static int
570ipq_rcv_nl_event(struct notifier_block *this, 570ipq_rcv_nl_event(struct notifier_block *this,
571 unsigned long event, void *ptr) 571 unsigned long event, void *ptr)
572{ 572{
573 struct netlink_notify *n = ptr; 573 struct netlink_notify *n = ptr;
574 574
@@ -597,7 +597,7 @@ static ctl_table ipq_table[] = {
597 .mode = 0644, 597 .mode = 0644,
598 .proc_handler = proc_dointvec 598 .proc_handler = proc_dointvec
599 }, 599 },
600 { .ctl_name = 0 } 600 { .ctl_name = 0 }
601}; 601};
602 602
603static ctl_table ipq_dir_table[] = { 603static ctl_table ipq_dir_table[] = {
@@ -627,25 +627,25 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length)
627 int len; 627 int len;
628 628
629 read_lock_bh(&queue_lock); 629 read_lock_bh(&queue_lock);
630 630
631 len = sprintf(buffer, 631 len = sprintf(buffer,
632 "Peer PID : %d\n" 632 "Peer PID : %d\n"
633 "Copy mode : %hu\n" 633 "Copy mode : %hu\n"
634 "Copy range : %u\n" 634 "Copy range : %u\n"
635 "Queue length : %u\n" 635 "Queue length : %u\n"
636 "Queue max. length : %u\n" 636 "Queue max. length : %u\n"
637 "Queue dropped : %u\n" 637 "Queue dropped : %u\n"
638 "Netfilter dropped : %u\n", 638 "Netfilter dropped : %u\n",
639 peer_pid, 639 peer_pid,
640 copy_mode, 640 copy_mode,
641 copy_range, 641 copy_range,
642 queue_total, 642 queue_total,
643 queue_maxlen, 643 queue_maxlen,
644 queue_dropped, 644 queue_dropped,
645 queue_user_dropped); 645 queue_user_dropped);
646 646
647 read_unlock_bh(&queue_lock); 647 read_unlock_bh(&queue_lock);
648 648
649 *start = buffer + offset; 649 *start = buffer + offset;
650 len -= offset; 650 len -= offset;
651 if (len > length) 651 if (len > length)
@@ -665,10 +665,10 @@ static int __init ip6_queue_init(void)
665{ 665{
666 int status = -ENOMEM; 666 int status = -ENOMEM;
667 struct proc_dir_entry *proc; 667 struct proc_dir_entry *proc;
668 668
669 netlink_register_notifier(&ipq_nl_notifier); 669 netlink_register_notifier(&ipq_nl_notifier);
670 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk, 670 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk,
671 THIS_MODULE); 671 THIS_MODULE);
672 if (ipqnl == NULL) { 672 if (ipqnl == NULL) {
673 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n"); 673 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n");
674 goto cleanup_netlink_notifier; 674 goto cleanup_netlink_notifier;
@@ -681,10 +681,10 @@ static int __init ip6_queue_init(void)
681 printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); 681 printk(KERN_ERR "ip6_queue: failed to create proc entry\n");
682 goto cleanup_ipqnl; 682 goto cleanup_ipqnl;
683 } 683 }
684 684
685 register_netdevice_notifier(&ipq_dev_notifier); 685 register_netdevice_notifier(&ipq_dev_notifier);
686 ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0); 686 ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0);
687 687
688 status = nf_register_queue_handler(PF_INET6, &nfqh); 688 status = nf_register_queue_handler(PF_INET6, &nfqh);
689 if (status < 0) { 689 if (status < 0) {
690 printk(KERN_ERR "ip6_queue: failed to register queue handler\n"); 690 printk(KERN_ERR "ip6_queue: failed to register queue handler\n");
@@ -696,12 +696,12 @@ cleanup_sysctl:
696 unregister_sysctl_table(ipq_sysctl_header); 696 unregister_sysctl_table(ipq_sysctl_header);
697 unregister_netdevice_notifier(&ipq_dev_notifier); 697 unregister_netdevice_notifier(&ipq_dev_notifier);
698 proc_net_remove(IPQ_PROC_FS_NAME); 698 proc_net_remove(IPQ_PROC_FS_NAME);
699 699
700cleanup_ipqnl: 700cleanup_ipqnl:
701 sock_release(ipqnl->sk_socket); 701 sock_release(ipqnl->sk_socket);
702 mutex_lock(&ipqnl_mutex); 702 mutex_lock(&ipqnl_mutex);
703 mutex_unlock(&ipqnl_mutex); 703 mutex_unlock(&ipqnl_mutex);
704 704
705cleanup_netlink_notifier: 705cleanup_netlink_notifier:
706 netlink_unregister_notifier(&ipq_nl_notifier); 706 netlink_unregister_notifier(&ipq_nl_notifier);
707 return status; 707 return status;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7083e1cfb2f5..7c512e13f956 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -92,16 +92,16 @@ do { \
92#endif 92#endif
93 93
94/* Check for an extension */ 94/* Check for an extension */
95int 95int
96ip6t_ext_hdr(u8 nexthdr) 96ip6t_ext_hdr(u8 nexthdr)
97{ 97{
98 return ( (nexthdr == IPPROTO_HOPOPTS) || 98 return ( (nexthdr == IPPROTO_HOPOPTS) ||
99 (nexthdr == IPPROTO_ROUTING) || 99 (nexthdr == IPPROTO_ROUTING) ||
100 (nexthdr == IPPROTO_FRAGMENT) || 100 (nexthdr == IPPROTO_FRAGMENT) ||
101 (nexthdr == IPPROTO_ESP) || 101 (nexthdr == IPPROTO_ESP) ||
102 (nexthdr == IPPROTO_AH) || 102 (nexthdr == IPPROTO_AH) ||
103 (nexthdr == IPPROTO_NONE) || 103 (nexthdr == IPPROTO_NONE) ||
104 (nexthdr == IPPROTO_DSTOPTS) ); 104 (nexthdr == IPPROTO_DSTOPTS) );
105} 105}
106 106
107/* Returns whether matches rule or not. */ 107/* Returns whether matches rule or not. */
@@ -120,9 +120,9 @@ ip6_packet_match(const struct sk_buff *skb,
120#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg)) 120#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg))
121 121
122 if (FWINV(ipv6_masked_addr_cmp(&ipv6->saddr, &ip6info->smsk, 122 if (FWINV(ipv6_masked_addr_cmp(&ipv6->saddr, &ip6info->smsk,
123 &ip6info->src), IP6T_INV_SRCIP) 123 &ip6info->src), IP6T_INV_SRCIP)
124 || FWINV(ipv6_masked_addr_cmp(&ipv6->daddr, &ip6info->dmsk, 124 || FWINV(ipv6_masked_addr_cmp(&ipv6->daddr, &ip6info->dmsk,
125 &ip6info->dst), IP6T_INV_DSTIP)) { 125 &ip6info->dst), IP6T_INV_DSTIP)) {
126 dprintf("Source or dest mismatch.\n"); 126 dprintf("Source or dest mismatch.\n");
127/* 127/*
128 dprintf("SRC: %u. Mask: %u. Target: %u.%s\n", ip->saddr, 128 dprintf("SRC: %u. Mask: %u. Target: %u.%s\n", ip->saddr,
@@ -177,7 +177,7 @@ ip6_packet_match(const struct sk_buff *skb,
177 *fragoff = _frag_off; 177 *fragoff = _frag_off;
178 178
179 dprintf("Packet protocol %hi ?= %s%hi.\n", 179 dprintf("Packet protocol %hi ?= %s%hi.\n",
180 protohdr, 180 protohdr,
181 ip6info->invflags & IP6T_INV_PROTO ? "!":"", 181 ip6info->invflags & IP6T_INV_PROTO ? "!":"",
182 ip6info->proto); 182 ip6info->proto);
183 183
@@ -197,7 +197,7 @@ ip6_packet_match(const struct sk_buff *skb,
197} 197}
198 198
199/* should be ip6 safe */ 199/* should be ip6 safe */
200static inline int 200static inline int
201ip6_checkentry(const struct ip6t_ip6 *ipv6) 201ip6_checkentry(const struct ip6t_ip6 *ipv6)
202{ 202{
203 if (ipv6->flags & ~IP6T_F_MASK) { 203 if (ipv6->flags & ~IP6T_F_MASK) {
@@ -337,7 +337,7 @@ ip6t_do_table(struct sk_buff **pskb,
337 e = get_entry(table_base, v); 337 e = get_entry(table_base, v);
338 } else { 338 } else {
339 /* Targets which reenter must return 339 /* Targets which reenter must return
340 abs. verdicts */ 340 abs. verdicts */
341#ifdef CONFIG_NETFILTER_DEBUG 341#ifdef CONFIG_NETFILTER_DEBUG
342 ((struct ip6t_entry *)table_base)->comefrom 342 ((struct ip6t_entry *)table_base)->comefrom
343 = 0xeeeeeeec; 343 = 0xeeeeeeec;
@@ -534,10 +534,10 @@ check_match(struct ip6t_entry_match *m,
534 int ret; 534 int ret;
535 535
536 match = try_then_request_module(xt_find_match(AF_INET6, m->u.user.name, 536 match = try_then_request_module(xt_find_match(AF_INET6, m->u.user.name,
537 m->u.user.revision), 537 m->u.user.revision),
538 "ip6t_%s", m->u.user.name); 538 "ip6t_%s", m->u.user.name);
539 if (IS_ERR(match) || !match) { 539 if (IS_ERR(match) || !match) {
540 duprintf("check_match: `%s' not found\n", m->u.user.name); 540 duprintf("check_match: `%s' not found\n", m->u.user.name);
541 return match ? PTR_ERR(match) : -ENOENT; 541 return match ? PTR_ERR(match) : -ENOENT;
542 } 542 }
543 m->u.kernel.match = match; 543 m->u.kernel.match = match;
@@ -661,7 +661,7 @@ check_entry_size_and_hooks(struct ip6t_entry *e,
661 } 661 }
662 662
663 /* FIXME: underflows must be unconditional, standard verdicts 663 /* FIXME: underflows must be unconditional, standard verdicts
664 < 0 (not IP6T_RETURN). --RR */ 664 < 0 (not IP6T_RETURN). --RR */
665 665
666 /* Clear counters and comefrom */ 666 /* Clear counters and comefrom */
667 e->counters = ((struct xt_counters) { 0, 0 }); 667 e->counters = ((struct xt_counters) { 0, 0 });
@@ -1003,8 +1003,8 @@ do_replace(void __user *user, unsigned int len)
1003 /* Update module usage count based on number of rules */ 1003 /* Update module usage count based on number of rules */
1004 duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n", 1004 duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n",
1005 oldinfo->number, oldinfo->initial_entries, newinfo->number); 1005 oldinfo->number, oldinfo->initial_entries, newinfo->number);
1006 if ((oldinfo->number > oldinfo->initial_entries) || 1006 if ((oldinfo->number > oldinfo->initial_entries) ||
1007 (newinfo->number <= oldinfo->initial_entries)) 1007 (newinfo->number <= oldinfo->initial_entries))
1008 module_put(t->me); 1008 module_put(t->me);
1009 if ((oldinfo->number > oldinfo->initial_entries) && 1009 if ((oldinfo->number > oldinfo->initial_entries) &&
1010 (newinfo->number <= oldinfo->initial_entries)) 1010 (newinfo->number <= oldinfo->initial_entries))
@@ -1492,9 +1492,9 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
1492 } 1492 }
1493 hdrlen = 8; 1493 hdrlen = 8;
1494 } else if (nexthdr == NEXTHDR_AUTH) 1494 } else if (nexthdr == NEXTHDR_AUTH)
1495 hdrlen = (hp->hdrlen + 2) << 2; 1495 hdrlen = (hp->hdrlen + 2) << 2;
1496 else 1496 else
1497 hdrlen = ipv6_optlen(hp); 1497 hdrlen = ipv6_optlen(hp);
1498 1498
1499 nexthdr = hp->nexthdr; 1499 nexthdr = hp->nexthdr;
1500 len -= hdrlen; 1500 len -= hdrlen;
diff --git a/net/ipv6/netfilter/ip6t_HL.c b/net/ipv6/netfilter/ip6t_HL.c
index 04e500172fb4..ccbab66277e3 100644
--- a/net/ipv6/netfilter/ip6t_HL.c
+++ b/net/ipv6/netfilter/ip6t_HL.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Hop Limit modification target for ip6tables 2 * Hop Limit modification target for ip6tables
3 * Maciej Soltysiak <solt@dns.toxicfilms.tv> 3 * Maciej Soltysiak <solt@dns.toxicfilms.tv>
4 * Based on HW's TTL module 4 * Based on HW's TTL module
@@ -18,7 +18,7 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
18MODULE_DESCRIPTION("IP6 tables Hop Limit modification module"); 18MODULE_DESCRIPTION("IP6 tables Hop Limit modification module");
19MODULE_LICENSE("GPL"); 19MODULE_LICENSE("GPL");
20 20
21static unsigned int ip6t_hl_target(struct sk_buff **pskb, 21static unsigned int ip6t_hl_target(struct sk_buff **pskb,
22 const struct net_device *in, 22 const struct net_device *in,
23 const struct net_device *out, 23 const struct net_device *out,
24 unsigned int hooknum, 24 unsigned int hooknum,
@@ -67,7 +67,7 @@ static int ip6t_hl_checkentry(const char *tablename,
67 struct ip6t_HL_info *info = targinfo; 67 struct ip6t_HL_info *info = targinfo;
68 68
69 if (info->mode > IP6T_HL_MAXMODE) { 69 if (info->mode > IP6T_HL_MAXMODE) {
70 printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n", 70 printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n",
71 info->mode); 71 info->mode);
72 return 0; 72 return 0;
73 } 73 }
@@ -80,12 +80,12 @@ static int ip6t_hl_checkentry(const char *tablename,
80} 80}
81 81
82static struct xt_target ip6t_HL = { 82static struct xt_target ip6t_HL = {
83 .name = "HL", 83 .name = "HL",
84 .family = AF_INET6, 84 .family = AF_INET6,
85 .target = ip6t_hl_target, 85 .target = ip6t_hl_target,
86 .targetsize = sizeof(struct ip6t_HL_info), 86 .targetsize = sizeof(struct ip6t_HL_info),
87 .table = "mangle", 87 .table = "mangle",
88 .checkentry = ip6t_hl_checkentry, 88 .checkentry = ip6t_hl_checkentry,
89 .me = THIS_MODULE 89 .me = THIS_MODULE
90}; 90};
91 91
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index 5587a77b884c..dc9ec9305778 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -145,7 +145,7 @@ static void dump_packet(const struct nf_loginfo *info,
145 &_ahdr); 145 &_ahdr);
146 if (ah == NULL) { 146 if (ah == NULL) {
147 /* 147 /*
148 * Max length: 26 "INCOMPLETE [65535 148 * Max length: 26 "INCOMPLETE [65535
149 * bytes] )" 149 * bytes] )"
150 */ 150 */
151 printk("INCOMPLETE [%u bytes] )", 151 printk("INCOMPLETE [%u bytes] )",
@@ -387,7 +387,7 @@ ip6t_log_packet(unsigned int pf,
387 loginfo = &default_loginfo; 387 loginfo = &default_loginfo;
388 388
389 spin_lock_bh(&log_lock); 389 spin_lock_bh(&log_lock);
390 printk("<%d>%sIN=%s OUT=%s ", loginfo->u.log.level, 390 printk("<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
391 prefix, 391 prefix,
392 in ? in->name : "", 392 in ? in->name : "",
393 out ? out->name : ""); 393 out ? out->name : "");
@@ -442,7 +442,7 @@ ip6t_log_target(struct sk_buff **pskb,
442 li.u.log.logflags = loginfo->logflags; 442 li.u.log.logflags = loginfo->logflags;
443 443
444 ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li, 444 ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,
445 loginfo->prefix); 445 loginfo->prefix);
446 return XT_CONTINUE; 446 return XT_CONTINUE;
447} 447}
448 448
@@ -470,9 +470,9 @@ static int ip6t_log_checkentry(const char *tablename,
470static struct xt_target ip6t_log_reg = { 470static struct xt_target ip6t_log_reg = {
471 .name = "LOG", 471 .name = "LOG",
472 .family = AF_INET6, 472 .family = AF_INET6,
473 .target = ip6t_log_target, 473 .target = ip6t_log_target,
474 .targetsize = sizeof(struct ip6t_log_info), 474 .targetsize = sizeof(struct ip6t_log_info),
475 .checkentry = ip6t_log_checkentry, 475 .checkentry = ip6t_log_checkentry,
476 .me = THIS_MODULE, 476 .me = THIS_MODULE,
477}; 477};
478 478
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 278349c18793..6abee94c929f 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -189,23 +189,23 @@ static unsigned int reject6_target(struct sk_buff **pskb,
189 /* WARNING: This code causes reentry within ip6tables. 189 /* WARNING: This code causes reentry within ip6tables.
190 This means that the ip6tables jump stack is now crap. We 190 This means that the ip6tables jump stack is now crap. We
191 must return an absolute verdict. --RR */ 191 must return an absolute verdict. --RR */
192 switch (reject->with) { 192 switch (reject->with) {
193 case IP6T_ICMP6_NO_ROUTE: 193 case IP6T_ICMP6_NO_ROUTE:
194 send_unreach(*pskb, ICMPV6_NOROUTE, hooknum); 194 send_unreach(*pskb, ICMPV6_NOROUTE, hooknum);
195 break; 195 break;
196 case IP6T_ICMP6_ADM_PROHIBITED: 196 case IP6T_ICMP6_ADM_PROHIBITED:
197 send_unreach(*pskb, ICMPV6_ADM_PROHIBITED, hooknum); 197 send_unreach(*pskb, ICMPV6_ADM_PROHIBITED, hooknum);
198 break; 198 break;
199 case IP6T_ICMP6_NOT_NEIGHBOUR: 199 case IP6T_ICMP6_NOT_NEIGHBOUR:
200 send_unreach(*pskb, ICMPV6_NOT_NEIGHBOUR, hooknum); 200 send_unreach(*pskb, ICMPV6_NOT_NEIGHBOUR, hooknum);
201 break; 201 break;
202 case IP6T_ICMP6_ADDR_UNREACH: 202 case IP6T_ICMP6_ADDR_UNREACH:
203 send_unreach(*pskb, ICMPV6_ADDR_UNREACH, hooknum); 203 send_unreach(*pskb, ICMPV6_ADDR_UNREACH, hooknum);
204 break; 204 break;
205 case IP6T_ICMP6_PORT_UNREACH: 205 case IP6T_ICMP6_PORT_UNREACH:
206 send_unreach(*pskb, ICMPV6_PORT_UNREACH, hooknum); 206 send_unreach(*pskb, ICMPV6_PORT_UNREACH, hooknum);
207 break; 207 break;
208 case IP6T_ICMP6_ECHOREPLY: 208 case IP6T_ICMP6_ECHOREPLY:
209 /* Do nothing */ 209 /* Do nothing */
210 break; 210 break;
211 case IP6T_TCP_RESET: 211 case IP6T_TCP_RESET:
@@ -226,7 +226,7 @@ static int check(const char *tablename,
226 void *targinfo, 226 void *targinfo,
227 unsigned int hook_mask) 227 unsigned int hook_mask)
228{ 228{
229 const struct ip6t_reject_info *rejinfo = targinfo; 229 const struct ip6t_reject_info *rejinfo = targinfo;
230 const struct ip6t_entry *e = entry; 230 const struct ip6t_entry *e = entry;
231 231
232 if (rejinfo->with == IP6T_ICMP6_ECHOREPLY) { 232 if (rejinfo->with == IP6T_ICMP6_ECHOREPLY) {
diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c
index 456c76adcbf6..d3c154371b41 100644
--- a/net/ipv6/netfilter/ip6t_ah.c
+++ b/net/ipv6/netfilter/ip6t_ah.c
@@ -78,13 +78,13 @@ match(const struct sk_buff *skb,
78 78
79 DEBUGP("IPv6 AH spi %02X ", 79 DEBUGP("IPv6 AH spi %02X ",
80 (spi_match(ahinfo->spis[0], ahinfo->spis[1], 80 (spi_match(ahinfo->spis[0], ahinfo->spis[1],
81 ntohl(ah->spi), 81 ntohl(ah->spi),
82 !!(ahinfo->invflags & IP6T_AH_INV_SPI)))); 82 !!(ahinfo->invflags & IP6T_AH_INV_SPI))));
83 DEBUGP("len %02X %04X %02X ", 83 DEBUGP("len %02X %04X %02X ",
84 ahinfo->hdrlen, hdrlen, 84 ahinfo->hdrlen, hdrlen,
85 (!ahinfo->hdrlen || 85 (!ahinfo->hdrlen ||
86 (ahinfo->hdrlen == hdrlen) ^ 86 (ahinfo->hdrlen == hdrlen) ^
87 !!(ahinfo->invflags & IP6T_AH_INV_LEN))); 87 !!(ahinfo->invflags & IP6T_AH_INV_LEN)));
88 DEBUGP("res %02X %04X %02X\n", 88 DEBUGP("res %02X %04X %02X\n",
89 ahinfo->hdrres, ah->reserved, 89 ahinfo->hdrres, ah->reserved,
90 !(ahinfo->hdrres && ah->reserved)); 90 !(ahinfo->hdrres && ah->reserved));
@@ -92,12 +92,12 @@ match(const struct sk_buff *skb,
92 return (ah != NULL) 92 return (ah != NULL)
93 && 93 &&
94 (spi_match(ahinfo->spis[0], ahinfo->spis[1], 94 (spi_match(ahinfo->spis[0], ahinfo->spis[1],
95 ntohl(ah->spi), 95 ntohl(ah->spi),
96 !!(ahinfo->invflags & IP6T_AH_INV_SPI))) 96 !!(ahinfo->invflags & IP6T_AH_INV_SPI)))
97 && 97 &&
98 (!ahinfo->hdrlen || 98 (!ahinfo->hdrlen ||
99 (ahinfo->hdrlen == hdrlen) ^ 99 (ahinfo->hdrlen == hdrlen) ^
100 !!(ahinfo->invflags & IP6T_AH_INV_LEN)) 100 !!(ahinfo->invflags & IP6T_AH_INV_LEN))
101 && 101 &&
102 !(ahinfo->hdrres && ah->reserved); 102 !(ahinfo->hdrres && ah->reserved);
103} 103}
@@ -105,10 +105,10 @@ match(const struct sk_buff *skb,
105/* Called when user tries to insert an entry of this type. */ 105/* Called when user tries to insert an entry of this type. */
106static int 106static int
107checkentry(const char *tablename, 107checkentry(const char *tablename,
108 const void *entry, 108 const void *entry,
109 const struct xt_match *match, 109 const struct xt_match *match,
110 void *matchinfo, 110 void *matchinfo,
111 unsigned int hook_mask) 111 unsigned int hook_mask)
112{ 112{
113 const struct ip6t_ah *ahinfo = matchinfo; 113 const struct ip6t_ah *ahinfo = matchinfo;
114 114
diff --git a/net/ipv6/netfilter/ip6t_hl.c b/net/ipv6/netfilter/ip6t_hl.c
index 601cc1211c62..37c8a4d4ed78 100644
--- a/net/ipv6/netfilter/ip6t_hl.c
+++ b/net/ipv6/netfilter/ip6t_hl.c
@@ -41,7 +41,7 @@ static int match(const struct sk_buff *skb,
41 return (ip6h->hop_limit > info->hop_limit); 41 return (ip6h->hop_limit > info->hop_limit);
42 break; 42 break;
43 default: 43 default:
44 printk(KERN_WARNING "ip6t_hl: unknown mode %d\n", 44 printk(KERN_WARNING "ip6t_hl: unknown mode %d\n",
45 info->mode); 45 info->mode);
46 return 0; 46 return 0;
47 } 47 }
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c
index 26ac084adefc..700a11d25deb 100644
--- a/net/ipv6/netfilter/ip6t_ipv6header.c
+++ b/net/ipv6/netfilter/ip6t_ipv6header.c
@@ -1,7 +1,7 @@
1/* ipv6header match - matches IPv6 packets based 1/* ipv6header match - matches IPv6 packets based
2 on whether they contain certain headers */ 2 on whether they contain certain headers */
3 3
4/* Original idea: Brad Chapman 4/* Original idea: Brad Chapman
5 * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */ 5 * Rewritten by: Andras Kis-Szabo <kisza@sch.bme.hu> */
6 6
7/* (C) 2001-2002 Andras Kis-Szabo <kisza@sch.bme.hu> 7/* (C) 2001-2002 Andras Kis-Szabo <kisza@sch.bme.hu>
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index 5f5aa0e51478..0c468d35a937 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -50,7 +50,7 @@ static struct
50 0, NULL, { } }, 50 0, NULL, { } },
51 { 51 {
52 /* PRE_ROUTING */ 52 /* PRE_ROUTING */
53 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 53 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 },
54 0, 54 0,
55 sizeof(struct ip6t_entry), 55 sizeof(struct ip6t_entry),
56 sizeof(struct ip6t_standard), 56 sizeof(struct ip6t_standard),
@@ -58,7 +58,7 @@ static struct
58 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, 58 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } },
59 -NF_ACCEPT - 1 } }, 59 -NF_ACCEPT - 1 } },
60 /* LOCAL_IN */ 60 /* LOCAL_IN */
61 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 61 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 },
62 0, 62 0,
63 sizeof(struct ip6t_entry), 63 sizeof(struct ip6t_entry),
64 sizeof(struct ip6t_standard), 64 sizeof(struct ip6t_standard),
@@ -66,7 +66,7 @@ static struct
66 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, 66 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } },
67 -NF_ACCEPT - 1 } }, 67 -NF_ACCEPT - 1 } },
68 /* FORWARD */ 68 /* FORWARD */
69 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 69 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 },
70 0, 70 0,
71 sizeof(struct ip6t_entry), 71 sizeof(struct ip6t_entry),
72 sizeof(struct ip6t_standard), 72 sizeof(struct ip6t_standard),
@@ -74,7 +74,7 @@ static struct
74 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } }, 74 { { { { IP6T_ALIGN(sizeof(struct ip6t_standard_target)), "" } }, { } },
75 -NF_ACCEPT - 1 } }, 75 -NF_ACCEPT - 1 } },
76 /* LOCAL_OUT */ 76 /* LOCAL_OUT */
77 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 }, 77 { { { { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, { { { 0 } } }, "", "", { 0 }, { 0 }, 0, 0, 0 },
78 0, 78 0,
79 sizeof(struct ip6t_entry), 79 sizeof(struct ip6t_entry),
80 sizeof(struct ip6t_standard), 80 sizeof(struct ip6t_standard),
@@ -156,7 +156,7 @@ ip6t_local_hook(unsigned int hook,
156 156
157 ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler); 157 ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
158 158
159 if (ret != NF_DROP && ret != NF_STOLEN 159 if (ret != NF_DROP && ret != NF_STOLEN
160 && (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr)) 160 && (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr))
161 || memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr)) 161 || memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr))
162 || (*pskb)->mark != mark 162 || (*pskb)->mark != mark
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index 277bf34638b4..a3eb5b8ce18d 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -87,10 +87,10 @@ static struct
87 } 87 }
88}; 88};
89 89
90static struct xt_table packet_raw = { 90static struct xt_table packet_raw = {
91 .name = "raw", 91 .name = "raw",
92 .valid_hooks = RAW_VALID_HOOKS, 92 .valid_hooks = RAW_VALID_HOOKS,
93 .lock = RW_LOCK_UNLOCKED, 93 .lock = RW_LOCK_UNLOCKED,
94 .me = THIS_MODULE, 94 .me = THIS_MODULE,
95 .af = AF_INET6, 95 .af = AF_INET6,
96}; 96};
@@ -106,17 +106,17 @@ ip6t_hook(unsigned int hook,
106 return ip6t_do_table(pskb, hook, in, out, &packet_raw); 106 return ip6t_do_table(pskb, hook, in, out, &packet_raw);
107} 107}
108 108
109static struct nf_hook_ops ip6t_ops[] = { 109static struct nf_hook_ops ip6t_ops[] = {
110 { 110 {
111 .hook = ip6t_hook, 111 .hook = ip6t_hook,
112 .pf = PF_INET6, 112 .pf = PF_INET6,
113 .hooknum = NF_IP6_PRE_ROUTING, 113 .hooknum = NF_IP6_PRE_ROUTING,
114 .priority = NF_IP6_PRI_FIRST, 114 .priority = NF_IP6_PRI_FIRST,
115 .owner = THIS_MODULE, 115 .owner = THIS_MODULE,
116 }, 116 },
117 { 117 {
118 .hook = ip6t_hook, 118 .hook = ip6t_hook,
119 .pf = PF_INET6, 119 .pf = PF_INET6,
120 .hooknum = NF_IP6_LOCAL_OUT, 120 .hooknum = NF_IP6_LOCAL_OUT,
121 .priority = NF_IP6_PRI_FIRST, 121 .priority = NF_IP6_PRI_FIRST,
122 .owner = THIS_MODULE, 122 .owner = THIS_MODULE,
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index a20615ffccff..a2353edf4ebc 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -349,7 +349,7 @@ static ctl_table nf_ct_ipv6_sysctl_table[] = {
349 .mode = 0644, 349 .mode = 0644,
350 .proc_handler = &proc_dointvec, 350 .proc_handler = &proc_dointvec,
351 }, 351 },
352 { .ctl_name = 0 } 352 { .ctl_name = 0 }
353}; 353};
354#endif 354#endif
355 355
@@ -386,7 +386,7 @@ static int ipv6_nfattr_to_tuple(struct nfattr *tb[],
386 if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip)) 386 if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
387 return -EINVAL; 387 return -EINVAL;
388 388
389 memcpy(&t->src.u3.ip6, NFA_DATA(tb[CTA_IP_V6_SRC-1]), 389 memcpy(&t->src.u3.ip6, NFA_DATA(tb[CTA_IP_V6_SRC-1]),
390 sizeof(u_int32_t) * 4); 390 sizeof(u_int32_t) * 4);
391 memcpy(&t->dst.u3.ip6, NFA_DATA(tb[CTA_IP_V6_DST-1]), 391 memcpy(&t->dst.u3.ip6, NFA_DATA(tb[CTA_IP_V6_DST-1]),
392 sizeof(u_int32_t) * 4); 392 sizeof(u_int32_t) * 4);
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 3905cacc69af..b08622c992b2 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -104,9 +104,9 @@ static int icmpv6_packet(struct nf_conn *ct,
104 unsigned int hooknum) 104 unsigned int hooknum)
105{ 105{
106 /* Try to delete connection immediately after all replies: 106 /* Try to delete connection immediately after all replies:
107 won't actually vanish as we still have skb, and del_timer 107 won't actually vanish as we still have skb, and del_timer
108 means this will only run once even if count hits zero twice 108 means this will only run once even if count hits zero twice
109 (theoretically possible with SMP) */ 109 (theoretically possible with SMP) */
110 if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { 110 if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
111 if (atomic_dec_and_test(&ct->proto.icmp.count) 111 if (atomic_dec_and_test(&ct->proto.icmp.count)
112 && del_timer(&ct->timeout)) 112 && del_timer(&ct->timeout))
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index d9c15402ba66..15ab1e3e8b56 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -311,7 +311,7 @@ static struct nf_ct_frag6_queue *nf_ct_frag6_intern(unsigned int hash,
311 write_lock(&nf_ct_frag6_lock); 311 write_lock(&nf_ct_frag6_lock);
312#ifdef CONFIG_SMP 312#ifdef CONFIG_SMP
313 hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) { 313 hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) {
314 if (fq->id == fq_in->id && 314 if (fq->id == fq_in->id &&
315 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) && 315 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) &&
316 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) { 316 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) {
317 atomic_inc(&fq->refcnt); 317 atomic_inc(&fq->refcnt);
@@ -374,7 +374,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
374 374
375 read_lock(&nf_ct_frag6_lock); 375 read_lock(&nf_ct_frag6_lock);
376 hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) { 376 hlist_for_each_entry(fq, n, &nf_ct_frag6_hash[hash], list) {
377 if (fq->id == id && 377 if (fq->id == id &&
378 ipv6_addr_equal(src, &fq->saddr) && 378 ipv6_addr_equal(src, &fq->saddr) &&
379 ipv6_addr_equal(dst, &fq->daddr)) { 379 ipv6_addr_equal(dst, &fq->daddr)) {
380 atomic_inc(&fq->refcnt); 380 atomic_inc(&fq->refcnt);
@@ -388,7 +388,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
388} 388}
389 389
390 390
391static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, 391static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
392 struct frag_hdr *fhdr, int nhoff) 392 struct frag_hdr *fhdr, int nhoff)
393{ 393{
394 struct sk_buff *prev, *next; 394 struct sk_buff *prev, *next;
@@ -405,12 +405,12 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
405 405
406 if ((unsigned int)end > IPV6_MAXPLEN) { 406 if ((unsigned int)end > IPV6_MAXPLEN) {
407 DEBUGP("offset is too large.\n"); 407 DEBUGP("offset is too large.\n");
408 return -1; 408 return -1;
409 } 409 }
410 410
411 if (skb->ip_summed == CHECKSUM_COMPLETE) 411 if (skb->ip_summed == CHECKSUM_COMPLETE)
412 skb->csum = csum_sub(skb->csum, 412 skb->csum = csum_sub(skb->csum,
413 csum_partial(skb->nh.raw, 413 csum_partial(skb->nh.raw,
414 (u8*)(fhdr + 1) - skb->nh.raw, 414 (u8*)(fhdr + 1) - skb->nh.raw,
415 0)); 415 0));
416 416
@@ -625,7 +625,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
625 /* We have to remove fragment header from datagram and to relocate 625 /* We have to remove fragment header from datagram and to relocate
626 * header in order to calculate ICV correctly. */ 626 * header in order to calculate ICV correctly. */
627 head->nh.raw[fq->nhoffset] = head->h.raw[0]; 627 head->nh.raw[fq->nhoffset] = head->h.raw[0];
628 memmove(head->head + sizeof(struct frag_hdr), head->head, 628 memmove(head->head + sizeof(struct frag_hdr), head->head,
629 (head->data - head->head) - sizeof(struct frag_hdr)); 629 (head->data - head->head) - sizeof(struct frag_hdr));
630 head->mac.raw += sizeof(struct frag_hdr); 630 head->mac.raw += sizeof(struct frag_hdr);
631 head->nh.raw += sizeof(struct frag_hdr); 631 head->nh.raw += sizeof(struct frag_hdr);
@@ -701,41 +701,41 @@ out_fail:
701static int 701static int
702find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) 702find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
703{ 703{
704 u8 nexthdr = skb->nh.ipv6h->nexthdr; 704 u8 nexthdr = skb->nh.ipv6h->nexthdr;
705 u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data; 705 u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data;
706 int start = (u8 *)(skb->nh.ipv6h+1) - skb->data; 706 int start = (u8 *)(skb->nh.ipv6h+1) - skb->data;
707 int len = skb->len - start; 707 int len = skb->len - start;
708 u8 prevhdr = NEXTHDR_IPV6; 708 u8 prevhdr = NEXTHDR_IPV6;
709 709
710 while (nexthdr != NEXTHDR_FRAGMENT) { 710 while (nexthdr != NEXTHDR_FRAGMENT) {
711 struct ipv6_opt_hdr hdr; 711 struct ipv6_opt_hdr hdr;
712 int hdrlen; 712 int hdrlen;
713 713
714 if (!ipv6_ext_hdr(nexthdr)) { 714 if (!ipv6_ext_hdr(nexthdr)) {
715 return -1; 715 return -1;
716 } 716 }
717 if (len < (int)sizeof(struct ipv6_opt_hdr)) { 717 if (len < (int)sizeof(struct ipv6_opt_hdr)) {
718 DEBUGP("too short\n"); 718 DEBUGP("too short\n");
719 return -1; 719 return -1;
720 } 720 }
721 if (nexthdr == NEXTHDR_NONE) { 721 if (nexthdr == NEXTHDR_NONE) {
722 DEBUGP("next header is none\n"); 722 DEBUGP("next header is none\n");
723 return -1; 723 return -1;
724 } 724 }
725 if (skb_copy_bits(skb, start, &hdr, sizeof(hdr))) 725 if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
726 BUG(); 726 BUG();
727 if (nexthdr == NEXTHDR_AUTH) 727 if (nexthdr == NEXTHDR_AUTH)
728 hdrlen = (hdr.hdrlen+2)<<2; 728 hdrlen = (hdr.hdrlen+2)<<2;
729 else 729 else
730 hdrlen = ipv6_optlen(&hdr); 730 hdrlen = ipv6_optlen(&hdr);
731 731
732 prevhdr = nexthdr; 732 prevhdr = nexthdr;
733 prev_nhoff = start; 733 prev_nhoff = start;
734 734
735 nexthdr = hdr.nexthdr; 735 nexthdr = hdr.nexthdr;
736 len -= hdrlen; 736 len -= hdrlen;
737 start += hdrlen; 737 start += hdrlen;
738 } 738 }
739 739
740 if (len < 0) 740 if (len < 0)
741 return -1; 741 return -1;
@@ -749,7 +749,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
749 749
750struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb) 750struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
751{ 751{
752 struct sk_buff *clone; 752 struct sk_buff *clone;
753 struct net_device *dev = skb->dev; 753 struct net_device *dev = skb->dev;
754 struct frag_hdr *fhdr; 754 struct frag_hdr *fhdr;
755 struct nf_ct_frag6_queue *fq; 755 struct nf_ct_frag6_queue *fq;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 35249d8487bb..032ef95c5b00 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -50,7 +50,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
50 seq_printf(seq, "UDP6: inuse %d\n", 50 seq_printf(seq, "UDP6: inuse %d\n",
51 fold_prot_inuse(&udpv6_prot)); 51 fold_prot_inuse(&udpv6_prot));
52 seq_printf(seq, "UDPLITE6: inuse %d\n", 52 seq_printf(seq, "UDPLITE6: inuse %d\n",
53 fold_prot_inuse(&udplitev6_prot)); 53 fold_prot_inuse(&udplitev6_prot));
54 seq_printf(seq, "RAW6: inuse %d\n", 54 seq_printf(seq, "RAW6: inuse %d\n",
55 fold_prot_inuse(&rawv6_prot)); 55 fold_prot_inuse(&rawv6_prot));
56 seq_printf(seq, "FRAG6: inuse %d memory %d\n", 56 seq_printf(seq, "FRAG6: inuse %d memory %d\n",
@@ -89,7 +89,7 @@ static struct snmp_mib snmp6_icmp6_list[] = {
89/* icmpv6 mib according to RFC 2466 89/* icmpv6 mib according to RFC 2466
90 90
91 Exceptions: {In|Out}AdminProhibs are removed, because I see 91 Exceptions: {In|Out}AdminProhibs are removed, because I see
92 no good reasons to account them separately 92 no good reasons to account them separately
93 of another dest.unreachs. 93 of another dest.unreachs.
94 OutErrs is zero identically. 94 OutErrs is zero identically.
95 OutEchos too. 95 OutEchos too.
@@ -146,14 +146,14 @@ static struct snmp_mib snmp6_udplite6_list[] = {
146static unsigned long 146static unsigned long
147fold_field(void *mib[], int offt) 147fold_field(void *mib[], int offt)
148{ 148{
149 unsigned long res = 0; 149 unsigned long res = 0;
150 int i; 150 int i;
151 151
152 for_each_possible_cpu(i) { 152 for_each_possible_cpu(i) {
153 res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt); 153 res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt);
154 res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt); 154 res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt);
155 } 155 }
156 return res; 156 return res;
157} 157}
158 158
159static inline void 159static inline void
@@ -161,7 +161,7 @@ snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist)
161{ 161{
162 int i; 162 int i;
163 for (i=0; itemlist[i].name; i++) 163 for (i=0; itemlist[i].name; i++)
164 seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, 164 seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name,
165 fold_field(mib, itemlist[i].entry)); 165 fold_field(mib, itemlist[i].entry));
166} 166}
167 167
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
index 52c1d58b6ca6..ad0410c99675 100644
--- a/net/ipv6/protocol.c
+++ b/net/ipv6/protocol.c
@@ -64,7 +64,7 @@ int inet6_add_protocol(struct inet6_protocol *prot, unsigned char protocol)
64/* 64/*
65 * Remove a protocol from the hash tables. 65 * Remove a protocol from the hash tables.
66 */ 66 */
67 67
68int inet6_del_protocol(struct inet6_protocol *prot, unsigned char protocol) 68int inet6_del_protocol(struct inet6_protocol *prot, unsigned char protocol)
69{ 69{
70 int ret, hash = protocol & (MAX_INET_PROTOS - 1); 70 int ret, hash = protocol & (MAX_INET_PROTOS - 1);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index c2d8059e754e..16d4c63ff554 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * RAW sockets for IPv6 2 * RAW sockets for IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * Adapted from linux/net/ipv4/raw.c 8 * Adapted from linux/net/ipv4/raw.c
9 * 9 *
@@ -11,7 +11,7 @@
11 * 11 *
12 * Fixes: 12 * Fixes:
13 * Hideaki YOSHIFUJI : sin6_scope_id support 13 * Hideaki YOSHIFUJI : sin6_scope_id support
14 * YOSHIFUJI,H.@USAGI : raw checksum (RFC2292(bis) compliance) 14 * YOSHIFUJI,H.@USAGI : raw checksum (RFC2292(bis) compliance)
15 * Kazunori MIYAZAWA @USAGI: change process style to use ip6_append_data 15 * Kazunori MIYAZAWA @USAGI: change process style to use ip6_append_data
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
@@ -71,12 +71,12 @@ static void raw_v6_hash(struct sock *sk)
71 write_lock_bh(&raw_v6_lock); 71 write_lock_bh(&raw_v6_lock);
72 sk_add_node(sk, list); 72 sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot); 73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock_bh(&raw_v6_lock); 74 write_unlock_bh(&raw_v6_lock);
75} 75}
76 76
77static void raw_v6_unhash(struct sock *sk) 77static void raw_v6_unhash(struct sock *sk)
78{ 78{
79 write_lock_bh(&raw_v6_lock); 79 write_lock_bh(&raw_v6_lock);
80 if (sk_del_node_init(sk)) 80 if (sk_del_node_init(sk))
81 sock_prot_dec_use(sk->sk_prot); 81 sock_prot_dec_use(sk->sk_prot);
82 write_unlock_bh(&raw_v6_lock); 82 write_unlock_bh(&raw_v6_lock);
@@ -250,7 +250,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
250 */ 250 */
251 sk->sk_bound_dev_if = addr->sin6_scope_id; 251 sk->sk_bound_dev_if = addr->sin6_scope_id;
252 } 252 }
253 253
254 /* Binding to link-local address requires an interface */ 254 /* Binding to link-local address requires an interface */
255 if (!sk->sk_bound_dev_if) 255 if (!sk->sk_bound_dev_if)
256 goto out; 256 goto out;
@@ -261,7 +261,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
261 goto out; 261 goto out;
262 } 262 }
263 } 263 }
264 264
265 /* ipv4 addr of the socket is invalid. Only the 265 /* ipv4 addr of the socket is invalid. Only the
266 * unspecified and mapped address have a v4 equivalent. 266 * unspecified and mapped address have a v4 equivalent.
267 */ 267 */
@@ -324,7 +324,7 @@ void rawv6_err(struct sock *sk, struct sk_buff *skb,
324 324
325static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) 325static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb)
326{ 326{
327 if ((raw6_sk(sk)->checksum || sk->sk_filter) && 327 if ((raw6_sk(sk)->checksum || sk->sk_filter) &&
328 skb_checksum_complete(skb)) { 328 skb_checksum_complete(skb)) {
329 /* FIXME: increment a raw6 drops counter here */ 329 /* FIXME: increment a raw6 drops counter here */
330 kfree_skb(skb); 330 kfree_skb(skb);
@@ -342,10 +342,10 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb)
342} 342}
343 343
344/* 344/*
345 * This is next to useless... 345 * This is next to useless...
346 * if we demultiplex in network layer we don't need the extra call 346 * if we demultiplex in network layer we don't need the extra call
347 * just to queue the skb... 347 * just to queue the skb...
348 * maybe we could have the network decide upon a hint if it 348 * maybe we could have the network decide upon a hint if it
349 * should call raw_rcv for demultiplexing 349 * should call raw_rcv for demultiplexing
350 */ 350 */
351int rawv6_rcv(struct sock *sk, struct sk_buff *skb) 351int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
@@ -353,17 +353,17 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
353 struct inet_sock *inet = inet_sk(sk); 353 struct inet_sock *inet = inet_sk(sk);
354 struct raw6_sock *rp = raw6_sk(sk); 354 struct raw6_sock *rp = raw6_sk(sk);
355 355
356 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { 356 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) {
357 kfree_skb(skb); 357 kfree_skb(skb);
358 return NET_RX_DROP; 358 return NET_RX_DROP;
359 } 359 }
360 360
361 if (!rp->checksum) 361 if (!rp->checksum)
362 skb->ip_summed = CHECKSUM_UNNECESSARY; 362 skb->ip_summed = CHECKSUM_UNNECESSARY;
363 363
364 if (skb->ip_summed == CHECKSUM_COMPLETE) { 364 if (skb->ip_summed == CHECKSUM_COMPLETE) {
365 skb_postpull_rcsum(skb, skb->nh.raw, 365 skb_postpull_rcsum(skb, skb->nh.raw,
366 skb->h.raw - skb->nh.raw); 366 skb->h.raw - skb->nh.raw);
367 if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr, 367 if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr,
368 &skb->nh.ipv6h->daddr, 368 &skb->nh.ipv6h->daddr,
369 skb->len, inet->num, skb->csum)) 369 skb->len, inet->num, skb->csum))
@@ -404,8 +404,8 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
404 404
405 if (flags & MSG_OOB) 405 if (flags & MSG_OOB)
406 return -EOPNOTSUPP; 406 return -EOPNOTSUPP;
407 407
408 if (addr_len) 408 if (addr_len)
409 *addr_len=sizeof(*sin6); 409 *addr_len=sizeof(*sin6);
410 410
411 if (flags & MSG_ERRQUEUE) 411 if (flags & MSG_ERRQUEUE)
@@ -416,10 +416,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
416 goto out; 416 goto out;
417 417
418 copied = skb->len; 418 copied = skb->len;
419 if (copied > len) { 419 if (copied > len) {
420 copied = len; 420 copied = len;
421 msg->msg_flags |= MSG_TRUNC; 421 msg->msg_flags |= MSG_TRUNC;
422 } 422 }
423 423
424 if (skb->ip_summed==CHECKSUM_UNNECESSARY) { 424 if (skb->ip_summed==CHECKSUM_UNNECESSARY) {
425 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); 425 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
@@ -549,7 +549,7 @@ out:
549} 549}
550 550
551static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, 551static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
552 struct flowi *fl, struct rt6_info *rt, 552 struct flowi *fl, struct rt6_info *rt,
553 unsigned int flags) 553 unsigned int flags)
554{ 554{
555 struct ipv6_pinfo *np = inet6_sk(sk); 555 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -570,7 +570,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
570 skb = sock_alloc_send_skb(sk, length+hh_len+15, 570 skb = sock_alloc_send_skb(sk, length+hh_len+15,
571 flags&MSG_DONTWAIT, &err); 571 flags&MSG_DONTWAIT, &err);
572 if (skb == NULL) 572 if (skb == NULL)
573 goto error; 573 goto error;
574 skb_reserve(skb, hh_len); 574 skb_reserve(skb, hh_len);
575 575
576 skb->priority = sk->sk_priority; 576 skb->priority = sk->sk_priority;
@@ -600,7 +600,7 @@ error_fault:
600 kfree_skb(skb); 600 kfree_skb(skb);
601error: 601error:
602 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); 602 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
603 return err; 603 return err;
604} 604}
605 605
606static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg) 606static int rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
@@ -694,19 +694,19 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
694 return -EMSGSIZE; 694 return -EMSGSIZE;
695 695
696 /* Mirror BSD error message compatibility */ 696 /* Mirror BSD error message compatibility */
697 if (msg->msg_flags & MSG_OOB) 697 if (msg->msg_flags & MSG_OOB)
698 return -EOPNOTSUPP; 698 return -EOPNOTSUPP;
699 699
700 /* 700 /*
701 * Get and verify the address. 701 * Get and verify the address.
702 */ 702 */
703 memset(&fl, 0, sizeof(fl)); 703 memset(&fl, 0, sizeof(fl));
704 704
705 if (sin6) { 705 if (sin6) {
706 if (addr_len < SIN6_LEN_RFC2133) 706 if (addr_len < SIN6_LEN_RFC2133)
707 return -EINVAL; 707 return -EINVAL;
708 708
709 if (sin6->sin6_family && sin6->sin6_family != AF_INET6) 709 if (sin6->sin6_family && sin6->sin6_family != AF_INET6)
710 return(-EAFNOSUPPORT); 710 return(-EAFNOSUPPORT);
711 711
712 /* port is the proto value [0..255] carried in nexthdr */ 712 /* port is the proto value [0..255] carried in nexthdr */
@@ -744,17 +744,17 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
744 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) 744 ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL)
745 fl.oif = sin6->sin6_scope_id; 745 fl.oif = sin6->sin6_scope_id;
746 } else { 746 } else {
747 if (sk->sk_state != TCP_ESTABLISHED) 747 if (sk->sk_state != TCP_ESTABLISHED)
748 return -EDESTADDRREQ; 748 return -EDESTADDRREQ;
749 749
750 proto = inet->num; 750 proto = inet->num;
751 daddr = &np->daddr; 751 daddr = &np->daddr;
752 fl.fl6_flowlabel = np->flow_label; 752 fl.fl6_flowlabel = np->flow_label;
753 } 753 }
754 754
755 if (ipv6_addr_any(daddr)) { 755 if (ipv6_addr_any(daddr)) {
756 /* 756 /*
757 * unspecified destination address 757 * unspecified destination address
758 * treated as error... is this correct ? 758 * treated as error... is this correct ?
759 */ 759 */
760 fl6_sock_release(flowlabel); 760 fl6_sock_release(flowlabel);
@@ -792,7 +792,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
792 err = rawv6_probe_proto_opt(&fl, msg); 792 err = rawv6_probe_proto_opt(&fl, msg);
793 if (err) 793 if (err)
794 goto out; 794 goto out;
795 795
796 ipv6_addr_copy(&fl.fl6_dst, daddr); 796 ipv6_addr_copy(&fl.fl6_dst, daddr);
797 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 797 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
798 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 798 ipv6_addr_copy(&fl.fl6_src, &np->saddr);
@@ -856,7 +856,7 @@ done:
856 dst_release(dst); 856 dst_release(dst);
857 if (!inet->hdrincl) 857 if (!inet->hdrincl)
858 release_sock(sk); 858 release_sock(sk);
859out: 859out:
860 fl6_sock_release(flowlabel); 860 fl6_sock_release(flowlabel);
861 return err<0?err:len; 861 return err<0?err:len;
862do_confirm: 862do_confirm:
@@ -867,7 +867,7 @@ do_confirm:
867 goto done; 867 goto done;
868} 868}
869 869
870static int rawv6_seticmpfilter(struct sock *sk, int level, int optname, 870static int rawv6_seticmpfilter(struct sock *sk, int level, int optname,
871 char __user *optval, int optlen) 871 char __user *optval, int optlen)
872{ 872{
873 switch (optname) { 873 switch (optname) {
@@ -884,7 +884,7 @@ static int rawv6_seticmpfilter(struct sock *sk, int level, int optname,
884 return 0; 884 return 0;
885} 885}
886 886
887static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, 887static int rawv6_geticmpfilter(struct sock *sk, int level, int optname,
888 char __user *optval, int __user *optlen) 888 char __user *optval, int __user *optlen)
889{ 889{
890 int len; 890 int len;
@@ -916,7 +916,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname,
916 struct raw6_sock *rp = raw6_sk(sk); 916 struct raw6_sock *rp = raw6_sk(sk);
917 int val; 917 int val;
918 918
919 if (get_user(val, (int __user *)optval)) 919 if (get_user(val, (int __user *)optval))
920 return -EFAULT; 920 return -EFAULT;
921 921
922 switch (optname) { 922 switch (optname) {
@@ -1224,7 +1224,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
1224 src->s6_addr32[2], src->s6_addr32[3], srcp, 1224 src->s6_addr32[2], src->s6_addr32[3], srcp,
1225 dest->s6_addr32[0], dest->s6_addr32[1], 1225 dest->s6_addr32[0], dest->s6_addr32[1],
1226 dest->s6_addr32[2], dest->s6_addr32[3], destp, 1226 dest->s6_addr32[2], dest->s6_addr32[3], destp,
1227 sp->sk_state, 1227 sp->sk_state,
1228 atomic_read(&sp->sk_wmem_alloc), 1228 atomic_read(&sp->sk_wmem_alloc),
1229 atomic_read(&sp->sk_rmem_alloc), 1229 atomic_read(&sp->sk_rmem_alloc),
1230 0, 0L, 0, 1230 0, 0L, 0,
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 6f9a9046510f..7034c54e5010 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * IPv6 fragment reassembly 2 * IPv6 fragment reassembly
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: reassembly.c,v 1.26 2001/03/07 22:00:57 davem Exp $ 8 * $Id: reassembly.c,v 1.26 2001/03/07 22:00:57 davem Exp $
9 * 9 *
@@ -15,8 +15,8 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 */ 16 */
17 17
18/* 18/*
19 * Fixes: 19 * Fixes:
20 * Andi Kleen Make it work with multiple hosts. 20 * Andi Kleen Make it work with multiple hosts.
21 * More RFC compliance. 21 * More RFC compliance.
22 * 22 *
@@ -343,7 +343,7 @@ static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
343 hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr); 343 hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr);
344#ifdef CONFIG_SMP 344#ifdef CONFIG_SMP
345 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { 345 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) {
346 if (fq->id == fq_in->id && 346 if (fq->id == fq_in->id &&
347 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) && 347 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) &&
348 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) { 348 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) {
349 atomic_inc(&fq->refcnt); 349 atomic_inc(&fq->refcnt);
@@ -406,7 +406,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
406 read_lock(&ip6_frag_lock); 406 read_lock(&ip6_frag_lock);
407 hash = ip6qhashfn(id, src, dst); 407 hash = ip6qhashfn(id, src, dst);
408 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) { 408 hlist_for_each_entry(fq, n, &ip6_frag_hash[hash], list) {
409 if (fq->id == id && 409 if (fq->id == id &&
410 ipv6_addr_equal(src, &fq->saddr) && 410 ipv6_addr_equal(src, &fq->saddr) &&
411 ipv6_addr_equal(dst, &fq->daddr)) { 411 ipv6_addr_equal(dst, &fq->daddr)) {
412 atomic_inc(&fq->refcnt); 412 atomic_inc(&fq->refcnt);
@@ -420,7 +420,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
420} 420}
421 421
422 422
423static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, 423static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
424 struct frag_hdr *fhdr, int nhoff) 424 struct frag_hdr *fhdr, int nhoff)
425{ 425{
426 struct sk_buff *prev, *next; 426 struct sk_buff *prev, *next;
@@ -436,13 +436,13 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
436 if ((unsigned int)end > IPV6_MAXPLEN) { 436 if ((unsigned int)end > IPV6_MAXPLEN) {
437 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 437 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
438 IPSTATS_MIB_INHDRERRORS); 438 IPSTATS_MIB_INHDRERRORS);
439 icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw); 439 icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw);
440 return; 440 return;
441 } 441 }
442 442
443 if (skb->ip_summed == CHECKSUM_COMPLETE) 443 if (skb->ip_summed == CHECKSUM_COMPLETE)
444 skb->csum = csum_sub(skb->csum, 444 skb->csum = csum_sub(skb->csum,
445 csum_partial(skb->nh.raw, (u8*)(fhdr+1)-skb->nh.raw, 0)); 445 csum_partial(skb->nh.raw, (u8*)(fhdr+1)-skb->nh.raw, 0));
446 446
447 /* Is this the final fragment? */ 447 /* Is this the final fragment? */
448 if (!(fhdr->frag_off & htons(IP6_MF))) { 448 if (!(fhdr->frag_off & htons(IP6_MF))) {
@@ -464,7 +464,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
464 */ 464 */
465 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), 465 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
466 IPSTATS_MIB_INHDRERRORS); 466 IPSTATS_MIB_INHDRERRORS);
467 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 467 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
468 offsetof(struct ipv6hdr, payload_len)); 468 offsetof(struct ipv6hdr, payload_len));
469 return; 469 return;
470 } 470 }
@@ -482,7 +482,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
482 /* Point into the IP datagram 'data' part. */ 482 /* Point into the IP datagram 'data' part. */
483 if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) 483 if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data))
484 goto err; 484 goto err;
485 485
486 if (pskb_trim_rcsum(skb, end - offset)) 486 if (pskb_trim_rcsum(skb, end - offset))
487 goto err; 487 goto err;
488 488
@@ -640,7 +640,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
640 * header in order to calculate ICV correctly. */ 640 * header in order to calculate ICV correctly. */
641 nhoff = fq->nhoffset; 641 nhoff = fq->nhoffset;
642 head->nh.raw[nhoff] = head->h.raw[0]; 642 head->nh.raw[nhoff] = head->h.raw[0];
643 memmove(head->head + sizeof(struct frag_hdr), head->head, 643 memmove(head->head + sizeof(struct frag_hdr), head->head,
644 (head->data - head->head) - sizeof(struct frag_hdr)); 644 (head->data - head->head) - sizeof(struct frag_hdr));
645 head->mac.raw += sizeof(struct frag_hdr); 645 head->mac.raw += sizeof(struct frag_hdr);
646 head->nh.raw += sizeof(struct frag_hdr); 646 head->nh.raw += sizeof(struct frag_hdr);
@@ -695,7 +695,7 @@ out_fail:
695 695
696static int ipv6_frag_rcv(struct sk_buff **skbp) 696static int ipv6_frag_rcv(struct sk_buff **skbp)
697{ 697{
698 struct sk_buff *skb = *skbp; 698 struct sk_buff *skb = *skbp;
699 struct net_device *dev = skb->dev; 699 struct net_device *dev = skb->dev;
700 struct frag_hdr *fhdr; 700 struct frag_hdr *fhdr;
701 struct frag_queue *fq; 701 struct frag_queue *fq;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 19c906f6efa1..a415ac610e2d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3,7 +3,7 @@
3 * FIB front-end. 3 * FIB front-end.
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $ 8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $
9 * 9 *
@@ -201,7 +201,7 @@ static void ip6_dst_destroy(struct dst_entry *dst)
201 if (idev != NULL) { 201 if (idev != NULL) {
202 rt->rt6i_idev = NULL; 202 rt->rt6i_idev = NULL;
203 in6_dev_put(idev); 203 in6_dev_put(idev);
204 } 204 }
205} 205}
206 206
207static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 207static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
@@ -243,7 +243,7 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt,
243 struct rt6_info *sprt; 243 struct rt6_info *sprt;
244 244
245 if (oif) { 245 if (oif) {
246 for (sprt = rt; sprt; sprt = sprt->u.next) { 246 for (sprt = rt; sprt; sprt = sprt->u.dst.rt6_next) {
247 struct net_device *dev = sprt->rt6i_dev; 247 struct net_device *dev = sprt->rt6i_dev;
248 if (dev->ifindex == oif) 248 if (dev->ifindex == oif)
249 return sprt; 249 return sprt;
@@ -252,7 +252,7 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt,
252 sprt->rt6i_idev->dev->ifindex != oif) { 252 sprt->rt6i_idev->dev->ifindex != oif) {
253 if (strict && oif) 253 if (strict && oif)
254 continue; 254 continue;
255 if (local && (!oif || 255 if (local && (!oif ||
256 local->rt6i_idev->dev->ifindex == oif)) 256 local->rt6i_idev->dev->ifindex == oif))
257 continue; 257 continue;
258 } 258 }
@@ -350,7 +350,7 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
350 int strict) 350 int strict)
351{ 351{
352 int m, n; 352 int m, n;
353 353
354 m = rt6_check_dev(rt, oif); 354 m = rt6_check_dev(rt, oif);
355 if (!m && (strict & RT6_LOOKUP_F_IFACE)) 355 if (!m && (strict & RT6_LOOKUP_F_IFACE))
356 return -1; 356 return -1;
@@ -376,7 +376,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
376 376
377 for (rt = rt0, metric = rt0->rt6i_metric; 377 for (rt = rt0, metric = rt0->rt6i_metric;
378 rt && rt->rt6i_metric == metric && (!last || rt != rt0); 378 rt && rt->rt6i_metric == metric && (!last || rt != rt0);
379 rt = rt->u.next) { 379 rt = rt->u.dst.rt6_next) {
380 int m; 380 int m;
381 381
382 if (rt6_check_expired(rt)) 382 if (rt6_check_expired(rt))
@@ -404,9 +404,9 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif,
404 /* no entries matched; do round-robin */ 404 /* no entries matched; do round-robin */
405 static DEFINE_SPINLOCK(lock); 405 static DEFINE_SPINLOCK(lock);
406 spin_lock(&lock); 406 spin_lock(&lock);
407 *head = rt0->u.next; 407 *head = rt0->u.dst.rt6_next;
408 rt0->u.next = last->u.next; 408 rt0->u.dst.rt6_next = last->u.dst.rt6_next;
409 last->u.next = rt0; 409 last->u.dst.rt6_next = rt0;
410 spin_unlock(&lock); 410 spin_unlock(&lock);
411 } 411 }
412 412
@@ -723,7 +723,7 @@ void ip6_route_input(struct sk_buff *skb)
723 .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK, 723 .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK,
724 }, 724 },
725 }, 725 },
726 .mark = skb->mark, 726 .mark = skb->mark,
727 .proto = iph->nexthdr, 727 .proto = iph->nexthdr,
728 }; 728 };
729 729
@@ -888,9 +888,9 @@ static inline unsigned int ipv6_advmss(unsigned int mtu)
888 mtu = ip6_rt_min_advmss; 888 mtu = ip6_rt_min_advmss;
889 889
890 /* 890 /*
891 * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and 891 * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and
892 * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. 892 * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
893 * IPV6_MAXPLEN is also valid and means: "any MSS, 893 * IPV6_MAXPLEN is also valid and means: "any MSS,
894 * rely only on pmtu discovery" 894 * rely only on pmtu discovery"
895 */ 895 */
896 if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr)) 896 if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
@@ -901,7 +901,7 @@ static inline unsigned int ipv6_advmss(unsigned int mtu)
901static struct dst_entry *ndisc_dst_gc_list; 901static struct dst_entry *ndisc_dst_gc_list;
902static DEFINE_SPINLOCK(ndisc_lock); 902static DEFINE_SPINLOCK(ndisc_lock);
903 903
904struct dst_entry *ndisc_dst_alloc(struct net_device *dev, 904struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
905 struct neighbour *neigh, 905 struct neighbour *neigh,
906 struct in6_addr *addr, 906 struct in6_addr *addr,
907 int (*output)(struct sk_buff *)) 907 int (*output)(struct sk_buff *))
@@ -934,8 +934,8 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
934 rt->u.dst.output = output; 934 rt->u.dst.output = output;
935 935
936#if 0 /* there's no chance to use these for ndisc */ 936#if 0 /* there's no chance to use these for ndisc */
937 rt->u.dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST 937 rt->u.dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST
938 ? DST_HOST 938 ? DST_HOST
939 : 0; 939 : 0;
940 ipv6_addr_copy(&rt->rt6i_dst.addr, addr); 940 ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
941 rt->rt6i_dst.plen = 128; 941 rt->rt6i_dst.plen = 128;
@@ -958,7 +958,7 @@ int ndisc_dst_gc(int *more)
958 int freed; 958 int freed;
959 959
960 next = NULL; 960 next = NULL;
961 freed = 0; 961 freed = 0;
962 962
963 spin_lock_bh(&ndisc_lock); 963 spin_lock_bh(&ndisc_lock);
964 pprev = &ndisc_dst_gc_list; 964 pprev = &ndisc_dst_gc_list;
@@ -1276,9 +1276,9 @@ static int ip6_route_del(struct fib6_config *cfg)
1276 fn = fib6_locate(&table->tb6_root, 1276 fn = fib6_locate(&table->tb6_root,
1277 &cfg->fc_dst, cfg->fc_dst_len, 1277 &cfg->fc_dst, cfg->fc_dst_len,
1278 &cfg->fc_src, cfg->fc_src_len); 1278 &cfg->fc_src, cfg->fc_src_len);
1279 1279
1280 if (fn) { 1280 if (fn) {
1281 for (rt = fn->leaf; rt; rt = rt->u.next) { 1281 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1282 if (cfg->fc_ifindex && 1282 if (cfg->fc_ifindex &&
1283 (rt->rt6i_dev == NULL || 1283 (rt->rt6i_dev == NULL ||
1284 rt->rt6i_dev->ifindex != cfg->fc_ifindex)) 1284 rt->rt6i_dev->ifindex != cfg->fc_ifindex))
@@ -1329,7 +1329,7 @@ static struct rt6_info *__ip6_route_redirect(struct fib6_table *table,
1329 read_lock_bh(&table->tb6_lock); 1329 read_lock_bh(&table->tb6_lock);
1330 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 1330 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
1331restart: 1331restart:
1332 for (rt = fn->leaf; rt; rt = rt->u.next) { 1332 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1333 /* 1333 /*
1334 * Current route is on-link; redirect is always invalid. 1334 * Current route is on-link; redirect is always invalid.
1335 * 1335 *
@@ -1405,7 +1405,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
1405 * We have finally decided to accept it. 1405 * We have finally decided to accept it.
1406 */ 1406 */
1407 1407
1408 neigh_update(neigh, lladdr, NUD_STALE, 1408 neigh_update(neigh, lladdr, NUD_STALE,
1409 NEIGH_UPDATE_F_WEAK_OVERRIDE| 1409 NEIGH_UPDATE_F_WEAK_OVERRIDE|
1410 NEIGH_UPDATE_F_OVERRIDE| 1410 NEIGH_UPDATE_F_OVERRIDE|
1411 (on_link ? 0 : (NEIGH_UPDATE_F_OVERRIDE_ISROUTER| 1411 (on_link ? 0 : (NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
@@ -1454,7 +1454,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
1454 } 1454 }
1455 1455
1456out: 1456out:
1457 dst_release(&rt->u.dst); 1457 dst_release(&rt->u.dst);
1458 return; 1458 return;
1459} 1459}
1460 1460
@@ -1478,7 +1478,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1478 1478
1479 if (pmtu < IPV6_MIN_MTU) { 1479 if (pmtu < IPV6_MIN_MTU) {
1480 /* 1480 /*
1481 * According to RFC2460, PMTU is set to the IPv6 Minimum Link 1481 * According to RFC2460, PMTU is set to the IPv6 Minimum Link
1482 * MTU (1280) and a fragment header should always be included 1482 * MTU (1280) and a fragment header should always be included
1483 * after a node receiving Too Big message reporting PMTU is 1483 * after a node receiving Too Big message reporting PMTU is
1484 * less than the IPv6 Minimum Link MTU. 1484 * less than the IPv6 Minimum Link MTU.
@@ -1590,7 +1590,7 @@ static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixle
1590 if (!fn) 1590 if (!fn)
1591 goto out; 1591 goto out;
1592 1592
1593 for (rt = fn->leaf; rt; rt = rt->u.next) { 1593 for (rt = fn->leaf; rt; rt = rt->u.dst.rt6_next) {
1594 if (rt->rt6i_dev->ifindex != ifindex) 1594 if (rt->rt6i_dev->ifindex != ifindex)
1595 continue; 1595 continue;
1596 if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY)) 1596 if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY))
@@ -1632,7 +1632,7 @@ static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixle
1632#endif 1632#endif
1633 1633
1634struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *dev) 1634struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *dev)
1635{ 1635{
1636 struct rt6_info *rt; 1636 struct rt6_info *rt;
1637 struct fib6_table *table; 1637 struct fib6_table *table;
1638 1638
@@ -1641,7 +1641,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d
1641 return NULL; 1641 return NULL;
1642 1642
1643 write_lock_bh(&table->tb6_lock); 1643 write_lock_bh(&table->tb6_lock);
1644 for (rt = table->tb6_root.leaf; rt; rt=rt->u.next) { 1644 for (rt = table->tb6_root.leaf; rt; rt=rt->u.dst.rt6_next) {
1645 if (dev == rt->rt6i_dev && 1645 if (dev == rt->rt6i_dev &&
1646 ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && 1646 ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
1647 ipv6_addr_equal(&rt->rt6i_gateway, addr)) 1647 ipv6_addr_equal(&rt->rt6i_gateway, addr))
@@ -1684,7 +1684,7 @@ void rt6_purge_dflt_routers(void)
1684 1684
1685restart: 1685restart:
1686 read_lock_bh(&table->tb6_lock); 1686 read_lock_bh(&table->tb6_lock);
1687 for (rt = table->tb6_root.leaf; rt; rt = rt->u.next) { 1687 for (rt = table->tb6_root.leaf; rt; rt = rt->u.dst.rt6_next) {
1688 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) { 1688 if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) {
1689 dst_hold(&rt->u.dst); 1689 dst_hold(&rt->u.dst);
1690 read_unlock_bh(&table->tb6_lock); 1690 read_unlock_bh(&table->tb6_lock);
@@ -1896,8 +1896,8 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
1896 */ 1896 */
1897 if (rt->rt6i_dev == arg->dev && 1897 if (rt->rt6i_dev == arg->dev &&
1898 !dst_metric_locked(&rt->u.dst, RTAX_MTU) && 1898 !dst_metric_locked(&rt->u.dst, RTAX_MTU) &&
1899 (dst_mtu(&rt->u.dst) > arg->mtu || 1899 (dst_mtu(&rt->u.dst) > arg->mtu ||
1900 (dst_mtu(&rt->u.dst) < arg->mtu && 1900 (dst_mtu(&rt->u.dst) < arg->mtu &&
1901 dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) 1901 dst_mtu(&rt->u.dst) == idev->cnf.mtu6)))
1902 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; 1902 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu;
1903 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu); 1903 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu);
@@ -2083,13 +2083,13 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2083 2083
2084 if (dst) { 2084 if (dst) {
2085 NLA_PUT(skb, RTA_DST, 16, dst); 2085 NLA_PUT(skb, RTA_DST, 16, dst);
2086 rtm->rtm_dst_len = 128; 2086 rtm->rtm_dst_len = 128;
2087 } else if (rtm->rtm_dst_len) 2087 } else if (rtm->rtm_dst_len)
2088 NLA_PUT(skb, RTA_DST, 16, &rt->rt6i_dst.addr); 2088 NLA_PUT(skb, RTA_DST, 16, &rt->rt6i_dst.addr);
2089#ifdef CONFIG_IPV6_SUBTREES 2089#ifdef CONFIG_IPV6_SUBTREES
2090 if (src) { 2090 if (src) {
2091 NLA_PUT(skb, RTA_SRC, 16, src); 2091 NLA_PUT(skb, RTA_SRC, 16, src);
2092 rtm->rtm_src_len = 128; 2092 rtm->rtm_src_len = 128;
2093 } else if (rtm->rtm_src_len) 2093 } else if (rtm->rtm_src_len)
2094 NLA_PUT(skb, RTA_SRC, 16, &rt->rt6i_src.addr); 2094 NLA_PUT(skb, RTA_SRC, 16, &rt->rt6i_src.addr);
2095#endif 2095#endif
@@ -2299,7 +2299,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
2299 arg->len += sprintf(arg->buffer + arg->len, 2299 arg->len += sprintf(arg->buffer + arg->len,
2300 " %08x %08x %08x %08x %8s\n", 2300 " %08x %08x %08x %08x %8s\n",
2301 rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), 2301 rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt),
2302 rt->u.dst.__use, rt->rt6i_flags, 2302 rt->u.dst.__use, rt->rt6i_flags,
2303 rt->rt6i_dev ? rt->rt6i_dev->name : ""); 2303 rt->rt6i_dev ? rt->rt6i_dev->name : "");
2304 return 0; 2304 return 0;
2305} 2305}
@@ -2371,91 +2371,91 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
2371} 2371}
2372 2372
2373ctl_table ipv6_route_table[] = { 2373ctl_table ipv6_route_table[] = {
2374 { 2374 {
2375 .ctl_name = NET_IPV6_ROUTE_FLUSH, 2375 .ctl_name = NET_IPV6_ROUTE_FLUSH,
2376 .procname = "flush", 2376 .procname = "flush",
2377 .data = &flush_delay, 2377 .data = &flush_delay,
2378 .maxlen = sizeof(int), 2378 .maxlen = sizeof(int),
2379 .mode = 0200, 2379 .mode = 0200,
2380 .proc_handler = &ipv6_sysctl_rtcache_flush 2380 .proc_handler = &ipv6_sysctl_rtcache_flush
2381 }, 2381 },
2382 { 2382 {
2383 .ctl_name = NET_IPV6_ROUTE_GC_THRESH, 2383 .ctl_name = NET_IPV6_ROUTE_GC_THRESH,
2384 .procname = "gc_thresh", 2384 .procname = "gc_thresh",
2385 .data = &ip6_dst_ops.gc_thresh, 2385 .data = &ip6_dst_ops.gc_thresh,
2386 .maxlen = sizeof(int), 2386 .maxlen = sizeof(int),
2387 .mode = 0644, 2387 .mode = 0644,
2388 .proc_handler = &proc_dointvec, 2388 .proc_handler = &proc_dointvec,
2389 }, 2389 },
2390 { 2390 {
2391 .ctl_name = NET_IPV6_ROUTE_MAX_SIZE, 2391 .ctl_name = NET_IPV6_ROUTE_MAX_SIZE,
2392 .procname = "max_size", 2392 .procname = "max_size",
2393 .data = &ip6_rt_max_size, 2393 .data = &ip6_rt_max_size,
2394 .maxlen = sizeof(int), 2394 .maxlen = sizeof(int),
2395 .mode = 0644, 2395 .mode = 0644,
2396 .proc_handler = &proc_dointvec, 2396 .proc_handler = &proc_dointvec,
2397 }, 2397 },
2398 { 2398 {
2399 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL, 2399 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL,
2400 .procname = "gc_min_interval", 2400 .procname = "gc_min_interval",
2401 .data = &ip6_rt_gc_min_interval, 2401 .data = &ip6_rt_gc_min_interval,
2402 .maxlen = sizeof(int), 2402 .maxlen = sizeof(int),
2403 .mode = 0644, 2403 .mode = 0644,
2404 .proc_handler = &proc_dointvec_jiffies, 2404 .proc_handler = &proc_dointvec_jiffies,
2405 .strategy = &sysctl_jiffies, 2405 .strategy = &sysctl_jiffies,
2406 }, 2406 },
2407 { 2407 {
2408 .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT, 2408 .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT,
2409 .procname = "gc_timeout", 2409 .procname = "gc_timeout",
2410 .data = &ip6_rt_gc_timeout, 2410 .data = &ip6_rt_gc_timeout,
2411 .maxlen = sizeof(int), 2411 .maxlen = sizeof(int),
2412 .mode = 0644, 2412 .mode = 0644,
2413 .proc_handler = &proc_dointvec_jiffies, 2413 .proc_handler = &proc_dointvec_jiffies,
2414 .strategy = &sysctl_jiffies, 2414 .strategy = &sysctl_jiffies,
2415 }, 2415 },
2416 { 2416 {
2417 .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL, 2417 .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL,
2418 .procname = "gc_interval", 2418 .procname = "gc_interval",
2419 .data = &ip6_rt_gc_interval, 2419 .data = &ip6_rt_gc_interval,
2420 .maxlen = sizeof(int), 2420 .maxlen = sizeof(int),
2421 .mode = 0644, 2421 .mode = 0644,
2422 .proc_handler = &proc_dointvec_jiffies, 2422 .proc_handler = &proc_dointvec_jiffies,
2423 .strategy = &sysctl_jiffies, 2423 .strategy = &sysctl_jiffies,
2424 }, 2424 },
2425 { 2425 {
2426 .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY, 2426 .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY,
2427 .procname = "gc_elasticity", 2427 .procname = "gc_elasticity",
2428 .data = &ip6_rt_gc_elasticity, 2428 .data = &ip6_rt_gc_elasticity,
2429 .maxlen = sizeof(int), 2429 .maxlen = sizeof(int),
2430 .mode = 0644, 2430 .mode = 0644,
2431 .proc_handler = &proc_dointvec_jiffies, 2431 .proc_handler = &proc_dointvec_jiffies,
2432 .strategy = &sysctl_jiffies, 2432 .strategy = &sysctl_jiffies,
2433 }, 2433 },
2434 { 2434 {
2435 .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES, 2435 .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES,
2436 .procname = "mtu_expires", 2436 .procname = "mtu_expires",
2437 .data = &ip6_rt_mtu_expires, 2437 .data = &ip6_rt_mtu_expires,
2438 .maxlen = sizeof(int), 2438 .maxlen = sizeof(int),
2439 .mode = 0644, 2439 .mode = 0644,
2440 .proc_handler = &proc_dointvec_jiffies, 2440 .proc_handler = &proc_dointvec_jiffies,
2441 .strategy = &sysctl_jiffies, 2441 .strategy = &sysctl_jiffies,
2442 }, 2442 },
2443 { 2443 {
2444 .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS, 2444 .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS,
2445 .procname = "min_adv_mss", 2445 .procname = "min_adv_mss",
2446 .data = &ip6_rt_min_advmss, 2446 .data = &ip6_rt_min_advmss,
2447 .maxlen = sizeof(int), 2447 .maxlen = sizeof(int),
2448 .mode = 0644, 2448 .mode = 0644,
2449 .proc_handler = &proc_dointvec_jiffies, 2449 .proc_handler = &proc_dointvec_jiffies,
2450 .strategy = &sysctl_jiffies, 2450 .strategy = &sysctl_jiffies,
2451 }, 2451 },
2452 { 2452 {
2453 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, 2453 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
2454 .procname = "gc_min_interval_ms", 2454 .procname = "gc_min_interval_ms",
2455 .data = &ip6_rt_gc_min_interval, 2455 .data = &ip6_rt_gc_min_interval,
2456 .maxlen = sizeof(int), 2456 .maxlen = sizeof(int),
2457 .mode = 0644, 2457 .mode = 0644,
2458 .proc_handler = &proc_dointvec_ms_jiffies, 2458 .proc_handler = &proc_dointvec_ms_jiffies,
2459 .strategy = &sysctl_ms_jiffies, 2459 .strategy = &sysctl_ms_jiffies,
2460 }, 2460 },
2461 { .ctl_name = 0 } 2461 { .ctl_name = 0 }
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 47cfeadac6dd..4d3cf301e1fc 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -3,7 +3,7 @@
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * 8 *
9 * $Id: sit.c,v 1.53 2001/09/25 05:09:53 davem Exp $ 9 * $Id: sit.c,v 1.53 2001/09/25 05:09:53 davem Exp $
@@ -410,7 +410,7 @@ static inline __be32 try_6to4(struct in6_addr *v6dst)
410 __be32 dst = 0; 410 __be32 dst = 0;
411 411
412 if (v6dst->s6_addr16[0] == htons(0x2002)) { 412 if (v6dst->s6_addr16[0] == htons(0x2002)) {
413 /* 6to4 v6 addr has 16 bits prefix, 32 v4addr, 16 SLA, ... */ 413 /* 6to4 v6 addr has 16 bits prefix, 32 v4addr, 16 SLA, ... */
414 memcpy(&dst, &v6dst->s6_addr16[1], 4); 414 memcpy(&dst, &v6dst->s6_addr16[1], 4);
415 } 415 }
416 return dst; 416 return dst;
@@ -434,7 +434,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
434 int max_headroom; /* The extra header space needed */ 434 int max_headroom; /* The extra header space needed */
435 __be32 dst = tiph->daddr; 435 __be32 dst = tiph->daddr;
436 int mtu; 436 int mtu;
437 struct in6_addr *addr6; 437 struct in6_addr *addr6;
438 int addr_type; 438 int addr_type;
439 439
440 if (tunnel->recursion++) { 440 if (tunnel->recursion++) {
@@ -537,7 +537,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
537 struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); 537 struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
538 if (!new_skb) { 538 if (!new_skb) {
539 ip_rt_put(rt); 539 ip_rt_put(rt);
540 stats->tx_dropped++; 540 stats->tx_dropped++;
541 dev_kfree_skb(skb); 541 dev_kfree_skb(skb);
542 tunnel->recursion--; 542 tunnel->recursion--;
543 return 0; 543 return 0;
@@ -831,7 +831,7 @@ static int __init sit_init(void)
831 return -EAGAIN; 831 return -EAGAIN;
832 } 832 }
833 833
834 ipip6_fb_tunnel_dev = alloc_netdev(sizeof(struct ip_tunnel), "sit0", 834 ipip6_fb_tunnel_dev = alloc_netdev(sizeof(struct ip_tunnel), "sit0",
835 ipip6_tunnel_setup); 835 ipip6_tunnel_setup);
836 if (!ipip6_fb_tunnel_dev) { 836 if (!ipip6_fb_tunnel_dev) {
837 err = -ENOMEM; 837 err = -ENOMEM;
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 7a4639db1346..25e8e7783fee 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -92,7 +92,7 @@ static ctl_table ipv6_net_table[] = {
92 .mode = 0555, 92 .mode = 0555,
93 .child = ipv6_table 93 .child = ipv6_table
94 }, 94 },
95 { .ctl_name = 0 } 95 { .ctl_name = 0 }
96}; 96};
97 97
98static ctl_table ipv6_root_table[] = { 98static ctl_table ipv6_root_table[] = {
@@ -102,7 +102,7 @@ static ctl_table ipv6_root_table[] = {
102 .mode = 0555, 102 .mode = 0555,
103 .child = ipv6_net_table 103 .child = ipv6_net_table
104 }, 104 },
105 { .ctl_name = 0 } 105 { .ctl_name = 0 }
106}; 106};
107 107
108void ipv6_sysctl_register(void) 108void ipv6_sysctl_register(void)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index dcb7b00a737d..f57a9baa6b27 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * TCP over IPv6 2 * TCP over IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: tcp_ipv6.c,v 1.144 2002/02/01 22:01:04 davem Exp $ 8 * $Id: tcp_ipv6.c,v 1.144 2002/02/01 22:01:04 davem Exp $
9 * 9 *
10 * Based on: 10 * Based on:
11 * linux/net/ipv4/tcp.c 11 * linux/net/ipv4/tcp.c
12 * linux/net/ipv4/tcp_input.c 12 * linux/net/ipv4/tcp_input.c
13 * linux/net/ipv4/tcp_output.c 13 * linux/net/ipv4/tcp_output.c
@@ -74,7 +74,7 @@ static struct socket *tcp6_socket;
74 74
75static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); 75static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
76static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); 76static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
77static void tcp_v6_send_check(struct sock *sk, int len, 77static void tcp_v6_send_check(struct sock *sk, int len,
78 struct sk_buff *skb); 78 struct sk_buff *skb);
79 79
80static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); 80static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
@@ -106,8 +106,8 @@ static void tcp_v6_hash(struct sock *sk)
106} 106}
107 107
108static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len, 108static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
109 struct in6_addr *saddr, 109 struct in6_addr *saddr,
110 struct in6_addr *daddr, 110 struct in6_addr *daddr,
111 __wsum base) 111 __wsum base)
112{ 112{
113 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base); 113 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_TCP, base);
@@ -121,11 +121,11 @@ static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
121 skb->h.th->source); 121 skb->h.th->source);
122} 122}
123 123
124static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, 124static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
125 int addr_len) 125 int addr_len)
126{ 126{
127 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; 127 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
128 struct inet_sock *inet = inet_sk(sk); 128 struct inet_sock *inet = inet_sk(sk);
129 struct inet_connection_sock *icsk = inet_csk(sk); 129 struct inet_connection_sock *icsk = inet_csk(sk);
130 struct ipv6_pinfo *np = inet6_sk(sk); 130 struct ipv6_pinfo *np = inet6_sk(sk);
131 struct tcp_sock *tp = tcp_sk(sk); 131 struct tcp_sock *tp = tcp_sk(sk);
@@ -135,10 +135,10 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
135 int addr_type; 135 int addr_type;
136 int err; 136 int err;
137 137
138 if (addr_len < SIN6_LEN_RFC2133) 138 if (addr_len < SIN6_LEN_RFC2133)
139 return -EINVAL; 139 return -EINVAL;
140 140
141 if (usin->sin6_family != AF_INET6) 141 if (usin->sin6_family != AF_INET6)
142 return(-EAFNOSUPPORT); 142 return(-EAFNOSUPPORT);
143 143
144 memset(&fl, 0, sizeof(fl)); 144 memset(&fl, 0, sizeof(fl));
@@ -157,11 +157,11 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
157 } 157 }
158 158
159 /* 159 /*
160 * connect() to INADDR_ANY means loopback (BSD'ism). 160 * connect() to INADDR_ANY means loopback (BSD'ism).
161 */ 161 */
162 162
163 if(ipv6_addr_any(&usin->sin6_addr)) 163 if(ipv6_addr_any(&usin->sin6_addr))
164 usin->sin6_addr.s6_addr[15] = 0x1; 164 usin->sin6_addr.s6_addr[15] = 0x1;
165 165
166 addr_type = ipv6_addr_type(&usin->sin6_addr); 166 addr_type = ipv6_addr_type(&usin->sin6_addr);
167 167
@@ -323,7 +323,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
323 struct ipv6_pinfo *np; 323 struct ipv6_pinfo *np;
324 struct sock *sk; 324 struct sock *sk;
325 int err; 325 int err;
326 struct tcp_sock *tp; 326 struct tcp_sock *tp;
327 __u32 seq; 327 __u32 seq;
328 328
329 sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, 329 sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr,
@@ -347,7 +347,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
347 goto out; 347 goto out;
348 348
349 tp = tcp_sk(sk); 349 tp = tcp_sk(sk);
350 seq = ntohl(th->seq); 350 seq = ntohl(th->seq);
351 if (sk->sk_state != TCP_LISTEN && 351 if (sk->sk_state != TCP_LISTEN &&
352 !between(seq, tp->snd_una, tp->snd_nxt)) { 352 !between(seq, tp->snd_una, tp->snd_nxt)) {
353 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS); 353 NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
@@ -434,7 +434,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
434 434
435 case TCP_SYN_SENT: 435 case TCP_SYN_SENT:
436 case TCP_SYN_RECV: /* Cannot happen. 436 case TCP_SYN_RECV: /* Cannot happen.
437 It can, it SYNs are crossed. --ANK */ 437 It can, it SYNs are crossed. --ANK */
438 if (!sock_owned_by_user(sk)) { 438 if (!sock_owned_by_user(sk)) {
439 sk->sk_err = err; 439 sk->sk_err = err;
440 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ 440 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */
@@ -519,7 +519,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
519 } 519 }
520 520
521done: 521done:
522 if (opt && opt != np->opt) 522 if (opt && opt != np->opt)
523 sock_kfree_s(sk, opt, opt->tot_len); 523 sock_kfree_s(sk, opt, opt->tot_len);
524 dst_release(dst); 524 dst_release(dst);
525 return err; 525 return err;
@@ -950,8 +950,8 @@ static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb)
950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); 950 th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0);
951 skb->csum_offset = offsetof(struct tcphdr, check); 951 skb->csum_offset = offsetof(struct tcphdr, check);
952 } else { 952 } else {
953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 953 th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP,
954 csum_partial((char *)th, th->doff<<2, 954 csum_partial((char *)th, th->doff<<2,
955 skb->csum)); 955 skb->csum));
956 } 956 }
957} 957}
@@ -977,7 +977,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
977 977
978static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) 978static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
979{ 979{
980 struct tcphdr *th = skb->h.th, *t1; 980 struct tcphdr *th = skb->h.th, *t1;
981 struct sk_buff *buff; 981 struct sk_buff *buff;
982 struct flowi fl; 982 struct flowi fl;
983 int tot_len = sizeof(*th); 983 int tot_len = sizeof(*th);
@@ -989,7 +989,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
989 return; 989 return;
990 990
991 if (!ipv6_unicast_destination(skb)) 991 if (!ipv6_unicast_destination(skb))
992 return; 992 return;
993 993
994#ifdef CONFIG_TCP_MD5SIG 994#ifdef CONFIG_TCP_MD5SIG
995 if (sk) 995 if (sk)
@@ -1008,8 +1008,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1008 1008
1009 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len, 1009 buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
1010 GFP_ATOMIC); 1010 GFP_ATOMIC);
1011 if (buff == NULL) 1011 if (buff == NULL)
1012 return; 1012 return;
1013 1013
1014 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); 1014 skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
1015 1015
@@ -1021,9 +1021,9 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1021 t1->source = th->dest; 1021 t1->source = th->dest;
1022 t1->doff = tot_len / 4; 1022 t1->doff = tot_len / 4;
1023 t1->rst = 1; 1023 t1->rst = 1;
1024 1024
1025 if(th->ack) { 1025 if(th->ack) {
1026 t1->seq = th->ack_seq; 1026 t1->seq = th->ack_seq;
1027 } else { 1027 } else {
1028 t1->ack = 1; 1028 t1->ack = 1;
1029 t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin 1029 t1->ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin
@@ -1128,7 +1128,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
1128 t1->window = htons(win); 1128 t1->window = htons(win);
1129 1129
1130 topt = (__be32 *)(t1 + 1); 1130 topt = (__be32 *)(t1 + 1);
1131 1131
1132 if (ts) { 1132 if (ts) {
1133 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 1133 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1134 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); 1134 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
@@ -1243,15 +1243,15 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1243 return tcp_v4_conn_request(sk, skb); 1243 return tcp_v4_conn_request(sk, skb);
1244 1244
1245 if (!ipv6_unicast_destination(skb)) 1245 if (!ipv6_unicast_destination(skb))
1246 goto drop; 1246 goto drop;
1247 1247
1248 /* 1248 /*
1249 * There are no SYN attacks on IPv6, yet... 1249 * There are no SYN attacks on IPv6, yet...
1250 */ 1250 */
1251 if (inet_csk_reqsk_queue_is_full(sk) && !isn) { 1251 if (inet_csk_reqsk_queue_is_full(sk) && !isn) {
1252 if (net_ratelimit()) 1252 if (net_ratelimit())
1253 printk(KERN_INFO "TCPv6: dropping request, synflood is possible\n"); 1253 printk(KERN_INFO "TCPv6: dropping request, synflood is possible\n");
1254 goto drop; 1254 goto drop;
1255 } 1255 }
1256 1256
1257 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) 1257 if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
@@ -1292,7 +1292,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1292 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) 1292 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1293 treq->iif = inet6_iif(skb); 1293 treq->iif = inet6_iif(skb);
1294 1294
1295 if (isn == 0) 1295 if (isn == 0)
1296 isn = tcp_v6_init_sequence(skb); 1296 isn = tcp_v6_init_sequence(skb);
1297 1297
1298 tcp_rsk(req)->snt_isn = isn; 1298 tcp_rsk(req)->snt_isn = isn;
@@ -1334,7 +1334,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1334 1334
1335 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst); 1335 newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst);
1336 1336
1337 if (newsk == NULL) 1337 if (newsk == NULL)
1338 return NULL; 1338 return NULL;
1339 1339
1340 newtcp6sk = (struct tcp6_sock *)newsk; 1340 newtcp6sk = (struct tcp6_sock *)newsk;
@@ -1419,7 +1419,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1419 1419
1420 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0) 1420 if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0)
1421 goto out; 1421 goto out;
1422 } 1422 }
1423 1423
1424 newsk = tcp_create_openreq_child(sk, req, skb); 1424 newsk = tcp_create_openreq_child(sk, req, skb);
1425 if (newsk == NULL) 1425 if (newsk == NULL)
@@ -1448,7 +1448,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1448 ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr); 1448 ipv6_addr_copy(&newnp->rcv_saddr, &treq->loc_addr);
1449 newsk->sk_bound_dev_if = treq->iif; 1449 newsk->sk_bound_dev_if = treq->iif;
1450 1450
1451 /* Now IPv6 options... 1451 /* Now IPv6 options...
1452 1452
1453 First: no IPv4 options. 1453 First: no IPv4 options.
1454 */ 1454 */
@@ -1592,7 +1592,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1592 looks not very well thought. For now we latch 1592 looks not very well thought. For now we latch
1593 options, received in the last packet, enqueued 1593 options, received in the last packet, enqueued
1594 by tcp. Feel free to propose better solution. 1594 by tcp. Feel free to propose better solution.
1595 --ANK (980728) 1595 --ANK (980728)
1596 */ 1596 */
1597 if (np->rxopt.all) 1597 if (np->rxopt.all)
1598 opt_skb = skb_clone(skb, GFP_ATOMIC); 1598 opt_skb = skb_clone(skb, GFP_ATOMIC);
@@ -1610,7 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1610 if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb)) 1610 if (skb->len < (skb->h.th->doff<<2) || tcp_checksum_complete(skb))
1611 goto csum_err; 1611 goto csum_err;
1612 1612
1613 if (sk->sk_state == TCP_LISTEN) { 1613 if (sk->sk_state == TCP_LISTEN) {
1614 struct sock *nsk = tcp_v6_hnd_req(sk, skb); 1614 struct sock *nsk = tcp_v6_hnd_req(sk, skb);
1615 if (!nsk) 1615 if (!nsk)
1616 goto discard; 1616 goto discard;
@@ -1620,7 +1620,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1620 * otherwise we just shortcircuit this and continue with 1620 * otherwise we just shortcircuit this and continue with
1621 * the new socket.. 1621 * the new socket..
1622 */ 1622 */
1623 if(nsk != sk) { 1623 if(nsk != sk) {
1624 if (tcp_child_process(sk, nsk, skb)) 1624 if (tcp_child_process(sk, nsk, skb))
1625 goto reset; 1625 goto reset;
1626 if (opt_skb) 1626 if (opt_skb)
@@ -1681,7 +1681,7 @@ ipv6_pktoptions:
1681static int tcp_v6_rcv(struct sk_buff **pskb) 1681static int tcp_v6_rcv(struct sk_buff **pskb)
1682{ 1682{
1683 struct sk_buff *skb = *pskb; 1683 struct sk_buff *skb = *pskb;
1684 struct tcphdr *th; 1684 struct tcphdr *th;
1685 struct sock *sk; 1685 struct sock *sk;
1686 int ret; 1686 int ret;
1687 1687
@@ -1739,10 +1739,10 @@ process:
1739 ret = 0; 1739 ret = 0;
1740 if (!sock_owned_by_user(sk)) { 1740 if (!sock_owned_by_user(sk)) {
1741#ifdef CONFIG_NET_DMA 1741#ifdef CONFIG_NET_DMA
1742 struct tcp_sock *tp = tcp_sk(sk); 1742 struct tcp_sock *tp = tcp_sk(sk);
1743 if (tp->ucopy.dma_chan) 1743 if (tp->ucopy.dma_chan)
1744 ret = tcp_v6_do_rcv(sk, skb); 1744 ret = tcp_v6_do_rcv(sk, skb);
1745 else 1745 else
1746#endif 1746#endif
1747 { 1747 {
1748 if (!tcp_prequeue(sk, skb)) 1748 if (!tcp_prequeue(sk, skb))
@@ -1945,7 +1945,7 @@ static int tcp_v6_destroy_sock(struct sock *sk)
1945} 1945}
1946 1946
1947/* Proc filesystem TCPv6 sock list dumping. */ 1947/* Proc filesystem TCPv6 sock list dumping. */
1948static void get_openreq6(struct seq_file *seq, 1948static void get_openreq6(struct seq_file *seq,
1949 struct sock *sk, struct request_sock *req, int i, int uid) 1949 struct sock *sk, struct request_sock *req, int i, int uid)
1950{ 1950{
1951 int ttd = req->expires - jiffies; 1951 int ttd = req->expires - jiffies;
@@ -1967,11 +1967,11 @@ static void get_openreq6(struct seq_file *seq,
1967 ntohs(inet_rsk(req)->rmt_port), 1967 ntohs(inet_rsk(req)->rmt_port),
1968 TCP_SYN_RECV, 1968 TCP_SYN_RECV,
1969 0,0, /* could print option size, but that is af dependent. */ 1969 0,0, /* could print option size, but that is af dependent. */
1970 1, /* timers active (only the expire timer) */ 1970 1, /* timers active (only the expire timer) */
1971 jiffies_to_clock_t(ttd), 1971 jiffies_to_clock_t(ttd),
1972 req->retrans, 1972 req->retrans,
1973 uid, 1973 uid,
1974 0, /* non standard timer */ 1974 0, /* non standard timer */
1975 0, /* open_requests have no inode */ 1975 0, /* open_requests have no inode */
1976 0, req); 1976 0, req);
1977} 1977}
@@ -2014,7 +2014,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2014 src->s6_addr32[2], src->s6_addr32[3], srcp, 2014 src->s6_addr32[2], src->s6_addr32[3], srcp,
2015 dest->s6_addr32[0], dest->s6_addr32[1], 2015 dest->s6_addr32[0], dest->s6_addr32[1],
2016 dest->s6_addr32[2], dest->s6_addr32[3], destp, 2016 dest->s6_addr32[2], dest->s6_addr32[3], destp,
2017 sp->sk_state, 2017 sp->sk_state,
2018 tp->write_seq-tp->snd_una, 2018 tp->write_seq-tp->snd_una,
2019 (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), 2019 (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq),
2020 timer_active, 2020 timer_active,
@@ -2031,7 +2031,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
2031 ); 2031 );
2032} 2032}
2033 2033
2034static void get_timewait6_sock(struct seq_file *seq, 2034static void get_timewait6_sock(struct seq_file *seq,
2035 struct inet_timewait_sock *tw, int i) 2035 struct inet_timewait_sock *tw, int i)
2036{ 2036{
2037 struct in6_addr *dest, *src; 2037 struct in6_addr *dest, *src;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 15e5195549cb..ccf2f4d196be 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * UDP over IPv6 2 * UDP over IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * Based on linux/ipv4/udp.c 8 * Based on linux/ipv4/udp.c
9 * 9 *
@@ -67,11 +67,11 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
67 unsigned short hnum = ntohs(dport); 67 unsigned short hnum = ntohs(dport);
68 int badness = -1; 68 int badness = -1;
69 69
70 read_lock(&udp_hash_lock); 70 read_lock(&udp_hash_lock);
71 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { 71 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
72 struct inet_sock *inet = inet_sk(sk); 72 struct inet_sock *inet = inet_sk(sk);
73 73
74 if (inet->num == hnum && sk->sk_family == PF_INET6) { 74 if (sk->sk_hash == hnum && sk->sk_family == PF_INET6) {
75 struct ipv6_pinfo *np = inet6_sk(sk); 75 struct ipv6_pinfo *np = inet6_sk(sk);
76 int score = 0; 76 int score = 0;
77 if (inet->dport) { 77 if (inet->dport) {
@@ -105,7 +105,7 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
105 } 105 }
106 if (result) 106 if (result)
107 sock_hold(result); 107 sock_hold(result);
108 read_unlock(&udp_hash_lock); 108 read_unlock(&udp_hash_lock);
109 return result; 109 return result;
110} 110}
111 111
@@ -120,13 +120,13 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
120{ 120{
121 struct ipv6_pinfo *np = inet6_sk(sk); 121 struct ipv6_pinfo *np = inet6_sk(sk);
122 struct inet_sock *inet = inet_sk(sk); 122 struct inet_sock *inet = inet_sk(sk);
123 struct sk_buff *skb; 123 struct sk_buff *skb;
124 size_t copied; 124 size_t copied;
125 int err, copy_only, is_udplite = IS_UDPLITE(sk); 125 int err, copy_only, is_udplite = IS_UDPLITE(sk);
126 126
127 if (addr_len) 127 if (addr_len)
128 *addr_len=sizeof(struct sockaddr_in6); 128 *addr_len=sizeof(struct sockaddr_in6);
129 129
130 if (flags & MSG_ERRQUEUE) 130 if (flags & MSG_ERRQUEUE)
131 return ipv6_recv_error(sk, msg, len); 131 return ipv6_recv_error(sk, msg, len);
132 132
@@ -135,11 +135,11 @@ try_again:
135 if (!skb) 135 if (!skb)
136 goto out; 136 goto out;
137 137
138 copied = skb->len - sizeof(struct udphdr); 138 copied = skb->len - sizeof(struct udphdr);
139 if (copied > len) { 139 if (copied > len) {
140 copied = len; 140 copied = len;
141 msg->msg_flags |= MSG_TRUNC; 141 msg->msg_flags |= MSG_TRUNC;
142 } 142 }
143 143
144 /* 144 /*
145 * Decide whether to checksum and/or copy data. 145 * Decide whether to checksum and/or copy data.
@@ -168,7 +168,7 @@ try_again:
168 /* Copy the address. */ 168 /* Copy the address. */
169 if (msg->msg_name) { 169 if (msg->msg_name) {
170 struct sockaddr_in6 *sin6; 170 struct sockaddr_in6 *sin6;
171 171
172 sin6 = (struct sockaddr_in6 *) msg->msg_name; 172 sin6 = (struct sockaddr_in6 *) msg->msg_name;
173 sin6->sin6_family = AF_INET6; 173 sin6->sin6_family = AF_INET6;
174 sin6->sin6_port = skb->h.uh->source; 174 sin6->sin6_port = skb->h.uh->source;
@@ -191,7 +191,7 @@ try_again:
191 } else { 191 } else {
192 if (np->rxopt.all) 192 if (np->rxopt.all)
193 datagram_recv_ctl(sk, msg, skb); 193 datagram_recv_ctl(sk, msg, skb);
194 } 194 }
195 195
196 err = copied; 196 err = copied;
197 if (flags & MSG_TRUNC) 197 if (flags & MSG_TRUNC)
@@ -309,7 +309,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
309 sk_for_each_from(s, node) { 309 sk_for_each_from(s, node) {
310 struct inet_sock *inet = inet_sk(s); 310 struct inet_sock *inet = inet_sk(s);
311 311
312 if (inet->num == num && s->sk_family == PF_INET6) { 312 if (s->sk_hash == num && s->sk_family == PF_INET6) {
313 struct ipv6_pinfo *np = inet6_sk(s); 313 struct ipv6_pinfo *np = inet6_sk(s);
314 if (inet->dport) { 314 if (inet->dport) {
315 if (inet->dport != rmt_port) 315 if (inet->dport != rmt_port)
@@ -339,7 +339,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
339 * so we don't need to lock the hashes. 339 * so we don't need to lock the hashes.
340 */ 340 */
341static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr, 341static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
342 struct in6_addr *daddr, struct hlist_head udptable[]) 342 struct in6_addr *daddr, struct hlist_head udptable[])
343{ 343{
344 struct sock *sk, *sk2; 344 struct sock *sk, *sk2;
345 const struct udphdr *uh = skb->h.uh; 345 const struct udphdr *uh = skb->h.uh;
@@ -379,7 +379,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh)
379 } 379 }
380 if (skb->ip_summed == CHECKSUM_COMPLETE && 380 if (skb->ip_summed == CHECKSUM_COMPLETE &&
381 !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, 381 !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
382 skb->len, IPPROTO_UDP, skb->csum )) 382 skb->len, IPPROTO_UDP, skb->csum ))
383 skb->ip_summed = CHECKSUM_UNNECESSARY; 383 skb->ip_summed = CHECKSUM_UNNECESSARY;
384 384
385 if (skb->ip_summed != CHECKSUM_UNNECESSARY) 385 if (skb->ip_summed != CHECKSUM_UNNECESSARY)
@@ -396,7 +396,7 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
396{ 396{
397 struct sk_buff *skb = *pskb; 397 struct sk_buff *skb = *pskb;
398 struct sock *sk; 398 struct sock *sk;
399 struct udphdr *uh; 399 struct udphdr *uh;
400 struct net_device *dev = skb->dev; 400 struct net_device *dev = skb->dev;
401 struct in6_addr *saddr, *daddr; 401 struct in6_addr *saddr, *daddr;
402 u32 ulen = 0; 402 u32 ulen = 0;
@@ -437,15 +437,15 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
437 goto discard; 437 goto discard;
438 } 438 }
439 439
440 /* 440 /*
441 * Multicast receive code 441 * Multicast receive code
442 */ 442 */
443 if (ipv6_addr_is_multicast(daddr)) 443 if (ipv6_addr_is_multicast(daddr))
444 return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable); 444 return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable);
445 445
446 /* Unicast */ 446 /* Unicast */
447 447
448 /* 448 /*
449 * check socket cache ... must talk to Alan about his plans 449 * check socket cache ... must talk to Alan about his plans
450 * for sock caches... i'll skip this for now. 450 * for sock caches... i'll skip this for now.
451 */ 451 */
@@ -465,21 +465,21 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
465 kfree_skb(skb); 465 kfree_skb(skb);
466 return(0); 466 return(0);
467 } 467 }
468 468
469 /* deliver */ 469 /* deliver */
470 470
471 udpv6_queue_rcv_skb(sk, skb); 471 udpv6_queue_rcv_skb(sk, skb);
472 sock_put(sk); 472 sock_put(sk);
473 return(0); 473 return(0);
474 474
475short_packet: 475short_packet:
476 LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n", 476 LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n",
477 is_udplite? "-Lite" : "", ulen, skb->len); 477 is_udplite? "-Lite" : "", ulen, skb->len);
478 478
479discard: 479discard:
480 UDP6_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite); 480 UDP6_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite);
481 kfree_skb(skb); 481 kfree_skb(skb);
482 return(0); 482 return(0);
483} 483}
484 484
485static __inline__ int udpv6_rcv(struct sk_buff **pskb) 485static __inline__ int udpv6_rcv(struct sk_buff **pskb)
@@ -498,7 +498,7 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
498 up->len = 0; 498 up->len = 0;
499 up->pending = 0; 499 up->pending = 0;
500 ip6_flush_pending_frames(sk); 500 ip6_flush_pending_frames(sk);
501 } 501 }
502} 502}
503 503
504/* 504/*
@@ -594,7 +594,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
594 if (sk->sk_state != TCP_ESTABLISHED) 594 if (sk->sk_state != TCP_ESTABLISHED)
595 return -EDESTADDRREQ; 595 return -EDESTADDRREQ;
596 daddr = &np->daddr; 596 daddr = &np->daddr;
597 } else 597 } else
598 daddr = NULL; 598 daddr = NULL;
599 599
600 if (daddr) { 600 if (daddr) {
@@ -620,7 +620,7 @@ do_udp_sendmsg:
620 */ 620 */
621 if (len > INT_MAX - sizeof(struct udphdr)) 621 if (len > INT_MAX - sizeof(struct udphdr))
622 return -EMSGSIZE; 622 return -EMSGSIZE;
623 623
624 if (up->pending) { 624 if (up->pending) {
625 /* 625 /*
626 * There are pending frames. 626 * There are pending frames.
@@ -713,7 +713,7 @@ do_udp_sendmsg:
713 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 713 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
714 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 714 ipv6_addr_copy(&fl.fl6_src, &np->saddr);
715 fl.fl_ip_sport = inet->sport; 715 fl.fl_ip_sport = inet->sport;
716 716
717 /* merge ip6_build_xmit from ip6_output */ 717 /* merge ip6_build_xmit from ip6_output */
718 if (opt && opt->srcrt) { 718 if (opt && opt->srcrt) {
719 struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt; 719 struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
@@ -911,7 +911,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket
911 src->s6_addr32[2], src->s6_addr32[3], srcp, 911 src->s6_addr32[2], src->s6_addr32[3], srcp,
912 dest->s6_addr32[0], dest->s6_addr32[1], 912 dest->s6_addr32[0], dest->s6_addr32[1],
913 dest->s6_addr32[2], dest->s6_addr32[3], destp, 913 dest->s6_addr32[2], dest->s6_addr32[3], destp,
914 sp->sk_state, 914 sp->sk_state,
915 atomic_read(&sp->sk_wmem_alloc), 915 atomic_read(&sp->sk_wmem_alloc),
916 atomic_read(&sp->sk_rmem_alloc), 916 atomic_read(&sp->sk_rmem_alloc),
917 0, 0L, 0, 917 0, 0L, 0,
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index ec9878899128..6e252f318f7c 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -11,9 +11,9 @@ extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *,
11 int , int , int , __be32 , struct hlist_head []); 11 int , int , int , __be32 , struct hlist_head []);
12 12
13extern int udpv6_getsockopt(struct sock *sk, int level, int optname, 13extern int udpv6_getsockopt(struct sock *sk, int level, int optname,
14 char __user *optval, int __user *optlen); 14 char __user *optval, int __user *optlen);
15extern int udpv6_setsockopt(struct sock *sk, int level, int optname, 15extern int udpv6_setsockopt(struct sock *sk, int level, int optname,
16 char __user *optval, int optlen); 16 char __user *optval, int optlen);
17#ifdef CONFIG_COMPAT 17#ifdef CONFIG_COMPAT
18extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 18extern int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
19 char __user *optval, int optlen); 19 char __user *optval, int optlen);
@@ -24,7 +24,7 @@ extern int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
24 struct msghdr *msg, size_t len); 24 struct msghdr *msg, size_t len);
25extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, 25extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
26 struct msghdr *msg, size_t len, 26 struct msghdr *msg, size_t len,
27 int noblock, int flags, int *addr_len); 27 int noblock, int flags, int *addr_len);
28extern int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb); 28extern int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb);
29extern int udpv6_destroy_sock(struct sock *sk); 29extern int udpv6_destroy_sock(struct sock *sk);
30 30
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 5c8b7a568800..25250147bdc3 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -33,7 +33,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
33 seq = 0; 33 seq = 0;
34 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) 34 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0)
35 goto drop; 35 goto drop;
36 36
37 do { 37 do {
38 struct ipv6hdr *iph = skb->nh.ipv6h; 38 struct ipv6hdr *iph = skb->nh.ipv6h;
39 39
@@ -115,7 +115,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
115 __skb_push(skb, skb->data - skb->nh.raw); 115 __skb_push(skb, skb->data - skb->nh.raw);
116 116
117 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, 117 NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
118 ip6_rcv_finish); 118 ip6_rcv_finish);
119 return -1; 119 return -1;
120#else 120#else
121 return 1; 121 return 1;
@@ -142,12 +142,12 @@ int xfrm6_rcv(struct sk_buff **pskb)
142int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 142int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
143 xfrm_address_t *saddr, u8 proto) 143 xfrm_address_t *saddr, u8 proto)
144{ 144{
145 struct xfrm_state *x = NULL; 145 struct xfrm_state *x = NULL;
146 int wildcard = 0; 146 int wildcard = 0;
147 struct in6_addr any; 147 struct in6_addr any;
148 xfrm_address_t *xany; 148 xfrm_address_t *xany;
149 struct xfrm_state *xfrm_vec_one = NULL; 149 struct xfrm_state *xfrm_vec_one = NULL;
150 int nh = 0; 150 int nh = 0;
151 int i = 0; 151 int i = 0;
152 152
153 ipv6_addr_set(&any, 0, 0, 0, 0); 153 ipv6_addr_set(&any, 0, 0, 0, 0);
@@ -168,12 +168,12 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
168 break; 168 break;
169 case 2: 169 case 2:
170 default: 170 default:
171 /* lookup state with wild-card addresses */ 171 /* lookup state with wild-card addresses */
172 wildcard = 1; /* XXX */ 172 wildcard = 1; /* XXX */
173 dst = xany; 173 dst = xany;
174 src = xany; 174 src = xany;
175 break; 175 break;
176 } 176 }
177 177
178 x = xfrm_state_lookup_byaddr(dst, src, proto, AF_INET6); 178 x = xfrm_state_lookup_byaddr(dst, src, proto, AF_INET6);
179 if (!x) 179 if (!x)
@@ -193,8 +193,8 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
193 if (unlikely(x->km.state != XFRM_STATE_VALID)) { 193 if (unlikely(x->km.state != XFRM_STATE_VALID)) {
194 spin_unlock(&x->lock); 194 spin_unlock(&x->lock);
195 xfrm_state_put(x); 195 xfrm_state_put(x);
196 x = NULL; 196 x = NULL;
197 continue; 197 continue;
198 } 198 }
199 if (xfrm_state_check_expire(x)) { 199 if (xfrm_state_check_expire(x)) {
200 spin_unlock(&x->lock); 200 spin_unlock(&x->lock);
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index c260ea104c52..d6d786b89d2b 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -2,7 +2,7 @@
2 * xfrm6_output.c - Common IPsec encapsulation code for IPv6. 2 * xfrm6_output.c - Common IPsec encapsulation code for IPv6.
3 * Copyright (C) 2002 USAGI/WIDE Project 3 * Copyright (C) 2002 USAGI/WIDE Project
4 * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au> 4 * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au>
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
@@ -46,7 +46,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
46 struct dst_entry *dst = skb->dst; 46 struct dst_entry *dst = skb->dst;
47 struct xfrm_state *x = dst->xfrm; 47 struct xfrm_state *x = dst->xfrm;
48 int err; 48 int err;
49 49
50 if (skb->ip_summed == CHECKSUM_PARTIAL) { 50 if (skb->ip_summed == CHECKSUM_PARTIAL) {
51 err = skb_checksum_help(skb); 51 err = skb_checksum_help(skb);
52 if (err) 52 if (err)
@@ -81,7 +81,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
81 spin_unlock_bh(&x->lock); 81 spin_unlock_bh(&x->lock);
82 82
83 skb->nh.raw = skb->data; 83 skb->nh.raw = skb->data;
84 84
85 if (!(skb->dst = dst_pop(dst))) { 85 if (!(skb->dst = dst_pop(dst))) {
86 err = -EHOSTUNREACH; 86 err = -EHOSTUNREACH;
87 goto error_nolock; 87 goto error_nolock;
@@ -108,7 +108,7 @@ static int xfrm6_output_finish2(struct sk_buff *skb)
108 108
109 while (likely((err = xfrm6_output_one(skb)) == 0)) { 109 while (likely((err = xfrm6_output_one(skb)) == 0)) {
110 nf_reset(skb); 110 nf_reset(skb);
111 111
112 err = nf_hook(PF_INET6, NF_IP6_LOCAL_OUT, &skb, NULL, 112 err = nf_hook(PF_INET6, NF_IP6_LOCAL_OUT, &skb, NULL,
113 skb->dst->dev, dst_output); 113 skb->dst->dev, dst_output);
114 if (unlikely(err != 1)) 114 if (unlikely(err != 1))
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 59480e92177d..b1133f27c8ae 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -8,7 +8,7 @@
8 * IPv6 support 8 * IPv6 support
9 * YOSHIFUJI Hideaki 9 * YOSHIFUJI Hideaki
10 * Split up af-specific portion 10 * Split up af-specific portion
11 * 11 *
12 */ 12 */
13 13
14#include <linux/compiler.h> 14#include <linux/compiler.h>
@@ -178,7 +178,8 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]); 178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]);
179 trailer_len += xfrm[i]->props.trailer_len; 179 trailer_len += xfrm[i]->props.trailer_len;
180 180
181 if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) { 181 if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL ||
182 xfrm[i]->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) {
182 unsigned short encap_family = xfrm[i]->props.family; 183 unsigned short encap_family = xfrm[i]->props.family;
183 switch(encap_family) { 184 switch(encap_family) {
184 case AF_INET: 185 case AF_INET:
@@ -186,8 +187,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
186 fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; 187 fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4;
187 break; 188 break;
188 case AF_INET6: 189 case AF_INET6:
189 ipv6_addr_copy(&fl_tunnel.fl6_dst, (struct in6_addr*)&xfrm[i]->id.daddr.a6); 190 ipv6_addr_copy(&fl_tunnel.fl6_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst));
190 ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr*)&xfrm[i]->props.saddr.a6); 191
192 ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_src));
191 break; 193 break;
192 default: 194 default:
193 BUG_ON(1); 195 BUG_ON(1);
@@ -247,9 +249,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
247 x->u.rt6.rt6i_metric = rt0->rt6i_metric; 249 x->u.rt6.rt6i_metric = rt0->rt6i_metric;
248 x->u.rt6.rt6i_node = rt0->rt6i_node; 250 x->u.rt6.rt6i_node = rt0->rt6i_node;
249 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; 251 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway;
250 memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); 252 memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway));
251 x->u.rt6.rt6i_dst = rt0->rt6i_dst; 253 x->u.rt6.rt6i_dst = rt0->rt6i_dst;
252 x->u.rt6.rt6i_src = rt0->rt6i_src; 254 x->u.rt6.rt6i_src = rt0->rt6i_src;
253 x->u.rt6.rt6i_idev = rt0->rt6i_idev; 255 x->u.rt6.rt6i_idev = rt0->rt6i_idev;
254 in6_dev_hold(rt0->rt6i_idev); 256 in6_dev_hold(rt0->rt6i_idev);
255 __xfrm6_bundle_len_dec(&header_len, &nfheader_len, x->u.dst.xfrm); 257 __xfrm6_bundle_len_dec(&header_len, &nfheader_len, x->u.dst.xfrm);
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index 60ad5f074e0a..baa461b9f74e 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -8,7 +8,7 @@
8 * IPv6 support 8 * IPv6 support
9 * YOSHIFUJI Hideaki @USAGI 9 * YOSHIFUJI Hideaki @USAGI
10 * Split up af-specific portion 10 * Split up af-specific portion
11 * 11 *
12 */ 12 */
13 13
14#include <net/xfrm.h> 14#include <net/xfrm.h>
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 12e426b9aacd..fb0228772f01 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -5,12 +5,12 @@
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -32,7 +32,7 @@
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33 33
34/* 34/*
35 * xfrm_tunnel_spi things are for allocating unique id ("spi") 35 * xfrm_tunnel_spi things are for allocating unique id ("spi")
36 * per xfrm_address_t. 36 * per xfrm_address_t.
37 */ 37 */
38struct xfrm6_tunnel_spi { 38struct xfrm6_tunnel_spi {
@@ -155,8 +155,8 @@ static u32 __xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr)
155 155
156 for (spi = xfrm6_tunnel_spi; spi <= XFRM6_TUNNEL_SPI_MAX; spi++) { 156 for (spi = xfrm6_tunnel_spi; spi <= XFRM6_TUNNEL_SPI_MAX; spi++) {
157 index = xfrm6_tunnel_spi_hash_byspi(spi); 157 index = xfrm6_tunnel_spi_hash_byspi(spi);
158 hlist_for_each_entry(x6spi, pos, 158 hlist_for_each_entry(x6spi, pos,
159 &xfrm6_tunnel_spi_byspi[index], 159 &xfrm6_tunnel_spi_byspi[index],
160 list_byspi) { 160 list_byspi) {
161 if (x6spi->spi == spi) 161 if (x6spi->spi == spi)
162 goto try_next_1; 162 goto try_next_1;
@@ -167,8 +167,8 @@ try_next_1:;
167 } 167 }
168 for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tunnel_spi; spi++) { 168 for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tunnel_spi; spi++) {
169 index = xfrm6_tunnel_spi_hash_byspi(spi); 169 index = xfrm6_tunnel_spi_hash_byspi(spi);
170 hlist_for_each_entry(x6spi, pos, 170 hlist_for_each_entry(x6spi, pos,
171 &xfrm6_tunnel_spi_byspi[index], 171 &xfrm6_tunnel_spi_byspi[index],
172 list_byspi) { 172 list_byspi) {
173 if (x6spi->spi == spi) 173 if (x6spi->spi == spi)
174 goto try_next_2; 174 goto try_next_2;
@@ -222,7 +222,7 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr)
222 222
223 write_lock_bh(&xfrm6_tunnel_spi_lock); 223 write_lock_bh(&xfrm6_tunnel_spi_lock);
224 224
225 hlist_for_each_entry_safe(x6spi, pos, n, 225 hlist_for_each_entry_safe(x6spi, pos, n,
226 &xfrm6_tunnel_spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)], 226 &xfrm6_tunnel_spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)],
227 list_byaddr) 227 list_byaddr)
228 { 228 {
@@ -269,9 +269,9 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
269{ 269{
270 /* xfrm6_tunnel native err handling */ 270 /* xfrm6_tunnel native err handling */
271 switch (type) { 271 switch (type) {
272 case ICMPV6_DEST_UNREACH: 272 case ICMPV6_DEST_UNREACH:
273 switch (code) { 273 switch (code) {
274 case ICMPV6_NOROUTE: 274 case ICMPV6_NOROUTE:
275 case ICMPV6_ADM_PROHIBITED: 275 case ICMPV6_ADM_PROHIBITED:
276 case ICMPV6_NOT_NEIGHBOUR: 276 case ICMPV6_NOT_NEIGHBOUR:
277 case ICMPV6_ADDR_UNREACH: 277 case ICMPV6_ADDR_UNREACH:
@@ -287,7 +287,7 @@ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
287 case ICMPV6_EXC_HOPLIMIT: 287 case ICMPV6_EXC_HOPLIMIT:
288 break; 288 break;
289 case ICMPV6_EXC_FRAGTIME: 289 case ICMPV6_EXC_FRAGTIME:
290 default: 290 default:
291 break; 291 break;
292 } 292 }
293 break; 293 break;