From: YOSHIFUJI Hideaki / 吉藤英明 Date: Sun, 20 Jan 2013 07:39:00 +0000 (+0000) Subject: ipv6: Introduce ipv6_addr_is_solict_mult() to check Solicited Node Multicast Addresses. X-Git-Tag: MMI-PSA29.97-13-9~15013^2~317 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ca97a644d752b46e5e08526e36705c3b0dd03f5f;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ipv6: Introduce ipv6_addr_is_solict_mult() to check Solicited Node Multicast Addresses. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- 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) return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); } +static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) +{ + return (addr->s6_addr32[0] == htonl(0xff020000) && + addr->s6_addr32[1] == htonl(0x00000000) && + addr->s6_addr32[2] == htonl(0x00000001) && + addr->s6_addr[12] == 0xff); +} + #ifdef CONFIG_PROC_FS extern int if6_proc_init(void); 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) * RFC2461 7.1.1: * DAD has to be destined for solicited node multicast address. */ - if (dad && - !(daddr->s6_addr32[0] == htonl(0xff020000) && - daddr->s6_addr32[1] == htonl(0x00000000) && - daddr->s6_addr32[2] == htonl(0x00000001) && - daddr->s6_addr [12] == 0xff )) { + if (dad && !ipv6_addr_is_solict_mult(daddr)) { ND_PRINTK(2, warn, "NS: bad DAD packet (wrong destination)\n"); return; }