Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp635614rwb; Tue, 4 Oct 2022 08:36:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qGYjjsyVGEohqbr2hIH3uPTqyo/oAdfwVxAz0lYtkcJG48+91A3NMXd/S0nm73KuCok70 X-Received: by 2002:a63:6a47:0:b0:43c:a935:f0f with SMTP id f68-20020a636a47000000b0043ca9350f0fmr24149126pgc.95.1664897780534; Tue, 04 Oct 2022 08:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664897780; cv=none; d=google.com; s=arc-20160816; b=F7Xl/uhhySQqHCQeDFjMEv49IlMAYzW0dNQcIIpZ4mXKcxF5btwQGDVpyzQuNv/PWh xdWkX5kWqxbk7d34zMMymmTyQ0qE4AzBVORKNQxjov5dt+NMZuwKmr+2R/euoDMS2lWA XG+Reu4E7ODyAx966NuEO5+0Hcna02O7eB/GjK+xoPvRa9Snnf71+PgdeUZ/zHjnhOII mFfNKETLjhCZaiph+TOj+10B67U1rd2lhXgIx8qhgAnVQxViv9DWXBI5XdPzjvM4nbFM dB6qGlI1rs7E/Rta0QgoaXdjRHQlL3/Y/QcN+AJssbtAvmKu77pT+YKozhRWAVr1dAD/ 7HNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=7qDrOFS4iNWM1jdTMZCr4vdLiQ5ahToHR7yfAPyFhmQ=; b=OolcAr/haQx1F/A8piOsbdrmqx1Dsd+RbZn9V+SrWrS7zqcx6c/xp6qOZE+a/VImVL HYoWSuZDg78v6ksulFhl45TDN9ALokPTfttpHmHsCCsNlv56G+XLX6cvBkWiigFVY7WL 1/gprbUAyPGsFuONGaJY6hjzde4GEQbBFd7fjRsaV7lTJ3Cgca+xIkTy6RX6j0i2+Jej PTBLTzLn0HWcQ1/1aXtEULBdiimb5LJBs8ZMl6D8RfRO48Xd4uw/27zRewI8rUXkc6hi H+cj3i1D+8wCvp/lCG8CB7FulMkDVx+b9S+l0R3ys7Yfc7X9tSP/l7TAKkOfHvbOwMrM gTsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a056a0008c800b00541505b05dbsi14812951pfu.31.2022.10.04.08.36.08; Tue, 04 Oct 2022 08:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbiJDPU6 (ORCPT + 99 others); Tue, 4 Oct 2022 11:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiJDPUv (ORCPT ); Tue, 4 Oct 2022 11:20:51 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A606A5C978; Tue, 4 Oct 2022 08:20:49 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 3B7B11884B7E; Tue, 4 Oct 2022 15:20:48 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 094D625001FA; Tue, 4 Oct 2022 15:20:48 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id D49EE9EC000E; Tue, 4 Oct 2022 15:20:47 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 Received: from fujitsu.vestervang (2-104-116-184-cable.dk.customer.tdc.net [2.104.116.184]) by smtp.gigahost.dk (Postfix) with ESMTPSA id 021779120FED; Tue, 4 Oct 2022 15:20:46 +0000 (UTC) From: Hans Schultz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Hans Schultz , Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com, Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Shuah Khan , Russell King , Christian Marangi , Daniel Borkmann , Yuwei Wang , Petr Machata , Ido Schimmel , Florent Fourcot , Hans Schultz , Joachim Wiberg , Amit Cohen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 iproute2-next 2/4] bridge: fdb: show locked FDB entries flag in output Date: Tue, 4 Oct 2022 17:20:34 +0200 Message-Id: <20221004152036.7848-2-netdev@kapio-technology.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221004152036.7848-1-netdev@kapio-technology.com> References: <20221004152036.7848-1-netdev@kapio-technology.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Hans Schultz --- bridge/fdb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bridge/fdb.c b/bridge/fdb.c index 5f71bde0..f1f0a5bb 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -93,7 +93,7 @@ static int state_a2n(unsigned int *s, const char *arg) return 0; } -static void fdb_print_flags(FILE *fp, unsigned int flags) +static void fdb_print_flags(FILE *fp, unsigned int flags, __u8 ext_flags) { open_json_array(PRINT_JSON, is_json_context() ? "flags" : ""); @@ -116,6 +116,9 @@ static void fdb_print_flags(FILE *fp, unsigned int flags) if (flags & NTF_STICKY) print_string(PRINT_ANY, NULL, "%s ", "sticky"); + if (ext_flags & NTF_EXT_LOCKED) + print_string(PRINT_ANY, NULL, "%s ", "locked"); + close_json_array(PRINT_JSON, NULL); } @@ -144,6 +147,7 @@ int print_fdb(struct nlmsghdr *n, void *arg) struct ndmsg *r = NLMSG_DATA(n); int len = n->nlmsg_len; struct rtattr *tb[NDA_MAX+1]; + __u32 ext_flags = 0; __u16 vid = 0; if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH) { @@ -170,6 +174,9 @@ int print_fdb(struct nlmsghdr *n, void *arg) parse_rtattr(tb, NDA_MAX, NDA_RTA(r), n->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); + if (tb[NDA_FLAGS_EXT]) + ext_flags = rta_getattr_u32(tb[NDA_FLAGS_EXT]); + if (tb[NDA_VLAN]) vid = rta_getattr_u16(tb[NDA_VLAN]); @@ -266,7 +273,7 @@ int print_fdb(struct nlmsghdr *n, void *arg) if (show_stats && tb[NDA_CACHEINFO]) fdb_print_stats(fp, RTA_DATA(tb[NDA_CACHEINFO])); - fdb_print_flags(fp, r->ndm_flags); + fdb_print_flags(fp, r->ndm_flags, ext_flags); if (tb[NDA_MASTER]) -- 2.34.1