Re: [PATCH v2] netfilter: fix bad checksum on IPv6 when NAT is performed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 8, 2015 at 2:26 PM, Maxime Bizon <mbizon@xxxxxxxxxx> 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 netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux