Commit cb78b143 authored by Jean-Luc Richier's avatar Jean-Luc Richier Committed by David S. Miller

[IPV6] Fix ipv6_addr_prefix() for prefixlen != 0 (mod 8)

parent faa1cc2a
...@@ -276,8 +276,10 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, ...@@ -276,8 +276,10 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx,
b = plen & 0x7; b = plen & 0x7;
memcpy(pfx->s6_addr, addr, o); memcpy(pfx->s6_addr, addr, o);
if (b != 0) if (b != 0) {
pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b);
o++;
}
if (o < 16) if (o < 16)
memset(pfx->s6_addr + o, 0, 16 - o); memset(pfx->s6_addr + o, 0, 16 - o);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment