diff options
author | Matthias Schiffer | 2013-03-30 05:23:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-05-11 15:53:56 -0500 |
commit | 6be0e000f32e975c79852d2d990a09cad41fc605 (patch) | |
tree | 881b88d416efdebc0ba230cd5939095a4b591f4e | |
parent | 6fc08dc6f89960aaf27149f8031009fdc8062a70 (diff) | |
download | kernel-omap-6be0e000f32e975c79852d2d990a09cad41fc605.tar.gz kernel-omap-6be0e000f32e975c79852d2d990a09cad41fc605.tar.xz kernel-omap-6be0e000f32e975c79852d2d990a09cad41fc605.zip |
netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
commit 906b1c394d0906a154fbdc904ca506bceb515756 upstream.
The bitmask used for the prefix mangling was being calculated
incorrectly, leading to the wrong part of the address being replaced
when the prefix length wasn't a multiple of 32.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv6/netfilter/ip6t_NPT.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index 83acc1405a18..0ea43c7024d5 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c | |||
@@ -57,7 +57,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt, | |||
57 | if (pfx_len - i >= 32) | 57 | if (pfx_len - i >= 32) |
58 | mask = 0; | 58 | mask = 0; |
59 | else | 59 | else |
60 | mask = htonl(~((1 << (pfx_len - i)) - 1)); | 60 | mask = htonl((1 << (i - pfx_len + 32)) - 1); |
61 | 61 | ||
62 | idx = i / 32; | 62 | idx = i / 32; |
63 | addr->s6_addr32[idx] &= mask; | 63 | addr->s6_addr32[idx] &= mask; |