lkml.org 
[lkml]   [2013]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 25/73] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
    Date
    3.8-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Matthias Schiffer <mschiffer@universe-factory.net>

    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>

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

    --- 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 struc
    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;



    \
     
     \ /
      Last update: 2013-05-10 02:21    [W:4.147 / U:0.156 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site