netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
@ 2013-03-30 20:03 Matthias Schiffer
  2013-03-30 20:23 ` [PATCHv2] " Matthias Schiffer
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Schiffer @ 2013-03-30 20:03 UTC (permalink / raw)
  To: netfilter-devel

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>
---
Hi, this patch should to 3.9 and, if possible, 3.8-stable.

Regards,
Matthias Schiffer

 net/ipv6/netfilter/ip6t_NPT.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 33608c6..c476f16 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,
 		if (pfx_len - i >= 32)
 			mask = 0;
 		else
-			mask = htonl(~((1 << (pfx_len - i)) - 1));
+			mask = htonl(((1 << (i - pfx_len + 32)) - 1));
 
 		idx = i / 32;
 		addr->s6_addr32[idx] &= mask;
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCHv2] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
  2013-03-30 20:03 [PATCH] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths Matthias Schiffer
@ 2013-03-30 20:23 ` Matthias Schiffer
  2013-04-03  9:42   ` Matthias Schiffer
  2013-04-03 10:21   ` Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Matthias Schiffer @ 2013-03-30 20:23 UTC (permalink / raw)
  To: netfilter-devel

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>
---
Hi, this patch should to 3.9 and, if possible, 3.8-stable.

v2: Remove a redundant pair of parentheses.

Regards,
Matthias Schiffer

 net/ipv6/netfilter/ip6t_NPT.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 33608c6..cb63114 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,
 		if (pfx_len - i >= 32)
 			mask = 0;
 		else
-			mask = htonl(~((1 << (pfx_len - i)) - 1));
+			mask = htonl((1 << (i - pfx_len + 32)) - 1);
 
 		idx = i / 32;
 		addr->s6_addr32[idx] &= mask;
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
  2013-03-30 20:23 ` [PATCHv2] " Matthias Schiffer
@ 2013-04-03  9:42   ` Matthias Schiffer
  2013-04-03 10:21   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Matthias Schiffer @ 2013-04-03  9:42 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo, kaber

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On 03/30/2013 09:23 PM, Matthias Schiffer wrote:
> 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>
> ---
> Hi, this patch should to 3.9 and, if possible, 3.8-stable.
> 
> v2: Remove a redundant pair of parentheses.
> 
> Regards,
> Matthias Schiffer
> 

*ping* Anybody read the patch? Any comments?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
  2013-03-30 20:23 ` [PATCHv2] " Matthias Schiffer
  2013-04-03  9:42   ` Matthias Schiffer
@ 2013-04-03 10:21   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-03 10:21 UTC (permalink / raw)
  To: Matthias Schiffer; +Cc: netfilter-devel

On Sat, Mar 30, 2013 at 09:23:12PM +0100, Matthias Schiffer wrote:
> 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.

Applied, thanks Matthias.

> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---
> Hi, this patch should to 3.9 and, if possible, 3.8-stable.

Will do.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-03 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-30 20:03 [PATCH] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths Matthias Schiffer
2013-03-30 20:23 ` [PATCHv2] " Matthias Schiffer
2013-04-03  9:42   ` Matthias Schiffer
2013-04-03 10:21   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).