From: ebiederm@xmission•com (Eric W. Biederman)
To: David Miller <davem@davemloft•net>
Cc: netdev@vger•kernel.org,
"Michał Mirosław" <mirq-linux@rere•qmqm.pl>,
"Eric Dumazet" <eric.dumazet@gmail•com>,
"Arnd Bergmann" <arnd@arndb•de>,
"Ben Greear" <greearb@candelatech•com>,
"Patrick McHardy" <kaber@trash•net>,
"Daniel Lezcano" <daniel.lezcano@free•fr>,
"Pavel Emelyanov" <xemul@openvz•org>
Subject: [PATCH] veth: Fix the byte counters
Date: Mon, 21 Mar 2011 14:40:29 -0700 [thread overview]
Message-ID: <m1oc54i242.fsf@fess.ebiederm.org> (raw)
Commit 44540960 "veth: move loopback logic to common location" introduced
a bug in the packet counters. I don't understand why that happened as it
is not explained in the comments and the mut check in dev_forward_skb
retains the assumption that skb->len is the total length of the packet.
I just measured this emperically by setting up a veth pair between two
noop network namespaces setting and attempting a telnet connection between
the two. I saw three packets in each direction and the byte counters were
exactly 14*3 = 42 bytes high in each direction. I got the actual
packet lengths with tcpdump.
So remove the extra ETH_HLEN from the veth byte count totals.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks•com>
---
drivers/net/veth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 105d7f0..2de9b90 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -171,7 +171,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
if (skb->ip_summed == CHECKSUM_NONE)
skb->ip_summed = rcv_priv->ip_summed;
- length = skb->len + ETH_HLEN;
+ length = skb->len;
if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)
goto rx_drop;
--
1.7.4
next reply other threads:[~2011-03-21 21:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 21:40 Eric W. Biederman [this message]
2011-03-22 1:25 ` [PATCH] veth: Fix the byte counters David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1oc54i242.fsf@fess.ebiederm.org \
--to=ebiederm@xmission$(echo .)com \
--cc=arnd@arndb$(echo .)de \
--cc=daniel.lezcano@free$(echo .)fr \
--cc=davem@davemloft$(echo .)net \
--cc=eric.dumazet@gmail$(echo .)com \
--cc=greearb@candelatech$(echo .)com \
--cc=kaber@trash$(echo .)net \
--cc=mirq-linux@rere$(echo .)qmqm.pl \
--cc=netdev@vger$(echo .)kernel.org \
--cc=xemul@openvz$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox