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 | |
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')
-rw-r--r-- | net/ipv6/addrconf.c | 25 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 23 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 5 |
3 files changed, 16 insertions, 37 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; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 0a0132a1c443..c2dc2e2b6c07 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1766,10 +1766,9 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1766 | struct inet6_dev *idev; | 1766 | struct inet6_dev *idev; |
1767 | struct sk_buff *skb; | 1767 | struct sk_buff *skb; |
1768 | struct icmp6hdr *hdr; | 1768 | struct icmp6hdr *hdr; |
1769 | struct in6_addr *snd_addr; | 1769 | const struct in6_addr *snd_addr; |
1770 | struct in6_addr *addrp; | 1770 | struct in6_addr *addrp; |
1771 | struct in6_addr addr_buf; | 1771 | struct in6_addr addr_buf; |
1772 | struct in6_addr all_routers; | ||
1773 | int err, len, payload_len, full_len; | 1772 | int err, len, payload_len, full_len; |
1774 | u8 ra[8] = { IPPROTO_ICMPV6, 0, | 1773 | u8 ra[8] = { IPPROTO_ICMPV6, 0, |
1775 | IPV6_TLV_ROUTERALERT, 2, 0, 0, | 1774 | IPV6_TLV_ROUTERALERT, 2, 0, 0, |
@@ -1780,11 +1779,10 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1780 | IP6_INC_STATS(__in6_dev_get(dev), | 1779 | IP6_INC_STATS(__in6_dev_get(dev), |
1781 | IPSTATS_MIB_OUTREQUESTS); | 1780 | IPSTATS_MIB_OUTREQUESTS); |
1782 | rcu_read_unlock(); | 1781 | rcu_read_unlock(); |
1783 | snd_addr = addr; | 1782 | if (type == ICMPV6_MGM_REDUCTION) |
1784 | if (type == ICMPV6_MGM_REDUCTION) { | 1783 | snd_addr = &in6addr_linklocal_allrouters; |
1785 | snd_addr = &all_routers; | 1784 | else |
1786 | ipv6_addr_all_routers(&all_routers); | 1785 | snd_addr = addr; |
1787 | } | ||
1788 | 1786 | ||
1789 | len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); | 1787 | len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr); |
1790 | payload_len = len + sizeof(ra); | 1788 | payload_len = len + sizeof(ra); |
@@ -2309,24 +2307,19 @@ void ipv6_mc_init_dev(struct inet6_dev *idev) | |||
2309 | void ipv6_mc_destroy_dev(struct inet6_dev *idev) | 2307 | void ipv6_mc_destroy_dev(struct inet6_dev *idev) |
2310 | { | 2308 | { |
2311 | struct ifmcaddr6 *i; | 2309 | struct ifmcaddr6 *i; |
2312 | struct in6_addr maddr; | ||
2313 | 2310 | ||
2314 | /* Deactivate timers */ | 2311 | /* Deactivate timers */ |
2315 | ipv6_mc_down(idev); | 2312 | ipv6_mc_down(idev); |
2316 | 2313 | ||
2317 | /* Delete all-nodes address. */ | 2314 | /* Delete all-nodes address. */ |
2318 | ipv6_addr_all_nodes(&maddr); | ||
2319 | |||
2320 | /* We cannot call ipv6_dev_mc_dec() directly, our caller in | 2315 | /* We cannot call ipv6_dev_mc_dec() directly, our caller in |
2321 | * addrconf.c has NULL'd out dev->ip6_ptr so in6_dev_get() will | 2316 | * addrconf.c has NULL'd out dev->ip6_ptr so in6_dev_get() will |
2322 | * fail. | 2317 | * fail. |
2323 | */ | 2318 | */ |
2324 | __ipv6_dev_mc_dec(idev, &maddr); | 2319 | __ipv6_dev_mc_dec(idev, &in6addr_linklocal_allnodes); |
2325 | 2320 | ||
2326 | if (idev->cnf.forwarding) { | 2321 | if (idev->cnf.forwarding) |
2327 | ipv6_addr_all_routers(&maddr); | 2322 | __ipv6_dev_mc_dec(idev, &in6addr_linklocal_allrouters); |
2328 | __ipv6_dev_mc_dec(idev, &maddr); | ||
2329 | } | ||
2330 | 2323 | ||
2331 | write_lock_bh(&idev->lock); | 2324 | write_lock_bh(&idev->lock); |
2332 | while ((i = idev->mc_list) != NULL) { | 2325 | while ((i = idev->mc_list) != NULL) { |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 5b9ad5e2f56d..2c74885f8355 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -818,10 +818,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
818 | is_router = !!idev->cnf.forwarding; | 818 | is_router = !!idev->cnf.forwarding; |
819 | 819 | ||
820 | if (dad) { | 820 | if (dad) { |
821 | struct in6_addr maddr; | 821 | ndisc_send_na(dev, NULL, &in6addr_linklocal_allnodes, &msg->target, |
822 | |||
823 | ipv6_addr_all_nodes(&maddr); | ||
824 | ndisc_send_na(dev, NULL, &maddr, &msg->target, | ||
825 | is_router, 0, (ifp != NULL), 1); | 822 | is_router, 0, (ifp != NULL), 1); |
826 | goto out; | 823 | goto out; |
827 | } | 824 | } |