aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c270
1 files changed, 145 insertions, 125 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e3854696988d..ea0755b09033 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) {
@@ -2776,7 +2776,7 @@ out_kfree:
2776 goto out; 2776 goto out;
2777} 2777}
2778 2778
2779static struct file_operations if6_fops = { 2779static const struct file_operations if6_fops = {
2780 .owner = THIS_MODULE, 2780 .owner = THIS_MODULE,
2781 .open = if6_seq_open, 2781 .open = if6_seq_open,
2782 .read = seq_read, 2782 .read = seq_read,
@@ -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
@@ -3117,7 +3117,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
3117 3117
3118 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags); 3118 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags);
3119 if (nlh == NULL) 3119 if (nlh == NULL)
3120 return -ENOBUFS; 3120 return -EMSGSIZE;
3121 3121
3122 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), 3122 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope),
3123 ifa->idev->dev->ifindex); 3123 ifa->idev->dev->ifindex);
@@ -3137,8 +3137,10 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
3137 } 3137 }
3138 3138
3139 if (nla_put(skb, IFA_ADDRESS, 16, &ifa->addr) < 0 || 3139 if (nla_put(skb, IFA_ADDRESS, 16, &ifa->addr) < 0 ||
3140 put_cacheinfo(skb, ifa->cstamp, ifa->tstamp, preferred, valid) < 0) 3140 put_cacheinfo(skb, ifa->cstamp, ifa->tstamp, preferred, valid) < 0) {
3141 return nlmsg_cancel(skb, nlh); 3141 nlmsg_cancel(skb, nlh);
3142 return -EMSGSIZE;
3143 }
3142 3144
3143 return nlmsg_end(skb, nlh); 3145 return nlmsg_end(skb, nlh);
3144} 3146}
@@ -3155,13 +3157,15 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca,
3155 3157
3156 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags); 3158 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags);
3157 if (nlh == NULL) 3159 if (nlh == NULL)
3158 return -ENOBUFS; 3160 return -EMSGSIZE;
3159 3161
3160 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); 3162 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
3161 if (nla_put(skb, IFA_MULTICAST, 16, &ifmca->mca_addr) < 0 || 3163 if (nla_put(skb, IFA_MULTICAST, 16, &ifmca->mca_addr) < 0 ||
3162 put_cacheinfo(skb, ifmca->mca_cstamp, ifmca->mca_tstamp, 3164 put_cacheinfo(skb, ifmca->mca_cstamp, ifmca->mca_tstamp,
3163 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) 3165 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) {
3164 return nlmsg_cancel(skb, nlh); 3166 nlmsg_cancel(skb, nlh);
3167 return -EMSGSIZE;
3168 }
3165 3169
3166 return nlmsg_end(skb, nlh); 3170 return nlmsg_end(skb, nlh);
3167} 3171}
@@ -3178,13 +3182,15 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
3178 3182
3179 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags); 3183 nlh = nlmsg_put(skb, pid, seq, event, sizeof(struct ifaddrmsg), flags);
3180 if (nlh == NULL) 3184 if (nlh == NULL)
3181 return -ENOBUFS; 3185 return -EMSGSIZE;
3182 3186
3183 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); 3187 put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
3184 if (nla_put(skb, IFA_ANYCAST, 16, &ifaca->aca_addr) < 0 || 3188 if (nla_put(skb, IFA_ANYCAST, 16, &ifaca->aca_addr) < 0 ||
3185 put_cacheinfo(skb, ifaca->aca_cstamp, ifaca->aca_tstamp, 3189 put_cacheinfo(skb, ifaca->aca_cstamp, ifaca->aca_tstamp,
3186 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) 3190 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) {
3187 return nlmsg_cancel(skb, nlh); 3191 nlmsg_cancel(skb, nlh);
3192 return -EMSGSIZE;
3193 }
3188 3194
3189 return nlmsg_end(skb, nlh); 3195 return nlmsg_end(skb, nlh);
3190} 3196}
@@ -3211,7 +3217,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3211 s_idx = cb->args[0]; 3217 s_idx = cb->args[0];
3212 s_ip_idx = ip_idx = cb->args[1]; 3218 s_ip_idx = ip_idx = cb->args[1];
3213 read_lock(&dev_base_lock); 3219 read_lock(&dev_base_lock);
3214 3220
3215 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { 3221 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) {
3216 if (idx < s_idx) 3222 if (idx < s_idx)
3217 continue; 3223 continue;
@@ -3228,8 +3234,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3228 ifa = ifa->if_next, ip_idx++) { 3234 ifa = ifa->if_next, ip_idx++) {
3229 if (ip_idx < s_ip_idx) 3235 if (ip_idx < s_ip_idx)
3230 continue; 3236 continue;
3231 if ((err = inet6_fill_ifaddr(skb, ifa, 3237 if ((err = inet6_fill_ifaddr(skb, ifa,
3232 NETLINK_CB(cb->skb).pid, 3238 NETLINK_CB(cb->skb).pid,
3233 cb->nlh->nlmsg_seq, RTM_NEWADDR, 3239 cb->nlh->nlmsg_seq, RTM_NEWADDR,
3234 NLM_F_MULTI)) <= 0) 3240 NLM_F_MULTI)) <= 0)
3235 goto done; 3241 goto done;
@@ -3237,12 +3243,12 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3237 break; 3243 break;
3238 case MULTICAST_ADDR: 3244 case MULTICAST_ADDR:
3239 /* multicast address */ 3245 /* multicast address */
3240 for (ifmca = idev->mc_list; ifmca; 3246 for (ifmca = idev->mc_list; ifmca;
3241 ifmca = ifmca->next, ip_idx++) { 3247 ifmca = ifmca->next, ip_idx++) {
3242 if (ip_idx < s_ip_idx) 3248 if (ip_idx < s_ip_idx)
3243 continue; 3249 continue;
3244 if ((err = inet6_fill_ifmcaddr(skb, ifmca, 3250 if ((err = inet6_fill_ifmcaddr(skb, ifmca,
3245 NETLINK_CB(cb->skb).pid, 3251 NETLINK_CB(cb->skb).pid,
3246 cb->nlh->nlmsg_seq, RTM_GETMULTICAST, 3252 cb->nlh->nlmsg_seq, RTM_GETMULTICAST,
3247 NLM_F_MULTI)) <= 0) 3253 NLM_F_MULTI)) <= 0)
3248 goto done; 3254 goto done;
@@ -3254,10 +3260,10 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3254 ifaca = ifaca->aca_next, ip_idx++) { 3260 ifaca = ifaca->aca_next, ip_idx++) {
3255 if (ip_idx < s_ip_idx) 3261 if (ip_idx < s_ip_idx)
3256 continue; 3262 continue;
3257 if ((err = inet6_fill_ifacaddr(skb, ifaca, 3263 if ((err = inet6_fill_ifacaddr(skb, ifaca,
3258 NETLINK_CB(cb->skb).pid, 3264 NETLINK_CB(cb->skb).pid,
3259 cb->nlh->nlmsg_seq, RTM_GETANYCAST, 3265 cb->nlh->nlmsg_seq, RTM_GETANYCAST,
3260 NLM_F_MULTI)) <= 0) 3266 NLM_F_MULTI)) <= 0)
3261 goto done; 3267 goto done;
3262 } 3268 }
3263 break; 3269 break;
@@ -3334,9 +3340,12 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
3334 3340
3335 err = inet6_fill_ifaddr(skb, ifa, NETLINK_CB(in_skb).pid, 3341 err = inet6_fill_ifaddr(skb, ifa, NETLINK_CB(in_skb).pid,
3336 nlh->nlmsg_seq, RTM_NEWADDR, 0); 3342 nlh->nlmsg_seq, RTM_NEWADDR, 0);
3337 /* failure implies BUG in inet6_ifaddr_msgsize() */ 3343 if (err < 0) {
3338 BUG_ON(err < 0); 3344 /* -EMSGSIZE implies BUG in inet6_ifaddr_msgsize() */
3339 3345 WARN_ON(err == -EMSGSIZE);
3346 kfree_skb(skb);
3347 goto errout_ifa;
3348 }
3340 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 3349 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
3341errout_ifa: 3350errout_ifa:
3342 in6_ifa_put(ifa); 3351 in6_ifa_put(ifa);
@@ -3354,9 +3363,12 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
3354 goto errout; 3363 goto errout;
3355 3364
3356 err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0); 3365 err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0);
3357 /* failure implies BUG in inet6_ifaddr_msgsize() */ 3366 if (err < 0) {
3358 BUG_ON(err < 0); 3367 /* -EMSGSIZE implies BUG in inet6_ifaddr_msgsize() */
3359 3368 WARN_ON(err == -EMSGSIZE);
3369 kfree_skb(skb);
3370 goto errout;
3371 }
3360 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); 3372 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
3361errout: 3373errout:
3362 if (err < 0) 3374 if (err < 0)
@@ -3414,7 +3426,7 @@ static inline size_t inet6_if_nlmsg_size(void)
3414 ); 3426 );
3415} 3427}
3416 3428
3417static 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,
3418 u32 pid, u32 seq, int event, unsigned int flags) 3430 u32 pid, u32 seq, int event, unsigned int flags)
3419{ 3431{
3420 struct net_device *dev = idev->dev; 3432 struct net_device *dev = idev->dev;
@@ -3426,7 +3438,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
3426 3438
3427 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*hdr), flags); 3439 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*hdr), flags);
3428 if (nlh == NULL) 3440 if (nlh == NULL)
3429 return -ENOBUFS; 3441 return -EMSGSIZE;
3430 3442
3431 hdr = nlmsg_data(nlh); 3443 hdr = nlmsg_data(nlh);
3432 hdr->ifi_family = AF_INET6; 3444 hdr->ifi_family = AF_INET6;
@@ -3469,7 +3481,8 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
3469 return nlmsg_end(skb, nlh); 3481 return nlmsg_end(skb, nlh);
3470 3482
3471nla_put_failure: 3483nla_put_failure:
3472 return nlmsg_cancel(skb, nlh); 3484 nlmsg_cancel(skb, nlh);
3485 return -EMSGSIZE;
3473} 3486}
3474 3487
3475static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) 3488static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
@@ -3485,7 +3498,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3485 continue; 3498 continue;
3486 if ((idev = in6_dev_get(dev)) == NULL) 3499 if ((idev = in6_dev_get(dev)) == NULL)
3487 continue; 3500 continue;
3488 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, 3501 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
3489 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI); 3502 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI);
3490 in6_dev_put(idev); 3503 in6_dev_put(idev);
3491 if (err <= 0) 3504 if (err <= 0)
@@ -3501,15 +3514,18 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3501{ 3514{
3502 struct sk_buff *skb; 3515 struct sk_buff *skb;
3503 int err = -ENOBUFS; 3516 int err = -ENOBUFS;
3504 3517
3505 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); 3518 skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC);
3506 if (skb == NULL) 3519 if (skb == NULL)
3507 goto errout; 3520 goto errout;
3508 3521
3509 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0); 3522 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0);
3510 /* failure implies BUG in inet6_if_nlmsg_size() */ 3523 if (err < 0) {
3511 BUG_ON(err < 0); 3524 /* -EMSGSIZE implies BUG in inet6_if_nlmsg_size() */
3512 3525 WARN_ON(err == -EMSGSIZE);
3526 kfree_skb(skb);
3527 goto errout;
3528 }
3513 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); 3529 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
3514errout: 3530errout:
3515 if (err < 0) 3531 if (err < 0)
@@ -3533,7 +3549,7 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3533 3549
3534 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*pmsg), flags); 3550 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*pmsg), flags);
3535 if (nlh == NULL) 3551 if (nlh == NULL)
3536 return -ENOBUFS; 3552 return -EMSGSIZE;
3537 3553
3538 pmsg = nlmsg_data(nlh); 3554 pmsg = nlmsg_data(nlh);
3539 pmsg->prefix_family = AF_INET6; 3555 pmsg->prefix_family = AF_INET6;
@@ -3558,10 +3574,11 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3558 return nlmsg_end(skb, nlh); 3574 return nlmsg_end(skb, nlh);
3559 3575
3560nla_put_failure: 3576nla_put_failure:
3561 return nlmsg_cancel(skb, nlh); 3577 nlmsg_cancel(skb, nlh);
3578 return -EMSGSIZE;
3562} 3579}
3563 3580
3564static void inet6_prefix_notify(int event, struct inet6_dev *idev, 3581static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3565 struct prefix_info *pinfo) 3582 struct prefix_info *pinfo)
3566{ 3583{
3567 struct sk_buff *skb; 3584 struct sk_buff *skb;
@@ -3572,9 +3589,12 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3572 goto errout; 3589 goto errout;
3573 3590
3574 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0); 3591 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0);
3575 /* failure implies BUG in inet6_prefix_nlmsg_size() */ 3592 if (err < 0) {
3576 BUG_ON(err < 0); 3593 /* -EMSGSIZE implies BUG in inet6_prefix_nlmsg_size() */
3577 3594 WARN_ON(err == -EMSGSIZE);
3595 kfree_skb(skb);
3596 goto errout;
3597 }
3578 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC); 3598 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC);
3579errout: 3599errout:
3580 if (err < 0) 3600 if (err < 0)
@@ -3655,10 +3675,10 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
3655 rt6_purge_dflt_routers(); 3675 rt6_purge_dflt_routers();
3656 } 3676 }
3657 3677
3658 return ret; 3678 return ret;
3659} 3679}
3660 3680
3661static int addrconf_sysctl_forward_strategy(ctl_table *table, 3681static int addrconf_sysctl_forward_strategy(ctl_table *table,
3662 int __user *name, int nlen, 3682 int __user *name, int nlen,
3663 void __user *oldval, 3683 void __user *oldval,
3664 size_t __user *oldlenp, 3684 size_t __user *oldlenp,
@@ -3723,19 +3743,19 @@ static struct addrconf_sysctl_table
3723} addrconf_sysctl __read_mostly = { 3743} addrconf_sysctl __read_mostly = {
3724 .sysctl_header = NULL, 3744 .sysctl_header = NULL,
3725 .addrconf_vars = { 3745 .addrconf_vars = {
3726 { 3746 {
3727 .ctl_name = NET_IPV6_FORWARDING, 3747 .ctl_name = NET_IPV6_FORWARDING,
3728 .procname = "forwarding", 3748 .procname = "forwarding",
3729 .data = &ipv6_devconf.forwarding, 3749 .data = &ipv6_devconf.forwarding,
3730 .maxlen = sizeof(int), 3750 .maxlen = sizeof(int),
3731 .mode = 0644, 3751 .mode = 0644,
3732 .proc_handler = &addrconf_sysctl_forward, 3752 .proc_handler = &addrconf_sysctl_forward,
3733 .strategy = &addrconf_sysctl_forward_strategy, 3753 .strategy = &addrconf_sysctl_forward_strategy,
3734 }, 3754 },
3735 { 3755 {
3736 .ctl_name = NET_IPV6_HOP_LIMIT, 3756 .ctl_name = NET_IPV6_HOP_LIMIT,
3737 .procname = "hop_limit", 3757 .procname = "hop_limit",
3738 .data = &ipv6_devconf.hop_limit, 3758 .data = &ipv6_devconf.hop_limit,
3739 .maxlen = sizeof(int), 3759 .maxlen = sizeof(int),
3740 .mode = 0644, 3760 .mode = 0644,
3741 .proc_handler = proc_dointvec, 3761 .proc_handler = proc_dointvec,
@@ -3744,116 +3764,116 @@ static struct addrconf_sysctl_table
3744 .ctl_name = NET_IPV6_MTU, 3764 .ctl_name = NET_IPV6_MTU,
3745 .procname = "mtu", 3765 .procname = "mtu",
3746 .data = &ipv6_devconf.mtu6, 3766 .data = &ipv6_devconf.mtu6,
3747 .maxlen = sizeof(int), 3767 .maxlen = sizeof(int),
3748 .mode = 0644, 3768 .mode = 0644,
3749 .proc_handler = &proc_dointvec, 3769 .proc_handler = &proc_dointvec,
3750 }, 3770 },
3751 { 3771 {
3752 .ctl_name = NET_IPV6_ACCEPT_RA, 3772 .ctl_name = NET_IPV6_ACCEPT_RA,
3753 .procname = "accept_ra", 3773 .procname = "accept_ra",
3754 .data = &ipv6_devconf.accept_ra, 3774 .data = &ipv6_devconf.accept_ra,
3755 .maxlen = sizeof(int), 3775 .maxlen = sizeof(int),
3756 .mode = 0644, 3776 .mode = 0644,
3757 .proc_handler = &proc_dointvec, 3777 .proc_handler = &proc_dointvec,
3758 }, 3778 },
3759 { 3779 {
3760 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, 3780 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS,
3761 .procname = "accept_redirects", 3781 .procname = "accept_redirects",
3762 .data = &ipv6_devconf.accept_redirects, 3782 .data = &ipv6_devconf.accept_redirects,
3763 .maxlen = sizeof(int), 3783 .maxlen = sizeof(int),
3764 .mode = 0644, 3784 .mode = 0644,
3765 .proc_handler = &proc_dointvec, 3785 .proc_handler = &proc_dointvec,
3766 }, 3786 },
3767 { 3787 {
3768 .ctl_name = NET_IPV6_AUTOCONF, 3788 .ctl_name = NET_IPV6_AUTOCONF,
3769 .procname = "autoconf", 3789 .procname = "autoconf",
3770 .data = &ipv6_devconf.autoconf, 3790 .data = &ipv6_devconf.autoconf,
3771 .maxlen = sizeof(int), 3791 .maxlen = sizeof(int),
3772 .mode = 0644, 3792 .mode = 0644,
3773 .proc_handler = &proc_dointvec, 3793 .proc_handler = &proc_dointvec,
3774 }, 3794 },
3775 { 3795 {
3776 .ctl_name = NET_IPV6_DAD_TRANSMITS, 3796 .ctl_name = NET_IPV6_DAD_TRANSMITS,
3777 .procname = "dad_transmits", 3797 .procname = "dad_transmits",
3778 .data = &ipv6_devconf.dad_transmits, 3798 .data = &ipv6_devconf.dad_transmits,
3779 .maxlen = sizeof(int), 3799 .maxlen = sizeof(int),
3780 .mode = 0644, 3800 .mode = 0644,
3781 .proc_handler = &proc_dointvec, 3801 .proc_handler = &proc_dointvec,
3782 }, 3802 },
3783 { 3803 {
3784 .ctl_name = NET_IPV6_RTR_SOLICITS, 3804 .ctl_name = NET_IPV6_RTR_SOLICITS,
3785 .procname = "router_solicitations", 3805 .procname = "router_solicitations",
3786 .data = &ipv6_devconf.rtr_solicits, 3806 .data = &ipv6_devconf.rtr_solicits,
3787 .maxlen = sizeof(int), 3807 .maxlen = sizeof(int),
3788 .mode = 0644, 3808 .mode = 0644,
3789 .proc_handler = &proc_dointvec, 3809 .proc_handler = &proc_dointvec,
3790 }, 3810 },
3791 { 3811 {
3792 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, 3812 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL,
3793 .procname = "router_solicitation_interval", 3813 .procname = "router_solicitation_interval",
3794 .data = &ipv6_devconf.rtr_solicit_interval, 3814 .data = &ipv6_devconf.rtr_solicit_interval,
3795 .maxlen = sizeof(int), 3815 .maxlen = sizeof(int),
3796 .mode = 0644, 3816 .mode = 0644,
3797 .proc_handler = &proc_dointvec_jiffies, 3817 .proc_handler = &proc_dointvec_jiffies,
3798 .strategy = &sysctl_jiffies, 3818 .strategy = &sysctl_jiffies,
3799 }, 3819 },
3800 { 3820 {
3801 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, 3821 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY,
3802 .procname = "router_solicitation_delay", 3822 .procname = "router_solicitation_delay",
3803 .data = &ipv6_devconf.rtr_solicit_delay, 3823 .data = &ipv6_devconf.rtr_solicit_delay,
3804 .maxlen = sizeof(int), 3824 .maxlen = sizeof(int),
3805 .mode = 0644, 3825 .mode = 0644,
3806 .proc_handler = &proc_dointvec_jiffies, 3826 .proc_handler = &proc_dointvec_jiffies,
3807 .strategy = &sysctl_jiffies, 3827 .strategy = &sysctl_jiffies,
3808 }, 3828 },
3809 { 3829 {
3810 .ctl_name = NET_IPV6_FORCE_MLD_VERSION, 3830 .ctl_name = NET_IPV6_FORCE_MLD_VERSION,
3811 .procname = "force_mld_version", 3831 .procname = "force_mld_version",
3812 .data = &ipv6_devconf.force_mld_version, 3832 .data = &ipv6_devconf.force_mld_version,
3813 .maxlen = sizeof(int), 3833 .maxlen = sizeof(int),
3814 .mode = 0644, 3834 .mode = 0644,
3815 .proc_handler = &proc_dointvec, 3835 .proc_handler = &proc_dointvec,
3816 }, 3836 },
3817#ifdef CONFIG_IPV6_PRIVACY 3837#ifdef CONFIG_IPV6_PRIVACY
3818 { 3838 {
3819 .ctl_name = NET_IPV6_USE_TEMPADDR, 3839 .ctl_name = NET_IPV6_USE_TEMPADDR,
3820 .procname = "use_tempaddr", 3840 .procname = "use_tempaddr",
3821 .data = &ipv6_devconf.use_tempaddr, 3841 .data = &ipv6_devconf.use_tempaddr,
3822 .maxlen = sizeof(int), 3842 .maxlen = sizeof(int),
3823 .mode = 0644, 3843 .mode = 0644,
3824 .proc_handler = &proc_dointvec, 3844 .proc_handler = &proc_dointvec,
3825 }, 3845 },
3826 { 3846 {
3827 .ctl_name = NET_IPV6_TEMP_VALID_LFT, 3847 .ctl_name = NET_IPV6_TEMP_VALID_LFT,
3828 .procname = "temp_valid_lft", 3848 .procname = "temp_valid_lft",
3829 .data = &ipv6_devconf.temp_valid_lft, 3849 .data = &ipv6_devconf.temp_valid_lft,
3830 .maxlen = sizeof(int), 3850 .maxlen = sizeof(int),
3831 .mode = 0644, 3851 .mode = 0644,
3832 .proc_handler = &proc_dointvec, 3852 .proc_handler = &proc_dointvec,
3833 }, 3853 },
3834 { 3854 {
3835 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, 3855 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT,
3836 .procname = "temp_prefered_lft", 3856 .procname = "temp_prefered_lft",
3837 .data = &ipv6_devconf.temp_prefered_lft, 3857 .data = &ipv6_devconf.temp_prefered_lft,
3838 .maxlen = sizeof(int), 3858 .maxlen = sizeof(int),
3839 .mode = 0644, 3859 .mode = 0644,
3840 .proc_handler = &proc_dointvec, 3860 .proc_handler = &proc_dointvec,
3841 }, 3861 },
3842 { 3862 {
3843 .ctl_name = NET_IPV6_REGEN_MAX_RETRY, 3863 .ctl_name = NET_IPV6_REGEN_MAX_RETRY,
3844 .procname = "regen_max_retry", 3864 .procname = "regen_max_retry",
3845 .data = &ipv6_devconf.regen_max_retry, 3865 .data = &ipv6_devconf.regen_max_retry,
3846 .maxlen = sizeof(int), 3866 .maxlen = sizeof(int),
3847 .mode = 0644, 3867 .mode = 0644,
3848 .proc_handler = &proc_dointvec, 3868 .proc_handler = &proc_dointvec,
3849 }, 3869 },
3850 { 3870 {
3851 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, 3871 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR,
3852 .procname = "max_desync_factor", 3872 .procname = "max_desync_factor",
3853 .data = &ipv6_devconf.max_desync_factor, 3873 .data = &ipv6_devconf.max_desync_factor,
3854 .maxlen = sizeof(int), 3874 .maxlen = sizeof(int),
3855 .mode = 0644, 3875 .mode = 0644,
3856 .proc_handler = &proc_dointvec, 3876 .proc_handler = &proc_dointvec,
3857 }, 3877 },
3858#endif 3878#endif
3859 { 3879 {
@@ -3867,18 +3887,18 @@ static struct addrconf_sysctl_table
3867 { 3887 {
3868 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, 3888 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR,
3869 .procname = "accept_ra_defrtr", 3889 .procname = "accept_ra_defrtr",
3870 .data = &ipv6_devconf.accept_ra_defrtr, 3890 .data = &ipv6_devconf.accept_ra_defrtr,
3871 .maxlen = sizeof(int), 3891 .maxlen = sizeof(int),
3872 .mode = 0644, 3892 .mode = 0644,
3873 .proc_handler = &proc_dointvec, 3893 .proc_handler = &proc_dointvec,
3874 }, 3894 },
3875 { 3895 {
3876 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, 3896 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO,
3877 .procname = "accept_ra_pinfo", 3897 .procname = "accept_ra_pinfo",
3878 .data = &ipv6_devconf.accept_ra_pinfo, 3898 .data = &ipv6_devconf.accept_ra_pinfo,
3879 .maxlen = sizeof(int), 3899 .maxlen = sizeof(int),
3880 .mode = 0644, 3900 .mode = 0644,
3881 .proc_handler = &proc_dointvec, 3901 .proc_handler = &proc_dointvec,
3882 }, 3902 },
3883#ifdef CONFIG_IPV6_ROUTER_PREF 3903#ifdef CONFIG_IPV6_ROUTER_PREF
3884 { 3904 {
@@ -3983,18 +4003,18 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
3983 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ 4003 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */
3984 } 4004 }
3985 if (dev) { 4005 if (dev) {
3986 dev_name = dev->name; 4006 dev_name = dev->name;
3987 t->addrconf_dev[0].ctl_name = dev->ifindex; 4007 t->addrconf_dev[0].ctl_name = dev->ifindex;
3988 } else { 4008 } else {
3989 dev_name = "default"; 4009 dev_name = "default";
3990 t->addrconf_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; 4010 t->addrconf_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT;
3991 } 4011 }
3992 4012
3993 /* 4013 /*
3994 * 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
3995 * 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
3996 * (see SIOCSIFNAME). 4016 * (see SIOCSIFNAME).
3997 */ 4017 */
3998 dev_name = kstrdup(dev_name, GFP_KERNEL); 4018 dev_name = kstrdup(dev_name, GFP_KERNEL);
3999 if (!dev_name) 4019 if (!dev_name)
4000 goto free; 4020 goto free;
@@ -4046,12 +4066,12 @@ static void addrconf_sysctl_unregister(struct ipv6_devconf *p)
4046 4066
4047int register_inet6addr_notifier(struct notifier_block *nb) 4067int register_inet6addr_notifier(struct notifier_block *nb)
4048{ 4068{
4049 return atomic_notifier_chain_register(&inet6addr_chain, nb); 4069 return atomic_notifier_chain_register(&inet6addr_chain, nb);
4050} 4070}
4051 4071
4052int unregister_inet6addr_notifier(struct notifier_block *nb) 4072int unregister_inet6addr_notifier(struct notifier_block *nb)
4053{ 4073{
4054 return atomic_notifier_chain_unregister(&inet6addr_chain,nb); 4074 return atomic_notifier_chain_unregister(&inet6addr_chain,nb);
4055} 4075}
4056 4076
4057/* 4077/*
@@ -4104,9 +4124,9 @@ int __init addrconf_init(void)
4104 4124
4105void __exit addrconf_cleanup(void) 4125void __exit addrconf_cleanup(void)
4106{ 4126{
4107 struct net_device *dev; 4127 struct net_device *dev;
4108 struct inet6_dev *idev; 4128 struct inet6_dev *idev;
4109 struct inet6_ifaddr *ifa; 4129 struct inet6_ifaddr *ifa;
4110 int i; 4130 int i;
4111 4131
4112 unregister_netdevice_notifier(&ipv6_dev_notf); 4132 unregister_netdevice_notifier(&ipv6_dev_notf);