Re: [PATCH v3 2/2] openvswitch: Remove padding from packet before L3+ conntrack processing

2018-01-22 Thread Pravin Shelar
On Mon, Jan 22, 2018 at 6:42 PM, Ed Swierk  wrote:
> In the OVS conntrack receive path, ovs_ct_execute() pulls the skb to
> the L3 header but does not trim it to the L3 length before calling
> nf_conntrack_in(NF_INET_PRE_ROUTING). When nf_conntrack_proto_tcp
> encounters a packet with lower-layer padding, nf_checksum() fails and
> logs "nf_ct_tcp: bad TCP checksum". While extra zero bytes don't
> affect the checksum, the length in the IP pseudoheader does. That
> length is based on skb->len, and without trimming, it doesn't match
> the length the sender used when computing the checksum.
>
> In ovs_ct_execute(), call skb_network_trim() before any L3+ conntrack
> processing.
>
> Signed-off-by: Ed Swierk 

Acked-by: Pravin B Shelar 

Thanks.


[PATCH v3 2/2] openvswitch: Remove padding from packet before L3+ conntrack processing

2018-01-22 Thread Ed Swierk
In the OVS conntrack receive path, ovs_ct_execute() pulls the skb to
the L3 header but does not trim it to the L3 length before calling
nf_conntrack_in(NF_INET_PRE_ROUTING). When nf_conntrack_proto_tcp
encounters a packet with lower-layer padding, nf_checksum() fails and
logs "nf_ct_tcp: bad TCP checksum". While extra zero bytes don't
affect the checksum, the length in the IP pseudoheader does. That
length is based on skb->len, and without trimming, it doesn't match
the length the sender used when computing the checksum.

In ovs_ct_execute(), call skb_network_trim() before any L3+ conntrack
processing.

Signed-off-by: Ed Swierk 
---
 net/openvswitch/conntrack.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index d558e88..1d24709 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -,6 +,10 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb,
nh_ofs = skb_network_offset(skb);
skb_pull_rcsum(skb, nh_ofs);
 
+   err = skb_network_trim(skb);
+   if (err)
+   return err;
+
if (key->ip.frag != OVS_FRAG_TYPE_NONE) {
err = handle_fragments(net, key, info->zone.id, skb);
if (err)
-- 
1.9.1