lkml.org 
[lkml]   [2022]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v2 net-next] net-core: add InMacErrors counter
On Tue, 25 Jan 2022 19:07:17 +0000 Jeffrey Ji wrote:
> From: jeffreyji <jeffreyji@google.com>
>
> Increment InMacErrors counter when packet dropped due to incorrect 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
>
> example output from nstat:
> \~# nstat -a | grep InMac
> Ip6InMacErrors 0 0.0
> IpExtInMacErrors 1 0.0
>
> Tested: Created 2 netns, sent 1 packet using trafgen from 1 to the other
> with "{eth(daddr=$INCORRECT_MAC...}", verified that nstat showed the
> counter was incremented.

> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 80256717868e..2903869274ca 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -150,6 +150,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
> struct inet6_dev *idev;
>
> if (skb->pkt_type == PACKET_OTHERHOST) {
> + __IP6_INC_STATS(net, idev, IPSTATS_MIB_INMACERRORS);

Clang points out idev is not initialized at this point, yet.

\
 
 \ /
  Last update: 2022-01-26 00:02    [W:0.036 / U:1.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site