diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-01-20 15:18:11 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-01-20 15:37:39 +0100 |
commit | 4aabd42dc46e95632de8ae64281ce655b3f35f25 (patch) | |
tree | c97a2ad7e81678d20badf3cb410e229958814805 | |
parent | 9f0da7662e647962f8ec3e1553cfdbae2d77af5b (diff) | |
download | NPTv6-4aabd42dc46e95632de8ae64281ce655b3f35f25.tar NPTv6-4aabd42dc46e95632de8ae64281ce655b3f35f25.zip |
Fix translation for non-multiple of 16 prefix lengths
-rw-r--r-- | ip6t_NPTV6_common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ip6t_NPTV6_common.h b/ip6t_NPTV6_common.h index 4a0c807..1559090 100644 --- a/ip6t_NPTV6_common.h +++ b/ip6t_NPTV6_common.h @@ -72,11 +72,11 @@ static bool translate_address(struct in6_addr *addr, const struct in6_addr *pref } if (b != 0) { - u_int16_t bmask = 0xffff << (16-b); + u_int16_t bmask = htons(0xffff << (16-b)); csum = add16(csum, addr->s6_addr16[o] & bmask); csum = add16(csum, ~(prefix->s6_addr16[o] & bmask)); - addr->s6_addr16[o] &= bmask; + addr->s6_addr16[o] &= ~bmask; addr->s6_addr16[o] |= (prefix->s6_addr16[o] & bmask); } |