Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5096673pxb; Wed, 26 Jan 2022 04:51:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMxUeiiw1NBgcEjTXsBzpBCHVH0Rp3GFH4ds4WSLUWpXcKbQhOP+5JApAsLjONj91ag457 X-Received: by 2002:a17:907:724c:: with SMTP id ds12mr19889626ejc.181.1643201496629; Wed, 26 Jan 2022 04:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643201496; cv=none; d=google.com; s=arc-20160816; b=EFiCggzxV+PRpXITIWKHC3GSMy/TeTZriXcxqe0PSBqVQnjbgcUlInsRRVLslWbCvF HA4UYh84NOhV9gf2rbnvvZIl2xHj1Ukub/Ap4a+EfYkNx1OpV5PDCQCKefx2uMKrtF6p 5pyOhpDALCbjyNO0nATJjzWnGG9f15sZJnGzjeZPfrvYOHagdcbQBY+ddhiMvXql2xJS +m+utYx7KW5e/TRLN80kw2tTK9kifMcehJWpC+WpqNbDgc0aRuhBs3KG+oEf6iYF4QbV pkSYY8K2QlfC6jvW8LSdChfOkFUzZEgxTT4C1RODnMGhHFgl0uLB9lpVgN61IgtDzX2e ya5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kKseE2EizlBUxzNXQi3dNUAKFkSPoe6rOZ0z9gNT0+M=; b=FvSwmFhzjO4yNerBfw6uVVFRO4xQnAjNvLhlXjU8SsVNqG9L6F9I1XThmok+BOnLHZ RVKTtP/lxFCWYSLCASSV0nNpH4t/8NbqtJ978zG1wOs/cfke/UfV9WQOZIt/vxhb3E7o 8MbrVw+RXkD+MqFuSeGB8EbvSjm3j23m5/w7bJReUBod0QY2cnbUCjvpAN10L41XiS13 ZSoxuj7iFx1qYkyUOeSzBudT3kL3X5wIKcjjOfpLjRpRLRH6cLP83PN3R8VuFyNsFoFg ofeIVq6Iy2RALf3DjgK+lxlm5vM5AHce4BWs4h5u89F1Wk8zK4yLi36Ktn13/TRC2WCz xvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HXBS2spG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si3010872edc.196.2022.01.26.04.51.00; Wed, 26 Jan 2022 04:51:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HXBS2spG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234544AbiAYXBi (ORCPT + 99 others); Tue, 25 Jan 2022 18:01:38 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:58116 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234534AbiAYXBh (ORCPT ); Tue, 25 Jan 2022 18:01:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8A266CE1B77; Tue, 25 Jan 2022 23:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93FF3C340E0; Tue, 25 Jan 2022 23:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643151693; bh=KqrPjnST4T/693ZtQvTVZgR8S99aEPz7KM7WLhgCZYQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HXBS2spGqbJUazPgaxyit/sTd5D67dnsxLFYoPq4Z+U1fQLYtC1CdDu/U3skN2RkO 1pSWFa+hxlS+WhtBq6RUs29a69qowzVPEO/xQW75ZCJ5ON013FgHtM7ZSyFPKd9amT 6QCuvU85sTe1uccaqkMGfMp5DZP1qdB2fcO35RvWWrVNxdx1QE4JXz+OX0qwicfXoA DJxFrL4FWDHcihWmdSFzTuNZTvDN/AMEXaFg9EOQl5Plf3GuBZmZQw+Bh3BBnrejlB GMLxgUvg7D6ztj/rMOxMugFeZGRbZGXF9fNi2RUPDF1F+GkzLNfzWwvIbiHLFCmu4E WAKeniml+dXEg== Date: Tue, 25 Jan 2022 15:01:32 -0800 From: Jakub Kicinski To: Jeffrey Ji Cc: Eric Dumazet , "David S . Miller" , Brian Vazquez , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, jeffreyji Subject: Re: [PATCH v2 net-next] net-core: add InMacErrors counter Message-ID: <20220125150132.3f4291fa@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20220125190717.2459068-1-jeffreyji@google.com> References: <20220125190717.2459068-1-jeffreyji@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Jan 2022 19:07:17 +0000 Jeffrey Ji wrote: > From: jeffreyji > > 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.