diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 31b3f1b..4f47d29 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -368,6 +368,11 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1, prefixlen); } +static inline int ipv6_addr_linklocal(const struct in6_addr *a) +{ + return ((a->s6_addr32[0] & htonl(0xFFC00000)) == htonl(0xFE800000)); +} + static inline int ipv6_addr_any(const struct in6_addr *a) { return ((a->s6_addr32[0] | a->s6_addr32[1] | diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 74c4d8d..8f953a7 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1267,7 +1267,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) if (ipv6_addr_equal(dest, target)) { on_link = 1; - } else if (!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { + } else if (!ipv6_addr_linklocal(target)) { ND_PRINTK2(KERN_WARNING "ICMPv6 Redirect: target address is not link-local.\n"); return; @@ -1343,7 +1343,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, } if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) && - !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { + !ipv6_addr_linklocal(target)) { ND_PRINTK2(KERN_WARNING "ICMPv6 Redirect: target address is not link-local.\n"); return;