From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86AD2C10F14 for ; Thu, 3 Oct 2019 19:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D47D20873 for ; Thu, 3 Oct 2019 19:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732348AbfJCTE6 (ORCPT ); Thu, 3 Oct 2019 15:04:58 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:47376 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729702AbfJCTE6 (ORCPT ); Thu, 3 Oct 2019 15:04:58 -0400 Received: from localhost (unknown [IPv6:2601:601:9f00:1e2::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id D96AC146D0431; Thu, 3 Oct 2019 12:04:57 -0700 (PDT) Date: Thu, 03 Oct 2019 12:04:57 -0700 (PDT) Message-Id: <20191003.120457.1626857609490915856.davem@davemloft.net> To: olteanv@gmail.com Cc: andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, netdev@vger.kernel.org Subject: Re: [PATCH net-next] net: dsa: Allow port mirroring to the CPU port From: David Miller In-Reply-To: <20191002233750.13566-1-olteanv@gmail.com> References: <20191002233750.13566-1-olteanv@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 03 Oct 2019 12:04:58 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean Date: Thu, 3 Oct 2019 02:37:50 +0300 > On a regular netdev, putting it in promiscuous mode means receiving all > traffic passing through it, whether or not it was destined to its MAC > address. Then monitoring applications such as tcpdump can see all > traffic transiting it. > > On Ethernet switches, clearly all ports are in promiscuous mode by > definition, since they accept frames destined to any MAC address. > However tcpdump does not capture all frames transiting switch ports, > only the ones destined to, or originating from the CPU port. > > To be able to monitor frames with tcpdump on the CPU port, extend the tc > matchall classifier and mirred action to support the DSA master port as > a possible mirror target. > > Tested with: > tc qdisc add dev swp2 clsact > tc filter add dev swp2 ingress matchall skip_sw \ > action mirred egress mirror dev eth2 > tcpdump -i swp2 > > Signed-off-by: Vladimir Oltean Andrew and co., please review.