From aa00a9646292f6950fc3d2a8d7d11f02a9815a8e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 20 Jan 2012 15:18:11 +0100 Subject: Fix translation for non-multiple of 16 prefix lengths --- ip6t_NPTV6_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ip6t_NPTV6_common.h b/ip6t_NPTV6_common.h index efb5aa5..c307c44 100644 --- a/ip6t_NPTV6_common.h +++ b/ip6t_NPTV6_common.h @@ -87,11 +87,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); } -- cgit v1.2.3