diff options
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 198 |
1 files changed, 99 insertions, 99 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 |
107 | static int __ipv6_regen_rndid(struct inet6_dev *idev); | 107 | static int __ipv6_regen_rndid(struct inet6_dev *idev); |
108 | static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); | 108 | static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); |
109 | static void ipv6_regen_rndid(unsigned long data); | 109 | static void ipv6_regen_rndid(unsigned long data); |
110 | 110 | ||
111 | static int desync_factor = MAX_DESYNC_FACTOR * HZ; | 111 | static int desync_factor = MAX_DESYNC_FACTOR * HZ; |
@@ -137,7 +137,7 @@ static void addrconf_rs_timer(unsigned long data); | |||
137 | static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); | 137 | static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); |
138 | static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); | 138 | static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); |
139 | 139 | ||
140 | static void inet6_prefix_notify(int event, struct inet6_dev *idev, | 140 | static void inet6_prefix_notify(int event, struct inet6_dev *idev, |
141 | struct prefix_info *pinfo); | 141 | struct prefix_info *pinfo); |
142 | static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); | 142 | static 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 | ||
2236 | static int addrconf_notify(struct notifier_block *this, unsigned long event, | 2236 | static 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 | ||
3429 | static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | 3429 | static 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 | ||
3581 | static void inet6_prefix_notify(int event, struct inet6_dev *idev, | 3581 | static 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 | ||
3681 | static int addrconf_sysctl_forward_strategy(ctl_table *table, | 3681 | static 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 | ||
4067 | int register_inet6addr_notifier(struct notifier_block *nb) | 4067 | int 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 | ||
4072 | int unregister_inet6addr_notifier(struct notifier_block *nb) | 4072 | int 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 | ||
4125 | void __exit addrconf_cleanup(void) | 4125 | void __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); |