diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-20 02:39:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-20 22:29:49 -0500 |
commit | ca97a644d752b46e5e08526e36705c3b0dd03f5f (patch) | |
tree | 2c36826f1f6e843a5bd5c0d20831290649bbca56 | |
parent | b27b28cb445975dc02d2e7d9437d23af76a51571 (diff) |
ipv6: Introduce ipv6_addr_is_solict_mult() to check Solicited Node Multicast Addresses.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/addrconf.h | 8 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index c6a44213fc74..3a3eeb407f4b 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -305,6 +305,14 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr) | |||
305 | return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); | 305 | return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); |
306 | } | 306 | } |
307 | 307 | ||
308 | static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) | ||
309 | { | ||
310 | return (addr->s6_addr32[0] == htonl(0xff020000) && | ||
311 | addr->s6_addr32[1] == htonl(0x00000000) && | ||
312 | addr->s6_addr32[2] == htonl(0x00000001) && | ||
313 | addr->s6_addr[12] == 0xff); | ||
314 | } | ||
315 | |||
308 | #ifdef CONFIG_PROC_FS | 316 | #ifdef CONFIG_PROC_FS |
309 | extern int if6_proc_init(void); | 317 | extern int if6_proc_init(void); |
310 | extern void if6_proc_exit(void); | 318 | extern void if6_proc_exit(void); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 350f86005c13..903191adb5ca 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -685,11 +685,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
685 | * RFC2461 7.1.1: | 685 | * RFC2461 7.1.1: |
686 | * DAD has to be destined for solicited node multicast address. | 686 | * DAD has to be destined for solicited node multicast address. |
687 | */ | 687 | */ |
688 | if (dad && | 688 | if (dad && !ipv6_addr_is_solict_mult(daddr)) { |
689 | !(daddr->s6_addr32[0] == htonl(0xff020000) && | ||
690 | daddr->s6_addr32[1] == htonl(0x00000000) && | ||
691 | daddr->s6_addr32[2] == htonl(0x00000001) && | ||
692 | daddr->s6_addr [12] == 0xff )) { | ||
693 | ND_PRINTK(2, warn, "NS: bad DAD packet (wrong destination)\n"); | 689 | ND_PRINTK(2, warn, "NS: bad DAD packet (wrong destination)\n"); |
694 | return; | 690 | return; |
695 | } | 691 | } |