[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALx6S34mEeFT_4kBWnEJ2H8P7+FCG_ZpN-CUEgSj4FBH1YeeeQ@mail.gmail.com>
Date: Thu, 8 Oct 2015 15:11:50 -0700
From: Tom Herbert <tom@...bertland.com>
To: mbizon@...ebox.fr
Cc: netdev <netdev@...r.kernel.org>, davem <davem@...emloft.net>,
kaber <kaber@...sh.net>, pablo@...filter.org,
netfilter-devel <netfilter-devel@...r.kernel.org>
Subject: Re: [PATCH v2] netfilter: fix bad checksum on IPv6 when NAT is performed
On Thu, Oct 8, 2015 at 2:26 PM, Maxime Bizon <mbizon@...ebox.fr> wrote:
>
> On Thu, 2015-10-08 at 14:09 -0700, Tom Herbert wrote:
>
>> I think inet_proto_csum_replace16 should be called here.
>
> inet_proto_csum_replace16() wants a non NULL checksum pointer to update,
> and there is no such thing here.
>
> I could pass a dummy value, but inet_proto_csum_replace16() will do
> twice more work for nothing
>
> or I could modify inet_proto_csum_replace16() to allow a NULL sum
> argument.
>
If I am reading the code correctly, it looks like
inet_proto_csum_replace16 is called from
{tcp,dccp,tcp.udp,udplite}_manip_pkt via l3proto->csum_update which is
a call to nf_nat_ipv6_csum_update for IPv6. So for these protocols
when the transport checksum is updated skb->csum is also correctly
updated. For other protocols or when UDP checksum is zero or for
fragments-- I don't see where skb->csum is being properly updated.
This potentially seems to be a major bug.
I would suggest:
1) Modify the inet_proto_csum_replace* routines to check for NULL
check pointer and and only write it when non-NULL
2) Call l3proto->csum_update from unknown_manip_pkt with check == NULL
3) In udp_manip_pkt call l3proto->csum_update with check = NULL when
UDP checksum is zero
4) For IPv6 fragments call l3proto->csum_update with check = NULL
Tom
> --
> Maxime
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists