From patchwork Thu Oct 8 13:50:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 269413 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 80824C4363A for ; Thu, 8 Oct 2020 13:50:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12AD421897 for ; Thu, 8 Oct 2020 13:50:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="sKBziavh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730425AbgJHNut (ORCPT ); Thu, 8 Oct 2020 09:50:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbgJHNus (ORCPT ); Thu, 8 Oct 2020 09:50:48 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5C2C0613D2 for ; Thu, 8 Oct 2020 06:50:48 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id ce10so8225290ejc.5 for ; Thu, 08 Oct 2020 06:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b2AV8YXRBWPkekGUIXzfbnQPT4fBp6YeQuxKMHW1txQ=; b=sKBziavh1v+2QOa6E5K+BojfkIsyNDW6MqZJswp3a15wGJlUMaDKyO8SooXDvprTPS +wIArUS06N+ThbmfPrRVWxNz3xsmlJEo2pSnz0HIWIXV5X2i3Ww4j9RJbZCcLCrJcoAl ubp07y1P93a8wykRwNggkdD4HSWPtqBvUoOHmwKs9W+mqTR5uDU1QXEWgfPjoIGkXrPG 90MIvq5x/uxvT85Wc6yGbvok5m7I9JwLQ51fCeu70d7n2TlYG/MAdYN+9+9huzt/kTxT ZTPKq4b88+LrQm3nb+iMj3qO7govwNbLmPpabAYn8lIvLQHu14GHhsczGYkp5+D1RPZD kk2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b2AV8YXRBWPkekGUIXzfbnQPT4fBp6YeQuxKMHW1txQ=; b=uoF0Rnyp1GVmTS4Fh908i9/vCzYxWFBF3OfLZ15pKujOU6X+gMwbBO2n58yaXaxJJH Nr7cXSDvOXhve+sqi6ijZcqsPdZJZ5XEBD1iMwqIUycl5/j8PazzqpAxCoKzrJO8yLk6 XGfmv+mN31qa1++sdaGDxdevCGhqu+ZM1oCel6igpLk7ZnEXeIOXmQV6WGZi4cYGnVci 01cx6guxS6VHyrANohorzxuzlxGEhLyVvFSWGtTY4Dzcr/SuuIDhqGVO0Qyj/MDkYoBW kqVyfuv+QzBN/D+/CO4S5zV4beY6UnxBWZO52PkYT8nY+tD4l3Qiy+KqTfp1xWzou9+5 pk4Q== X-Gm-Message-State: AOAM5334NUPdmVykcd/R0gJAay6NORk6IXRX+hgPLDmCbfrA1VnsWHpO 6xA7NWaupbLadkK8yBJ1OV9BboBjx/dKOfqW X-Google-Smtp-Source: ABdhPJzPvtC6COt2PAmygnhdklAeweGtMNoDrbDLIyLjj9wqZ1DwdwdXSxz6yc1mpwfXfOZHYFtmWQ== X-Received: by 2002:a17:906:715a:: with SMTP id z26mr8887247ejj.300.1602165046694; Thu, 08 Oct 2020 06:50:46 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:46 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 1/6] bridge: mdb: add support for source address Date: Thu, 8 Oct 2020 16:50:19 +0300 Message-Id: <20201008135024.1515468-2-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov This patch adds the user-space control and dump of mdb entry source address. When setting the new MDBA_SET_ENTRY_ATTRS nested attribute is used and inside is added MDBE_ATTR_SOURCE based on the address family. When dumping we look for MDBA_MDB_EATTR_SOURCE and if present we add the "src x.x.x.x" output. The source address will be always shown as it's needed to match the entry to modify it from user-space. Example: $ bridge mdb add dev bridge port ens13 grp 239.0.0.1 src 1.2.3.4 permanent vid 100 $ bridge mdb show dev bridge port ens13 grp 239.0.0.1 src 1.2.3.4 permanent vid 100 Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 38 ++++++++++++++++++++++++++++++++------ man/man8/bridge.8 | 8 ++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/bridge/mdb.c b/bridge/mdb.c index 928ae56d29a7..01c8a6e389a8 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -31,7 +31,7 @@ static unsigned int filter_index, filter_vlan; static void usage(void) { fprintf(stderr, - "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp] [vid VID]\n" + "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n"); exit(-1); } @@ -118,16 +118,16 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr, static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, struct nlmsghdr *n, struct rtattr **tb) { + const void *grp, *src; SPRINT_BUF(abuf); const char *dev; - const void *src; int af; if (filter_vlan && e->vid != filter_vlan) return; af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6; - src = af == AF_INET ? (const void *)&e->addr.u.ip4 : + grp = af == AF_INET ? (const void *)&e->addr.u.ip4 : (const void *)&e->addr.u.ip6; dev = ll_index_to_name(ifindex); @@ -140,8 +140,13 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, print_color_string(PRINT_ANY, ifa_family_color(af), "grp", " grp %s", - inet_ntop(af, src, abuf, sizeof(abuf))); - + inet_ntop(af, grp, abuf, sizeof(abuf))); + if (tb && tb[MDBA_MDB_EATTR_SOURCE]) { + src = (const void *)RTA_DATA(tb[MDBA_MDB_EATTR_SOURCE]); + print_color_string(PRINT_ANY, ifa_family_color(af), + "src", " src %s", + inet_ntop(af, src, abuf, sizeof(abuf))); + } print_string(PRINT_ANY, "state", " %s", (e->state & MDB_PERMANENT) ? "permanent" : "temp"); @@ -378,8 +383,8 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) .n.nlmsg_type = cmd, .bpm.family = PF_BRIDGE, }; + char *d = NULL, *p = NULL, *grp = NULL, *src = NULL; struct br_mdb_entry entry = {}; - char *d = NULL, *p = NULL, *grp = NULL; short vid = 0; while (argc > 0) { @@ -400,6 +405,9 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) } else if (strcmp(*argv, "vid") == 0) { NEXT_ARG(); vid = atoi(*argv); + } else if (strcmp(*argv, "src") == 0) { + NEXT_ARG(); + src = *argv; } else { if (matches(*argv, "help") == 0) usage(); @@ -431,6 +439,24 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) entry.vid = vid; addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry)); + if (src) { + struct rtattr *nest = addattr_nest(&req.n, sizeof(req), + MDBA_SET_ENTRY_ATTRS); + struct in6_addr src_ip6; + __be32 src_ip4; + + nest->rta_type |= NLA_F_NESTED; + if (!inet_pton(AF_INET, src, &src_ip4)) { + if (!inet_pton(AF_INET6, src, &src_ip6)) { + fprintf(stderr, "Invalid source address \"%s\"\n", src); + return -1; + } + addattr_l(&req.n, sizeof(req), MDBE_ATTR_SOURCE, &src_ip6, sizeof(src_ip6)); + } else { + addattr32(&req.n, sizeof(req), MDBE_ATTR_SOURCE, src_ip4); + } + addattr_nest_end(&req.n, nest); + } if (rtnl_talk(&rth, &req.n, NULL) < 0) return -1; diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index b06005763bc2..84b9b70c7dea 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -116,6 +116,8 @@ bridge \- show / manipulate bridge addresses and devices .I PORT .B grp .IR GROUP " [ " +.B src +.IR SOURCE " ] [ " .BR permanent " | " temp " ] [ " .B vid .IR VID " ] " @@ -694,6 +696,12 @@ the port. - the mdb entry is temporary (default) .sp +.TP +.BI src " SOURCE" +optional source IP address of a sender for this multicast group. If IGMPv3 for IPv4, or +MLDv2 for IPv6 respectively, are enabled it will be included in the lookup when +forwarding multicast traffic. + .TP .BI vid " VID" the VLAN ID which is known to have members of this multicast group. From patchwork Thu Oct 8 13:50:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 268949 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 04A1EC4363C for ; Thu, 8 Oct 2020 13:50:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF38F21897 for ; Thu, 8 Oct 2020 13:50:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="G7ErnkHq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730431AbgJHNuu (ORCPT ); Thu, 8 Oct 2020 09:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbgJHNut (ORCPT ); Thu, 8 Oct 2020 09:50:49 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C14C061755 for ; Thu, 8 Oct 2020 06:50:49 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id h24so8204401ejg.9 for ; Thu, 08 Oct 2020 06:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FlFQHHVj4IoDeVU7kJZFVW8ehm4+dl4AEtWuRJN8els=; b=G7ErnkHq+eFr52/6R9p/y4mUxNpA161ItZ/XDkj1CG3+ty03ei0XI5msRluv/boaB7 YX9NuFvUoUI7K20Sv1x+m+u55ws1y7CA6A3LeR/0QTX0UL06G6a+pCA8BXHDw4TdxX8U bKf+ieXWGlOrdp0wKUMY14igclF7Q1AkKDUgxOBzrEXYBi1EJcFvnUmrBdNCEfzHrOGY A3DznTBYcpauCGpjnP2AEB+7ea9wUm0Biyu7LVHuVTmUVLJW8ShEUm7sOSobqutBhYvv fzaCWJ1btsaUkkE/GqfQli5urS/wWD7fbqeQ3hu6dsTCv+CvGzPykzUuIv231tKZin1V 0F+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FlFQHHVj4IoDeVU7kJZFVW8ehm4+dl4AEtWuRJN8els=; b=e4ILNcq1e8BVLmzVptIr6GkHjyuwfY31rH1p3gACzFnbfiui9KwjK9ctgC4VkPqlap OyOzkT1IDWx2Jd2TLIhxGzA+xQ2OTFISwf8VePt2O/ricTHsjlFzzXs1Ht1spNpMlojB Ezdrulsoxs6mI9C/4pXKD1c4vMKWy47RKAiI4TFRKwq7wTIuU/obZSkxDD0KVYm5m371 H5RMxjSwHu3Cbdym2m0kCmW6AfYNrmw178fluTzBuKMlsrymc2ia53p9LcRWqgC/51Oz UnicWvYuYTBjVdebG18FXuBaiAJzEgk/uvTf3AHitJEHYkPKf8zIgVhxd9UALgfFXeBT YIyw== X-Gm-Message-State: AOAM533Z8oRbeOIu4hhWeboHNF9bbkiXc0zJ8qreu/NHsySHKaFGvUOh jueQxrHeZLSL7iAzeXkaYTnY6Ld2m3/kSpGt X-Google-Smtp-Source: ABdhPJzQyl8ZIXb/E10om04StJLwH32LZ/lDuqO3B2VEtFbtncwZY57VrU1ZOMGXSMGIeEEbBO1bkQ== X-Received: by 2002:a17:906:cf9d:: with SMTP id um29mr8665238ejb.307.1602165047703; Thu, 08 Oct 2020 06:50:47 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:47 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 2/6] bridge: mdb: print fast_leave flag Date: Thu, 8 Oct 2020 16:50:20 +0300 Message-Id: <20201008135024.1515468-3-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov We're not showing the fast_leave flag when it's set. Currently that can be only when an mdb entry is being deleted due to fast leave, so it will only affect mdb monitor. Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bridge/mdb.c b/bridge/mdb.c index 01c8a6e389a8..94cd3c3b2390 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -153,6 +153,8 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, open_json_array(PRINT_JSON, "flags"); if (e->flags & MDB_FLAGS_OFFLOAD) print_string(PRINT_ANY, NULL, " %s", "offload"); + if (e->flags & MDB_FLAGS_FAST_LEAVE) + print_string(PRINT_ANY, NULL, " %s", "fast_leave"); close_json_array(PRINT_JSON, NULL); if (e->vid) From patchwork Thu Oct 8 13:50:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 269411 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 AF63BC04EBE for ; Thu, 8 Oct 2020 13:50:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5218121897 for ; Thu, 8 Oct 2020 13:50:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="ilnXroto" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730440AbgJHNu5 (ORCPT ); Thu, 8 Oct 2020 09:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730430AbgJHNuv (ORCPT ); Thu, 8 Oct 2020 09:50:51 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D5CC061755 for ; Thu, 8 Oct 2020 06:50:50 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id dt13so8203152ejb.12 for ; Thu, 08 Oct 2020 06:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l2td5ECxpYmhlLqAYXeFepzm66i6U+5LXnAP65W/2Z8=; b=ilnXrotoSGp3ZJLXfWwgAXSoKCvdX2jeyC7F9BkT7RqenbFmRt2SADJQcYUo+GXbfb j0GXG1FPxEMLRKet9ca3uXtiwh80Buynnk5yDi19Za1vcvGDbxg5WfEgTf3HhK1jFx9e iXOZq9NbQIQoDMBNS3VETvOllgHgIzdhVQZSY+c1Ax5epZlYs4HAbADSJtSGHCvGiQ7G bOWKeENv0F8QtOKziOQjmhKCIJAKxNamMnt/yrVnrcz28oJkXM5/hX9P1uGM7HzxuYQe WAUTljg5/AJ5eEnqU2RjxgAmJJU9SDV4Fs+txV6uoGy262mqgkmslcgKOzbxfZ3tX/mV 7FFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l2td5ECxpYmhlLqAYXeFepzm66i6U+5LXnAP65W/2Z8=; b=pTpZeJcDmcDYHZhZwAFvx1+uXD9024xGCkNNDISgkdoDMimt2GFSSOkZFQaVaNz2o4 U6qWutzn8oXha5YbcWZoH1uWsVCP1xg8teMFrdDwUT6WUb6rC1eSzEYilz7TxkM7Hp9F dSqbnq5ppZi+Lc1GoosO7oJ8589w9T7sVEDGlLoUy70/6Jo3ZzHjYkz10CXqSnZP2AMy OdKULQ3p8gE4mrXJtwk9WUJFbm+zxiF3n/9zXhV0+HNBrRUFVKoBUWoXodKMVh34LhcL ZvMdxjqFIDPIAYHabUgGc8Rtnc/imGqFgzCrdAnLLQAqtiQ9Bkhh6JA/Jee0Vfutxe2i xvzw== X-Gm-Message-State: AOAM532rLnydShlWIasfjn98/sjojSDU0oNIXlH3a3ZmQSlbAlQ/EDRu vjYUExtN3vkC+tlTa/eiedm/o4MF0NawWE3O X-Google-Smtp-Source: ABdhPJzUQmX8yVOzXyi+jaCyJVrAwpEBSRnbaLyZ1P3YtZDTctYxPkFIOLGXRO8qDiE1zm+r/buCHA== X-Received: by 2002:a17:906:cede:: with SMTP id si30mr9201495ejb.236.1602165048935; Thu, 08 Oct 2020 06:50:48 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:48 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 3/6] bridge: mdb: show igmpv3/mldv2 flags Date: Thu, 8 Oct 2020 16:50:21 +0300 Message-Id: <20201008135024.1515468-4-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov With IGMPv3/MLDv2 support we have 2 new flags: - added_by_star_ex: set when the S,G entry was automatically created because of a *,G entry in EXCLUDE mode - blocked: set when traffic for the S,G entry for that port has to be blocked Both flags are used only on the new S,G entries and are currently kernel managed, i.e. similar to other flags which can't be set from user-space. Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bridge/mdb.c b/bridge/mdb.c index 94cd3c3b2390..d33bd5d5c7df 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -155,6 +155,10 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, print_string(PRINT_ANY, NULL, " %s", "offload"); if (e->flags & MDB_FLAGS_FAST_LEAVE) print_string(PRINT_ANY, NULL, " %s", "fast_leave"); + if (e->flags & MDB_FLAGS_STAR_EXCL) + print_string(PRINT_ANY, NULL, " %s", "added_by_star_ex"); + if (e->flags & MDB_FLAGS_BLOCKED) + print_string(PRINT_ANY, NULL, " %s", "blocked"); close_json_array(PRINT_JSON, NULL); if (e->vid) From patchwork Thu Oct 8 13:50:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 268948 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 B8CB2C4363A for ; Thu, 8 Oct 2020 13:50:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B2AA20782 for ; Thu, 8 Oct 2020 13:50:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="gddnoLDi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730436AbgJHNu4 (ORCPT ); Thu, 8 Oct 2020 09:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbgJHNuw (ORCPT ); Thu, 8 Oct 2020 09:50:52 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9AF1C0613D2 for ; Thu, 8 Oct 2020 06:50:51 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id u21so8237328eja.2 for ; Thu, 08 Oct 2020 06:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3QgNMvIcxcJ+OZ/UVUVDVU8AjuIQyIXiYSQz3ZXOfyc=; b=gddnoLDi8gJB/XfGuRlkOPu0QkFuNCDvptr0DNnnN9zR6L/TQOIZry/T8nnfgDy1Np CPPJiRDXBi9ZAdrlRArFaKub0S5VN0RWlxn/RdX0QAxSxdFzqw7vhY+hmoZqlIIE2Zh0 OL203A6slEAuhDRAPSruHZEdglCDzhnUOpi6hARpsEHcEbrdoRhJetT+wdMImMx4Osfj X+xamHmVKec9YfRUf5v6tfDJ7RJnH1SCajX5T1AQ3Lks24cH9fy50M8vwNnW+cgUpZJB fuFVCHojLANJVwCUhNU7ETHpvCI0eVlkEfS58jdiVUmS3oN9QEFWIeomoiJaz+JUgOH5 NQaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3QgNMvIcxcJ+OZ/UVUVDVU8AjuIQyIXiYSQz3ZXOfyc=; b=mAjKmODBhw/hpdhcwUbQo+rrgQ7bbtL8XHRylqWadrzjHcEZ3i2Kkt3A1y8MIcRmDV TXwVPW2JVS6Y/tC1eFhN/BFfOpHW05vP1LblXxqCAAZYIU7FVF4g0i0wAuT8X4aLzjp6 WHVMnIec7XblvqfkUuVxwpVAvL+ilfo6Q3etoUU7fFmrzWuMYO/oPibJThxLlowqYn39 mrHF4xtb/U634/dKqEIXX1+ufXWbwF9VA7EdHimFFPqhxGGz2UXNNSsh0R3itk1/Wcs5 TuEdFTRxrDtFPbI/WulQlesLx341VwYDiqMmz2lzi2xnWvKcXeqE+2oXNMnREomSYI9X HaSg== X-Gm-Message-State: AOAM5312kKZMlwdRGLFybWw7BOA7RV+VqWoBbZNYaDC/ij+QUdi5PMfQ DkS3Uz6Dq6gc7vWq/es3Szr9yNcmBSohLY3k X-Google-Smtp-Source: ABdhPJyMjE2huWp77x8uInTy9yelVKnDVMIqvkFVZX4R7Yn0iBOVk78xW3OY3emUAxwocg6cSEqntw== X-Received: by 2002:a17:906:1f08:: with SMTP id w8mr8662607ejj.181.1602165050062; Thu, 08 Oct 2020 06:50:50 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:49 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 4/6] bridge: mdb: print filter mode when available Date: Thu, 8 Oct 2020 16:50:22 +0300 Message-Id: <20201008135024.1515468-5-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Print the mdb entry's filter mode when it's available if the user requested to show details (-d). It can be either include or exclude. Currently it's kernel controlled and can't be changed by user-space. Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bridge/mdb.c b/bridge/mdb.c index d33bd5d5c7df..c0cb4fd1421e 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -150,6 +150,13 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, print_string(PRINT_ANY, "state", " %s", (e->state & MDB_PERMANENT) ? "permanent" : "temp"); + if (show_details && tb && tb[MDBA_MDB_EATTR_GROUP_MODE]) { + __u8 mode = rta_getattr_u8(tb[MDBA_MDB_EATTR_GROUP_MODE]); + + print_string(PRINT_ANY, "filter_mode", " filter_mode %s", + mode == MCAST_INCLUDE ? "include" : "exclude"); + } + open_json_array(PRINT_JSON, "flags"); if (e->flags & MDB_FLAGS_OFFLOAD) print_string(PRINT_ANY, NULL, " %s", "offload"); From patchwork Thu Oct 8 13:50:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 268947 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 4F364C4363A for ; Thu, 8 Oct 2020 13:51:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E43C521897 for ; Thu, 8 Oct 2020 13:50:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="P8MPYqNK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730444AbgJHNu7 (ORCPT ); Thu, 8 Oct 2020 09:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730432AbgJHNuy (ORCPT ); Thu, 8 Oct 2020 09:50:54 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1F1FC0613D3 for ; Thu, 8 Oct 2020 06:50:52 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id i5so5921757edr.5 for ; Thu, 08 Oct 2020 06:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l2x/ESsYVh+Qv7/zPt/adzjQT5jGDbu/ldM3cecFuoE=; b=P8MPYqNKTGziDgF8c/7UKruoXkCictdJ9+1x6R8R3cSmqTG+snb0GOp43ZniF9vkSR Gil8XZhVYMJzsJs0aaVl1HWoQOD93Zib5j6QJyjVWbGDMMQsXe/Hb8UcD0O+dxSW9jVY 6PhLYND1P7GTGlI2pabLRAGnCl/2UMFUcTjyrhqjukAPFxPPTm2mzhKeoUXv8PU6kt8J L0IDoqmkPk57ziL3dwhvR3Oi/YLc1zuCmirefZtsFKFmEv4ad0dlnKSVmHWvS1uuvY/w VNHfwaylsDVS6er6GlAFBEQYdjjbkv6MeqsdrISo044XhquKl5sYwcy2wlUUPI5EhqPu W7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l2x/ESsYVh+Qv7/zPt/adzjQT5jGDbu/ldM3cecFuoE=; b=UAGlnWlvQTHFYzJWuzGgaMLNTCiGSpgojilka3v+01s2Ytnv0Hyjtqqg9VR3J2gsna mvU3fannZuWambFY3fFpdsxw32ZsmG3h5hR6DnozW8A/gIg5z0EXqUHvtdaHbBnyYBdb eAmn/36/iW65II4wtCk0Lzy2MM+szmgOncdM5KrwMllXssKxePEch0dalRGPW5Xq3vh1 YBPbDsIDVj5oA1+8vrj+kgmjtzkr3sToA5Kkeg0y5Qy/qHLSmWbRL2aC/2u5d+CiwoFJ JO5C0ASqMXSSDJ+4ipEFc6gyIB0nE0H4xeE9u3Lpz+z9jXKd5QeKx7ZMJrjTC3svYWmP 2o0w== X-Gm-Message-State: AOAM531lCZyXOjPdLWsUhM1I3L0c8QQiNbD5lkjK0wjwUXawM5W6plnM MR59Z+dRrKrhmhxnMa48Bz+8uZImDXl4BRs9 X-Google-Smtp-Source: ABdhPJxn8JFzZ66j9scsc2ZWGAlLNG8jhJuQ+e29w5041CzK9l5SnEug5BM0SOD+5xyYeUW+YXLzCw== X-Received: by 2002:a50:d94d:: with SMTP id u13mr8798382edj.365.1602165051128; Thu, 08 Oct 2020 06:50:51 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:50 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 5/6] bridge: mdb: print source list when available Date: Thu, 8 Oct 2020 16:50:23 +0300 Message-Id: <20201008135024.1515468-6-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Print the mdb entry's source list when it's available if the user requested to show details (-d). Each source has an associated timer which controls if traffic should be forwarded to that S,G entry (if the timer is non-zero traffic is forwarded, otherwise it's not). Currently the source list is kernel controlled and can't be changed by user-space. Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 75 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/bridge/mdb.c b/bridge/mdb.c index c0cb4fd1421e..b3b58a2385ca 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -41,15 +41,20 @@ static bool is_temp_mcast_rtr(__u8 type) return type == MDB_RTR_TYPE_TEMP_QUERY || type == MDB_RTR_TYPE_TEMP; } -static const char *format_timer(__u32 ticks) +static const char *format_timer(__u32 ticks, int align) { struct timeval tv; static char tbuf[32]; __jiffies_to_tv(&tv, ticks); - snprintf(tbuf, sizeof(tbuf), "%4lu.%.2lu", - (unsigned long)tv.tv_sec, - (unsigned long)tv.tv_usec / 10000); + if (align) + snprintf(tbuf, sizeof(tbuf), "%4lu.%.2lu", + (unsigned long)tv.tv_sec, + (unsigned long)tv.tv_usec / 10000); + else + snprintf(tbuf, sizeof(tbuf), "%lu.%.2lu", + (unsigned long)tv.tv_sec, + (unsigned long)tv.tv_usec / 10000); return tbuf; } @@ -65,7 +70,7 @@ static void __print_router_port_stats(FILE *f, struct rtattr *pattr) __u32 timer = rta_getattr_u32(tb[MDBA_ROUTER_PATTR_TIMER]); print_string(PRINT_ANY, "timer", " %s", - format_timer(timer)); + format_timer(timer, 1)); } if (tb[MDBA_ROUTER_PATTR_TYPE]) { @@ -115,6 +120,31 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr, close_json_array(PRINT_JSON, NULL); } +static void print_src_entry(struct rtattr *src_attr, int af, const char *sep) +{ + struct rtattr *stb[MDBA_MDB_SRCATTR_MAX + 1]; + SPRINT_BUF(abuf); + const char *addr; + __u32 timer_val; + + parse_rtattr_nested(stb, MDBA_MDB_SRCATTR_MAX, src_attr); + if (!stb[MDBA_MDB_SRCATTR_ADDRESS] || !stb[MDBA_MDB_SRCATTR_TIMER]) + return; + + addr = inet_ntop(af, RTA_DATA(stb[MDBA_MDB_SRCATTR_ADDRESS]), abuf, + sizeof(abuf)); + if (!addr) + return; + timer_val = rta_getattr_u32(stb[MDBA_MDB_SRCATTR_TIMER]); + + open_json_object(NULL); + print_string(PRINT_FP, NULL, "%s", sep); + print_color_string(PRINT_ANY, ifa_family_color(af), + "address", "%s", addr); + print_string(PRINT_ANY, "timer", "/%s", format_timer(timer_val, 0)); + close_json_object(); +} + static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, struct nlmsghdr *n, struct rtattr **tb) { @@ -149,12 +179,30 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, } print_string(PRINT_ANY, "state", " %s", (e->state & MDB_PERMANENT) ? "permanent" : "temp"); + if (show_details && tb) { + if (tb[MDBA_MDB_EATTR_GROUP_MODE]) { + __u8 mode = rta_getattr_u8(tb[MDBA_MDB_EATTR_GROUP_MODE]); - if (show_details && tb && tb[MDBA_MDB_EATTR_GROUP_MODE]) { - __u8 mode = rta_getattr_u8(tb[MDBA_MDB_EATTR_GROUP_MODE]); - - print_string(PRINT_ANY, "filter_mode", " filter_mode %s", - mode == MCAST_INCLUDE ? "include" : "exclude"); + print_string(PRINT_ANY, "filter_mode", " filter_mode %s", + mode == MCAST_INCLUDE ? "include" : + "exclude"); + } + if (tb[MDBA_MDB_EATTR_SRC_LIST]) { + struct rtattr *i, *attr = tb[MDBA_MDB_EATTR_SRC_LIST]; + const char *sep = " "; + int rem; + + open_json_array(PRINT_ANY, is_json_context() ? + "source_list" : + " source_list"); + rem = RTA_PAYLOAD(attr); + for (i = RTA_DATA(attr); RTA_OK(i, rem); + i = RTA_NEXT(i, rem)) { + print_src_entry(i, af, sep); + sep = ","; + } + close_json_array(PRINT_JSON, NULL); + } } open_json_array(PRINT_JSON, "flags"); @@ -175,7 +223,7 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, __u32 timer = rta_getattr_u32(tb[MDBA_MDB_EATTR_TIMER]); print_string(PRINT_ANY, "timer", " %s", - format_timer(timer)); + format_timer(timer, 1)); } print_nl(); @@ -193,8 +241,9 @@ static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr, rem = RTA_PAYLOAD(attr); for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { e = RTA_DATA(i); - parse_rtattr(etb, MDBA_MDB_EATTR_MAX, MDB_RTA(RTA_DATA(i)), - RTA_PAYLOAD(i) - RTA_ALIGN(sizeof(*e))); + parse_rtattr_flags(etb, MDBA_MDB_EATTR_MAX, MDB_RTA(RTA_DATA(i)), + RTA_PAYLOAD(i) - RTA_ALIGN(sizeof(*e)), + NLA_F_NESTED); print_mdb_entry(f, ifindex, e, n, etb); } } From patchwork Thu Oct 8 13:50:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 269410 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 39B89C4363C for ; Thu, 8 Oct 2020 13:51:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D45DC21897 for ; Thu, 8 Oct 2020 13:51:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=blackwall-org.20150623.gappssmtp.com header.i=@blackwall-org.20150623.gappssmtp.com header.b="GBvk6z1Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730447AbgJHNvA (ORCPT ); Thu, 8 Oct 2020 09:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbgJHNuy (ORCPT ); Thu, 8 Oct 2020 09:50:54 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE6A2C0613D4 for ; Thu, 8 Oct 2020 06:50:53 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id t21so5909665eds.6 for ; Thu, 08 Oct 2020 06:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4zha4H2V8nuv352amZSWlHsbhWLAiP6Gjddnc2tMLXQ=; b=GBvk6z1YifYS8heMaOe9Jy+N3GbLwxCX0Ozb6OykY7q+okTLGjmj87D9m/+DvcT3m+ mScd+VbvIyYpRwy39hqAFtJ587iIgqWtjtS44W5SQ0AaIXQ4ih1sEPO/UOmzuqnlvpRY n1ZwXJDddAEREkkQoEsJYuLBxRrU9Enp8fllPXbeGLCRzwEQvm4J2070CJEZRf/6s5IO k5St1NqNKPX46pjrI3YCAFNklChYzjieYpE52S3Yi6GvB27PjPkCsIRSZBDPTDvylRU5 y/g42OaqOE+tzSh0NULw8qBFPlqd1cnJ2tS8BqFTFMg1BILVR+Nm50M7Jcp8r5uRLXYm SEeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4zha4H2V8nuv352amZSWlHsbhWLAiP6Gjddnc2tMLXQ=; b=ibE9VIjhsHLHDiorXsogwfsCdPTGLuRG53aDWIoXZsAmf+YJpFWEBZAQ5wfnRpfEQB +3UJdjKR3w2qPQmVdVl5+lqiqedUWvYGhwQHk2n9kuyFgTvJ9nZ1dS2Wz5JYqU49/tEG HI3AzF8fhSyq7mR2YTcTVufIJCXaecJXdU2VQrRcqjCM6q4HFYGv8V1rW814q4COOF8+ 3o4dcf4JJ0nqTxSwdd9NOIex4mTYcyB9UF0M9u2u7MEnPpj0wysDnJCMqBe2FdsEiONo wOFdGRz+OuoXct4nFALwUjbissdC7Ge+C4AQ5LUxlnSCZ0m74zCAncca4A0RKVv5BF7b SgBw== X-Gm-Message-State: AOAM5315+RYJCe7yGC2Owl47OUpPNTsBSWx1gNt6XGKdJViotcjneZLx oZmhgKsE/eiNcM52eu2OtLmGvUTkwHe0eY5f X-Google-Smtp-Source: ABdhPJyvRJ8QkQVl2oy6ZADZNlkb7ZkRu7t96xG77DTiNDh2HTGpnLX6okbeiFVAhWpYIqdQZ+aqXw== X-Received: by 2002:aa7:dbcb:: with SMTP id v11mr9122500edt.351.1602165052205; Thu, 08 Oct 2020 06:50:52 -0700 (PDT) Received: from localhost.localdomain (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id w21sm4169617ejo.70.2020.10.08.06.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 06:50:51 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 6/6] bridge: mdb: print protocol when available Date: Thu, 8 Oct 2020 16:50:24 +0300 Message-Id: <20201008135024.1515468-7-razor@blackwall.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201008135024.1515468-1-razor@blackwall.org> References: <20201008135024.1515468-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Print the mdb entry's protocol (i.e. who added it) when it's available if the user requested to show details (-d). Currently the only possible values are RTPROT_STATIC (user-space added) or RTPROT_KERNEL (automatically added by kernel). The value is kernel controlled. Signed-off-by: Nikolay Aleksandrov --- bridge/mdb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bridge/mdb.c b/bridge/mdb.c index b3b58a2385ca..4cd7ca762b78 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -203,6 +203,13 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, } close_json_array(PRINT_JSON, NULL); } + if (tb[MDBA_MDB_EATTR_RTPROT]) { + __u8 rtprot = rta_getattr_u8(tb[MDBA_MDB_EATTR_RTPROT]); + SPRINT_BUF(rtb); + + print_string(PRINT_ANY, "protocol", " proto %s ", + rtnl_rtprot_n2a(rtprot, rtb, sizeof(rtb))); + } } open_json_array(PRINT_JSON, "flags");