diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-04-10 02:42:11 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-04-12 00:43:19 -0400 |
commit | f3ee4010e84452aa133e5163e6cfabc52b194e94 (patch) | |
tree | 09e24d1deee7545e72329a3fb6b4d8e228e8a21d /net/ipv6/addrconf.c | |
parent | 9acd9f3ae92d0dc0ca7504fb48c1040e8bbc39fe (diff) |
[IPV6]: Define constants for link-local multicast addresses.
- Define link-local all-node / all-router multicast addresses.
- Remove ipv6_addr_all_nodes() and ipv6_addr_all_routers().
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4048c2b73b0b..7df04d294924 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -222,6 +222,8 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { | |||
222 | /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ | 222 | /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ |
223 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; | 223 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; |
224 | const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; | 224 | const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; |
225 | const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT; | ||
226 | const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; | ||
225 | 227 | ||
226 | /* Check if a valid qdisc is available */ | 228 | /* Check if a valid qdisc is available */ |
227 | static inline int addrconf_qdisc_ok(struct net_device *dev) | 229 | static inline int addrconf_qdisc_ok(struct net_device *dev) |
@@ -321,7 +323,6 @@ EXPORT_SYMBOL(in6_dev_finish_destroy); | |||
321 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | 323 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) |
322 | { | 324 | { |
323 | struct inet6_dev *ndev; | 325 | struct inet6_dev *ndev; |
324 | struct in6_addr maddr; | ||
325 | 326 | ||
326 | ASSERT_RTNL(); | 327 | ASSERT_RTNL(); |
327 | 328 | ||
@@ -406,8 +407,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
406 | rcu_assign_pointer(dev->ip6_ptr, ndev); | 407 | rcu_assign_pointer(dev->ip6_ptr, ndev); |
407 | 408 | ||
408 | /* Join all-node multicast group */ | 409 | /* Join all-node multicast group */ |
409 | ipv6_addr_all_nodes(&maddr); | 410 | ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes); |
410 | ipv6_dev_mc_inc(dev, &maddr); | ||
411 | 411 | ||
412 | return ndev; | 412 | return ndev; |
413 | } | 413 | } |
@@ -433,18 +433,15 @@ static void dev_forward_change(struct inet6_dev *idev) | |||
433 | { | 433 | { |
434 | struct net_device *dev; | 434 | struct net_device *dev; |
435 | struct inet6_ifaddr *ifa; | 435 | struct inet6_ifaddr *ifa; |
436 | struct in6_addr addr; | ||
437 | 436 | ||
438 | if (!idev) | 437 | if (!idev) |
439 | return; | 438 | return; |
440 | dev = idev->dev; | 439 | dev = idev->dev; |
441 | if (dev && (dev->flags & IFF_MULTICAST)) { | 440 | if (dev && (dev->flags & IFF_MULTICAST)) { |
442 | ipv6_addr_all_routers(&addr); | ||
443 | |||
444 | if (idev->cnf.forwarding) | 441 | if (idev->cnf.forwarding) |
445 | ipv6_dev_mc_inc(dev, &addr); | 442 | ipv6_dev_mc_inc(dev, &in6addr_linklocal_allrouters); |
446 | else | 443 | else |
447 | ipv6_dev_mc_dec(dev, &addr); | 444 | ipv6_dev_mc_dec(dev, &in6addr_linklocal_allrouters); |
448 | } | 445 | } |
449 | for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { | 446 | for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { |
450 | if (ifa->flags&IFA_F_TENTATIVE) | 447 | if (ifa->flags&IFA_F_TENTATIVE) |
@@ -2654,8 +2651,6 @@ static void addrconf_rs_timer(unsigned long data) | |||
2654 | 2651 | ||
2655 | spin_lock(&ifp->lock); | 2652 | spin_lock(&ifp->lock); |
2656 | if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) { | 2653 | if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) { |
2657 | struct in6_addr all_routers; | ||
2658 | |||
2659 | /* The wait after the last probe can be shorter */ | 2654 | /* The wait after the last probe can be shorter */ |
2660 | addrconf_mod_timer(ifp, AC_RS, | 2655 | addrconf_mod_timer(ifp, AC_RS, |
2661 | (ifp->probes == ifp->idev->cnf.rtr_solicits) ? | 2656 | (ifp->probes == ifp->idev->cnf.rtr_solicits) ? |
@@ -2663,9 +2658,7 @@ static void addrconf_rs_timer(unsigned long data) | |||
2663 | ifp->idev->cnf.rtr_solicit_interval); | 2658 | ifp->idev->cnf.rtr_solicit_interval); |
2664 | spin_unlock(&ifp->lock); | 2659 | spin_unlock(&ifp->lock); |
2665 | 2660 | ||
2666 | ipv6_addr_all_routers(&all_routers); | 2661 | ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters); |
2667 | |||
2668 | ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers); | ||
2669 | } else { | 2662 | } else { |
2670 | spin_unlock(&ifp->lock); | 2663 | spin_unlock(&ifp->lock); |
2671 | /* | 2664 | /* |
@@ -2806,16 +2799,12 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp) | |||
2806 | ifp->idev->cnf.rtr_solicits > 0 && | 2799 | ifp->idev->cnf.rtr_solicits > 0 && |
2807 | (dev->flags&IFF_LOOPBACK) == 0 && | 2800 | (dev->flags&IFF_LOOPBACK) == 0 && |
2808 | (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { | 2801 | (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) { |
2809 | struct in6_addr all_routers; | ||
2810 | |||
2811 | ipv6_addr_all_routers(&all_routers); | ||
2812 | |||
2813 | /* | 2802 | /* |
2814 | * If a host as already performed a random delay | 2803 | * If a host as already performed a random delay |
2815 | * [...] as part of DAD [...] there is no need | 2804 | * [...] as part of DAD [...] there is no need |
2816 | * to delay again before sending the first RS | 2805 | * to delay again before sending the first RS |
2817 | */ | 2806 | */ |
2818 | ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers); | 2807 | ndisc_send_rs(ifp->idev->dev, &ifp->addr, &in6addr_linklocal_allrouters); |
2819 | 2808 | ||
2820 | spin_lock_bh(&ifp->lock); | 2809 | spin_lock_bh(&ifp->lock); |
2821 | ifp->probes = 1; | 2810 | ifp->probes = 1; |