netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* veth regression with "don’t modify ip_summed; doing so treats packets with bad checksums as good."
@ 2016-03-24 22:01 Ben Greear
       [not found] ` <CAKUBDd91rR7QTwCO6L6ZfRe4fuHw0L5+Zi7qm0uF018dwVGCLg@mail.gmail.com>
  2016-03-24 23:56 ` Cong Wang
  0 siblings, 2 replies; 32+ messages in thread
From: Ben Greear @ 2016-03-24 22:01 UTC (permalink / raw)
  To: netdev, ej, vijayp; +Cc: Cong Wang

I have an application that creates two pairs of veth devices.

a <-> b       c <-> d

b and c have a raw packet socket opened on them and I 'bridge' frames
between b and c to provide network emulation (ie, configurable delay).


I put IP 1.1.1.1/24 on a, 1.1.1.2/24 on d, and then create a UDP connection
(using policy based routing to ensure frames are sent on the appropriate
interfaces).

This is user-space only app, and kernel in this case is completely unmodified.

The commit below breaks this feature:  UDP frames are sniffed on both a and d ports
(in both directions), but the UDP socket does not receive frames.

Using normal ethernet ports, this network emulation feature works fine, so it is
specific to VETH.

A similar test with just sending UDP between a single veth pair:  e <-> f
works fine.  Maybe it has something to do with raw packets?


The patch below is the culprit:


[greearb@ben-dt3 linux-2.6]$ git bisect bad
ce8c839b74e3017996fad4e1b7ba2e2625ede82f is the first bad commit
commit ce8c839b74e3017996fad4e1b7ba2e2625ede82f
Author: Vijay Pandurangan <vijayp@vijayp.ca>
Date:   Fri Dec 18 14:34:59 2015 -0500

     veth: don’t modify ip_summed; doing so treats packets with bad checksums as good.

     Packets that arrive from real hardware devices have ip_summed ==
     CHECKSUM_UNNECESSARY if the hardware verified the checksums, or
     CHECKSUM_NONE if the packet is bad or it was unable to verify it. The
     current version of veth will replace CHECKSUM_NONE with
     CHECKSUM_UNNECESSARY, which causes corrupt packets routed from hardware to
     a veth device to be delivered to the application. This caused applications
     at Twitter to receive corrupt data when network hardware was corrupting
     packets.

...

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0ef4a5a..ba21d07 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -117,12 +117,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
                 kfree_skb(skb);
                 goto drop;
         }
-       /* don't change ip_summed == CHECKSUM_PARTIAL, as that
-        * will cause bad checksum on forwarded packets
-        */
-       if (skb->ip_summed == CHECKSUM_NONE &&
-           rcv->features & NETIF_F_RXCSUM)
-               skb->ip_summed = CHECKSUM_UNNECESSARY;

         if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
                 struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);


Any suggestions for how to fix this so that I get the old working behaviour and
the bug this patch was trying to fix is also resolved?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

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

end of thread, other threads:[~2016-04-07 18:32 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 22:01 veth regression with "don’t modify ip_summed; doing so treats packets with bad checksums as good." Ben Greear
     [not found] ` <CAKUBDd91rR7QTwCO6L6ZfRe4fuHw0L5+Zi7qm0uF018dwVGCLg@mail.gmail.com>
2016-03-24 22:57   ` Ben Greear
2016-03-24 23:56 ` Cong Wang
2016-03-25  0:06   ` Ben Greear
2016-03-25  1:11     ` Ben Greear
2016-03-25  1:13       ` Ben Greear
2016-03-25  1:44         ` Vijay Pandurangan
2016-03-25  4:34           ` Ben Greear
2016-03-25  4:41             ` Vijay Pandurangan
2016-03-25  4:45               ` Vijay Pandurangan
2016-03-25  5:07                 ` Ben Greear
2016-03-25  5:24                   ` Vijay Pandurangan
2016-03-25 14:35                     ` Ben Greear
2016-03-25 21:51                       ` Vijay Pandurangan
2016-03-25  5:06             ` Cong Wang
2016-03-25  5:13               ` Ben Greear
2016-03-25  5:33                 ` Cong Wang
2016-03-25 16:10                   ` Ben Greear
2016-03-25 16:32                     ` Cong Wang
2016-03-25 16:45                       ` David Miller
2016-03-25 16:44                     ` David Miller
2016-03-25 17:14                       ` Ben Greear
2016-03-25 19:00                         ` David Miller
2016-03-25 20:56                   ` Ben Greear
2016-03-25 21:59                     ` Vijay Pandurangan
2016-03-25 22:23                       ` Ben Greear
2016-03-25 23:03                         ` Vijay Pandurangan
2016-03-25 23:46                           ` Ben Greear
2016-04-07 15:11                             ` Vijay Pandurangan
2016-04-07 18:32                               ` Ben Greear
2016-03-25 22:23                       ` Cong Wang
2016-03-25 22:16                     ` Cong Wang

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).