aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorJeffrey Ji <jeffreyji@google.com>2022-04-06 17:26:00 +0000
committerJakub Kicinski <kuba@kernel.org>2022-04-07 20:32:49 -0700
commit794c24e9921f32ded4422833a990ccf11dc3c00e (patch)
tree000df9bb5f87c8d77389e43c1b5171aafa6f6517 /net/core/dev.c
parentMerge branch 'net-create-a-net-core-internal-header' (diff)
downloadlinux-dev-794c24e9921f32ded4422833a990ccf11dc3c00e.tar.xz
linux-dev-794c24e9921f32ded4422833a990ccf11dc3c00e.zip
net-core: rx_otherhost_dropped to core_stats
Increment rx_otherhost_dropped counter when packet dropped due to mismatched dest MAC addr. An example when this drop can occur is when manually crafting raw packets that will be consumed by a user space application via a tap device. For testing purposes local traffic was generated using trafgen for the client and netcat to start a server Tested: Created 2 netns, sent 1 packet using trafgen from 1 to the other with "{eth(daddr=$INCORRECT_MAC...}", verified that iproute2 showed the counter was incremented. (Also had to modify iproute2 to show the stat, additional patch for that coming next.) Signed-off-by: Jeffrey Ji <jeffreyji@google.com> Reviewed-by: Brian Vazquez <brianvv@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20220406172600.1141083-1-jeffreyjilinux@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index f00d29856b43..e027410e861b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10358,6 +10358,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
storage->rx_dropped += local_read(&core_stats->rx_dropped);
storage->tx_dropped += local_read(&core_stats->tx_dropped);
storage->rx_nohandler += local_read(&core_stats->rx_nohandler);
+ storage->rx_otherhost_dropped += local_read(&core_stats->rx_otherhost_dropped);
}
}
return storage;