summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-01-20 15:18:11 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-01-20 15:37:08 +0100
commitaa00a9646292f6950fc3d2a8d7d11f02a9815a8e (patch)
tree8653b4882749b3e8c2c6697c4cb0ecf2492db151
parentfca6f60a44a75f76d2c1183f06466228b01b9686 (diff)
downloadNPTv6-aa00a9646292f6950fc3d2a8d7d11f02a9815a8e.tar
NPTv6-aa00a9646292f6950fc3d2a8d7d11f02a9815a8e.zip
Fix translation for non-multiple of 16 prefix lengths
-rw-r--r--ip6t_NPTV6_common.h4
1 files 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);
}