From patchwork Thu Aug 26 13:05:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459725 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 BA2F3C432BE for ; Thu, 26 Aug 2021 13:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9127860EAF for ; Thu, 26 Aug 2021 13:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239549AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241640AbhHZNKF (ORCPT ); Thu, 26 Aug 2021 09:10:05 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FEE1C061757 for ; Thu, 26 Aug 2021 06:09:18 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id t19so6140886ejr.8 for ; Thu, 26 Aug 2021 06:09:18 -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=TXPUt2JdaQ55E00ISU1OjYxSbcH47hkR9O7fdSCmbYM=; b=ph0twr5ogIroIrvFROyeQ75AoVfRZmwcI+mMvmwgKLpnPMHsmYVYgQoQCeuYn/YCHU IMao26Ok6WDnyUJ+ffhoi6XS8CYf+vnWkawAK8UEGuzciFQLEc1EwAw4Mvum70dlb2CG RMGbdG1p3bF0eQ+K8Rp2LpqXqP0JCkwj3oTFAv4nVQ5p63jcUjUe44sTqgAEsWpn+c3u ay062YUMsNBj9aTwedICxOB+4g+f4YL8HC/dVWdDRQKQPQe4Wlmqt2r1Mgl5ovjObMJv vwFCSHrEY45SKUU/hvxhKQUQsv59qYt1PiYXukHTU8dpcWHhU6Cc/n5MHw480JQTZtEn WDeA== 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=TXPUt2JdaQ55E00ISU1OjYxSbcH47hkR9O7fdSCmbYM=; b=KwIHELcl/TGlt53TxxhldbzvQwggyETUiqhfNjXfnzHU2X1cgtYNs7w20ac1ZS6yPK WW9tB71V0gYduN51l5w1ueiPpBy27gaWobMmDRofdhu5suT65WU9ho2NESUokpDnUwxJ 298bUxmR3bOQXJUWIMisanvTqykqfCEjvPiE16z/8DIK6mu3za7dPjd3APhr8N6hsYyN kXDggQtw48pkCrqCj1ovO4+ejzA3pXjACt2tl01LXqLUM4bjtV0YBTnCw3Rbif5iV1TY 0MIfEx5dggRnbDmfFS8iTbUtSHIU5vnxlFr9AI2YiPdE/Hv3IMPwbOhMuNUIVYStLFwD Pjvg== X-Gm-Message-State: AOAM530dCaKln/oGM3ENAObCwGVFYelUgo5wMEts5J7U50FckGFgUeAg dYRObd60+Cpix0Gag1tz1zzFwI9cSKuOY5oG X-Google-Smtp-Source: ABdhPJx9ObPidwb7pXFVwoiXuf3rVnqxIOLGFs+jzNEJj11X2ajLCkh/mA1sYWFyHsoXoX7UAuGALQ== X-Received: by 2002:a17:906:165a:: with SMTP id n26mr4344864ejd.236.1629983356418; Thu, 26 Aug 2021 06:09:16 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:16 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 01/17] ip: bridge: add support for mcast_vlan_snooping Date: Thu, 26 Aug 2021 16:05:17 +0300 Message-Id: <20210826130533.149111-2-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add support for mcast_vlan_snooping option which controls per-vlan multicast snooping, also update the man page. Syntax: $ ip link set dev bridge type bridge mcast_vlan_snooping 0/1 Signed-off-by: Nikolay Aleksandrov --- ip/iplink_bridge.c | 29 +++++++++++++++++++++++++++++ man/man8/ip-link.8.in | 8 ++++++++ 2 files changed, 37 insertions(+) diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c index d12fd0558f7d..0f96b77ec3e1 100644 --- a/ip/iplink_bridge.c +++ b/ip/iplink_bridge.c @@ -43,6 +43,7 @@ static void print_explain(FILE *f) " [ vlan_stats_enabled VLAN_STATS_ENABLED ]\n" " [ vlan_stats_per_port VLAN_STATS_PER_PORT ]\n" " [ mcast_snooping MULTICAST_SNOOPING ]\n" + " [ mcast_vlan_snooping MULTICAST_VLAN_SNOOPING ]\n" " [ mcast_router MULTICAST_ROUTER ]\n" " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" " [ mcast_querier MULTICAST_QUERIER ]\n" @@ -83,6 +84,7 @@ void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len) static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { + struct br_boolopt_multi bm = {}; __u32 val; while (argc > 0) { @@ -200,6 +202,18 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, invarg("invalid mcast_snooping", *argv); addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop); + } else if (matches(*argv, "mcast_vlan_snooping") == 0) { + __u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING; + __u8 mcast_vlan_snooping; + + NEXT_ARG(); + if (get_u8(&mcast_vlan_snooping, *argv, 0)) + invarg("invalid mcast_vlan_snooping", *argv); + bm.optmask |= 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING; + if (mcast_vlan_snooping) + bm.optval |= mcvl_bit; + else + bm.optval &= ~mcvl_bit; } else if (matches(*argv, "mcast_query_use_ifaddr") == 0) { __u8 mcast_qui; @@ -379,6 +393,9 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, argc--, argv++; } + if (bm.optmask) + addattr_l(n, 1024, IFLA_BR_MULTI_BOOLOPT, + &bm, sizeof(bm)); return 0; } @@ -559,6 +576,18 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) "mcast_snooping %u ", rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING])); + if (tb[IFLA_BR_MULTI_BOOLOPT]) { + __u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING; + struct br_boolopt_multi *bm; + + bm = RTA_DATA(tb[IFLA_BR_MULTI_BOOLOPT]); + if (bm->optmask & mcvl_bit) + print_uint(PRINT_ANY, + "mcast_vlan_snooping", + "mcast_vlan_snooping %u ", + !!(bm->optval & mcvl_bit)); + } + if (tb[IFLA_BR_MCAST_ROUTER]) print_uint(PRINT_ANY, "mcast_router", diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in index 572bed872eed..2c278d53c050 100644 --- a/man/man8/ip-link.8.in +++ b/man/man8/ip-link.8.in @@ -1492,6 +1492,8 @@ the following additional arguments are supported: ] [ .BI mcast_snooping " MULTICAST_SNOOPING " ] [ +.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING " +] [ .BI mcast_router " MULTICAST_ROUTER " ] [ .BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR " @@ -1614,6 +1616,12 @@ per-VLAN per-port stats accounting. Can be changed only when there are no port V or off .RI ( MULTICAST_SNOOPING " == 0). " +.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING " +- turn multicast VLAN snooping on +.RI ( MULTICAST_VLAN_SNOOPING " > 0) " +or off +.RI ( MULTICAST_VLAN_SNOOPING " == 0). " + .BI mcast_router " MULTICAST_ROUTER " - set bridge's multicast router if IGMP snooping is enabled. .I MULTICAST_ROUTER From patchwork Thu Aug 26 13:05:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459727 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9E235C4320A for ; Thu, 26 Aug 2021 13:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 815CF6109F for ; Thu, 26 Aug 2021 13:09:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242161AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241790AbhHZNKH (ORCPT ); Thu, 26 Aug 2021 09:10:07 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 677E5C061757 for ; Thu, 26 Aug 2021 06:09:19 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id s25so4661638edw.0 for ; Thu, 26 Aug 2021 06:09:19 -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=j+2VolArdcPmMu0Oy9cOK4261/tdEnIPHSKXG49BBLM=; b=ILUzRAYfCp/jL7iMIZkjG63M1/ZnRU9V/cUMI8irf9U+EydWuYaOsgiIWZYhPkGbVz bowj93GTY28eqzdaLkl5QZyZ3/aQqwgA141XYy56GnFYMB/TNnrQEepSkGKkiOJ5cwp+ 7qsDPrZgiHJwpUs9Br4f2nGgcwgirQdqIHvMMOW9lvMfP/qHqbcedsoLrq12y1xZy6Sc zl+eoY06nH1txa6mW16SWtCboqo/Be3OtLDb53ECzz0/kylcQnEC3QXYdhCBSt5f1jzM qfDn0L/2J1n61X3wePke4oWfonlupZvlj7QQkZggDRRnzmGYZ/JnpW3LNHZ6FyuKmwt0 +nbw== 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=j+2VolArdcPmMu0Oy9cOK4261/tdEnIPHSKXG49BBLM=; b=rDXz4Af/CSddnpuKmr7Byr82x49dWI8AMeYCh/Us+WgWuqv9iIisQStPXn7yA6Xmam hBdYfuDXUnMU+pOXtMUgXn0ExyGDLulhQmKeMHbJTlD+tznqmCboXC65mMRAATMl6OCp Ax9/J2ZV72HuoeHIeDwN09vvSWakcc92nasaq4mE+gOs7c7PkkYG2fStC/DngZIu7ktS MK4e6zgzWdwNmz7F1ScuSviPndAfNkRsyXeOIwAR/oX8pk/ZJMnURUS3VzWpeCVBw0T5 LqjaFph4+0bQGS5QO5qq9GatsRfGJuKoCcEt4SnmK68000Hwg/zmpnvQOMG9CkRMSAfk R6bQ== X-Gm-Message-State: AOAM533xFk1Qj3xyMVVRyz1r0WwVKb3F/nd4jCvPOOWT3iTKR5DVpZRd +BpSZ37Rv65k4FyCRTKiqb/9fpXHylvzjhzO X-Google-Smtp-Source: ABdhPJz8EkQWdB75LAtjCxVN6LWiIikLDMr5OnEOT+Od8WEUMhmzCGuONiRPDniFY/lwJPK9gkUjVw== X-Received: by 2002:a50:8e51:: with SMTP id 17mr4273960edx.308.1629983357598; Thu, 26 Aug 2021 06:09:17 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:17 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 02/17] bridge: vlan: add support to show global vlan options Date: Thu, 26 Aug 2021 16:05:18 +0300 Message-Id: <20210826130533.149111-3-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add support for new bridge vlan command grouping called global which operates on global options. The first command it supports is "show". Man page and help are also updated with the new command. Syntax is: $ bridge vlan global show [ vid VID ] [ dev DEV ] Signed-off-by: Nikolay Aleksandrov --- bridge/br_common.h | 3 +- bridge/monitor.c | 2 +- bridge/vlan.c | 229 ++++++++++++++++++++++++++++++++++----------- man/man8/bridge.8 | 21 +++++ 4 files changed, 200 insertions(+), 55 deletions(-) diff --git a/bridge/br_common.h b/bridge/br_common.h index b9adafd98dea..09f42c814918 100644 --- a/bridge/br_common.h +++ b/bridge/br_common.h @@ -12,7 +12,8 @@ int print_mdb_mon(struct nlmsghdr *n, void *arg); int print_fdb(struct nlmsghdr *n, void *arg); void print_stp_state(__u8 state); int parse_stp_state(const char *arg); -int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor); +int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, + bool global_only); int do_fdb(int argc, char **argv); int do_mdb(int argc, char **argv); diff --git a/bridge/monitor.c b/bridge/monitor.c index 88f52f52f084..845e221abb49 100644 --- a/bridge/monitor.c +++ b/bridge/monitor.c @@ -71,7 +71,7 @@ static int accept_msg(struct rtnl_ctrl_data *ctrl, case RTM_DELVLAN: if (prefix_banner) fprintf(fp, "[VLAN]"); - return print_vlan_rtm(n, arg, true); + return print_vlan_rtm(n, arg, true, false); default: return 0; diff --git a/bridge/vlan.c b/bridge/vlan.c index 9b6511f189ff..9e33995f8f33 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -36,7 +36,8 @@ static void usage(void) " [ self ] [ master ]\n" " bridge vlan { set } vid VLAN_ID dev DEV [ state STP_STATE ]\n" " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n" - " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n"); + " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" + " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -621,11 +622,89 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) return 0; } -int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) +static void print_vlan_global_opts(struct rtattr *a) +{ + struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1]; + __u16 vid, vrange = 0; + + if ((a->rta_type & NLA_TYPE_MASK) != BRIDGE_VLANDB_GLOBAL_OPTIONS) + return; + + parse_rtattr_flags(vtb, BRIDGE_VLANDB_GOPTS_MAX, RTA_DATA(a), + RTA_PAYLOAD(a), NLA_F_NESTED); + vid = rta_getattr_u16(vtb[BRIDGE_VLANDB_GOPTS_ID]); + if (vtb[BRIDGE_VLANDB_GOPTS_RANGE]) + vrange = rta_getattr_u16(vtb[BRIDGE_VLANDB_GOPTS_RANGE]); + else + vrange = vid; + print_range("vlan", vid, vrange); + print_nl(); +} + +static void print_vlan_opts(struct rtattr *a) +{ + struct rtattr *vtb[BRIDGE_VLANDB_ENTRY_MAX + 1]; + struct bridge_vlan_xstats vstats; + struct bridge_vlan_info *vinfo; + __u16 vrange = 0; + __u8 state = 0; + + if ((a->rta_type & NLA_TYPE_MASK) != BRIDGE_VLANDB_ENTRY) + return; + + parse_rtattr_flags(vtb, BRIDGE_VLANDB_ENTRY_MAX, RTA_DATA(a), + RTA_PAYLOAD(a), NLA_F_NESTED); + vinfo = RTA_DATA(vtb[BRIDGE_VLANDB_ENTRY_INFO]); + + memset(&vstats, 0, sizeof(vstats)); + if (vtb[BRIDGE_VLANDB_ENTRY_RANGE]) + vrange = rta_getattr_u16(vtb[BRIDGE_VLANDB_ENTRY_RANGE]); + else + vrange = vinfo->vid; + + if (vtb[BRIDGE_VLANDB_ENTRY_STATE]) + state = rta_getattr_u8(vtb[BRIDGE_VLANDB_ENTRY_STATE]); + + if (vtb[BRIDGE_VLANDB_ENTRY_STATS]) { + struct rtattr *stb[BRIDGE_VLANDB_STATS_MAX+1]; + struct rtattr *attr; + + attr = vtb[BRIDGE_VLANDB_ENTRY_STATS]; + parse_rtattr(stb, BRIDGE_VLANDB_STATS_MAX, RTA_DATA(attr), + RTA_PAYLOAD(attr)); + + if (stb[BRIDGE_VLANDB_STATS_RX_BYTES]) { + attr = stb[BRIDGE_VLANDB_STATS_RX_BYTES]; + vstats.rx_bytes = rta_getattr_u64(attr); + } + if (stb[BRIDGE_VLANDB_STATS_RX_PACKETS]) { + attr = stb[BRIDGE_VLANDB_STATS_RX_PACKETS]; + vstats.rx_packets = rta_getattr_u64(attr); + } + if (stb[BRIDGE_VLANDB_STATS_TX_PACKETS]) { + attr = stb[BRIDGE_VLANDB_STATS_TX_PACKETS]; + vstats.tx_packets = rta_getattr_u64(attr); + } + if (stb[BRIDGE_VLANDB_STATS_TX_BYTES]) { + attr = stb[BRIDGE_VLANDB_STATS_TX_BYTES]; + vstats.tx_bytes = rta_getattr_u64(attr); + } + } + print_range("vlan", vinfo->vid, vrange); + print_vlan_flags(vinfo->flags); + print_nl(); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); + print_stp_state(state); + print_nl(); + if (show_stats) + __print_one_vlan_stats(&vstats); +} + +int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, bool global_only) { - struct rtattr *vtb[BRIDGE_VLANDB_ENTRY_MAX + 1], *a; struct br_vlan_msg *bvm = NLMSG_DATA(n); int len = n->nlmsg_len; + struct rtattr *a; int rem; if (n->nlmsg_type != RTM_NEWVLAN && n->nlmsg_type != RTM_DELVLAN && @@ -660,49 +739,13 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) rem = len; for (a = BRVLAN_RTA(bvm); RTA_OK(a, rem); a = RTA_NEXT(a, rem)) { - struct bridge_vlan_xstats vstats; - struct bridge_vlan_info *vinfo; - __u32 vrange = 0; - __u8 state = 0; - - parse_rtattr_flags(vtb, BRIDGE_VLANDB_ENTRY_MAX, RTA_DATA(a), - RTA_PAYLOAD(a), NLA_F_NESTED); - vinfo = RTA_DATA(vtb[BRIDGE_VLANDB_ENTRY_INFO]); - - memset(&vstats, 0, sizeof(vstats)); - if (vtb[BRIDGE_VLANDB_ENTRY_RANGE]) - vrange = rta_getattr_u16(vtb[BRIDGE_VLANDB_ENTRY_RANGE]); - else - vrange = vinfo->vid; - - if (vtb[BRIDGE_VLANDB_ENTRY_STATE]) - state = rta_getattr_u8(vtb[BRIDGE_VLANDB_ENTRY_STATE]); + unsigned short rta_type = a->rta_type & NLA_TYPE_MASK; - if (vtb[BRIDGE_VLANDB_ENTRY_STATS]) { - struct rtattr *stb[BRIDGE_VLANDB_STATS_MAX+1]; - struct rtattr *attr; - - attr = vtb[BRIDGE_VLANDB_ENTRY_STATS]; - parse_rtattr(stb, BRIDGE_VLANDB_STATS_MAX, RTA_DATA(attr), - RTA_PAYLOAD(attr)); + /* skip unknown attributes */ + if (rta_type > BRIDGE_VLANDB_MAX || + (global_only && rta_type != BRIDGE_VLANDB_GLOBAL_OPTIONS)) + continue; - if (stb[BRIDGE_VLANDB_STATS_RX_BYTES]) { - attr = stb[BRIDGE_VLANDB_STATS_RX_BYTES]; - vstats.rx_bytes = rta_getattr_u64(attr); - } - if (stb[BRIDGE_VLANDB_STATS_RX_PACKETS]) { - attr = stb[BRIDGE_VLANDB_STATS_RX_PACKETS]; - vstats.rx_packets = rta_getattr_u64(attr); - } - if (stb[BRIDGE_VLANDB_STATS_TX_PACKETS]) { - attr = stb[BRIDGE_VLANDB_STATS_TX_PACKETS]; - vstats.tx_packets = rta_getattr_u64(attr); - } - if (stb[BRIDGE_VLANDB_STATS_TX_BYTES]) { - attr = stb[BRIDGE_VLANDB_STATS_TX_BYTES]; - vstats.tx_bytes = rta_getattr_u64(attr); - } - } if (vlan_rtm_cur_ifidx != bvm->ifindex) { open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN); open_json_object(NULL); @@ -711,14 +754,16 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) open_json_object(NULL); print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); } - print_range("vlan", vinfo->vid, vrange); - print_vlan_flags(vinfo->flags); - print_nl(); - print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); - print_stp_state(state); - print_nl(); - if (show_stats) - __print_one_vlan_stats(&vstats); + + switch (rta_type) { + case BRIDGE_VLANDB_ENTRY: + print_vlan_opts(a); + break; + case BRIDGE_VLANDB_GLOBAL_OPTIONS: + print_vlan_global_opts(a); + break; + } + close_json_object(); } @@ -727,7 +772,12 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) static int print_vlan_rtm_filter(struct nlmsghdr *n, void *arg) { - return print_vlan_rtm(n, arg, false); + return print_vlan_rtm(n, arg, false, false); +} + +static int print_vlan_rtm_global_filter(struct nlmsghdr *n, void *arg) +{ + return print_vlan_rtm(n, arg, false, true); } static int vlan_show(int argc, char **argv, int subject) @@ -845,6 +895,61 @@ out: return 0; } +static int vlan_global_show(int argc, char **argv) +{ + __u32 dump_flags = BRIDGE_VLANDB_DUMPF_GLOBAL; + int ret = 0, subject = VLAN_SHOW_VLAN; + char *filter_dev = NULL; + + while (argc > 0) { + if (strcmp(*argv, "dev") == 0) { + NEXT_ARG(); + if (filter_dev) + duparg("dev", *argv); + filter_dev = *argv; + } else if (strcmp(*argv, "vid") == 0) { + NEXT_ARG(); + if (filter_vlan) + duparg("vid", *argv); + filter_vlan = atoi(*argv); + } + argc--; argv++; + } + + if (filter_dev) { + filter_index = ll_name_to_index(filter_dev); + if (!filter_index) + return nodev(filter_dev); + } + + new_json_obj(json); + + if (rtnl_brvlandump_req(&rth, PF_BRIDGE, dump_flags) < 0) { + perror("Cannot send dump request"); + exit(1); + } + + if (!is_json_context()) { + printf("%-" __stringify(IFNAMSIZ) "s %-" + __stringify(VLAN_ID_LEN) "s", "port", + "vlan-id"); + printf("\n"); + } + + ret = rtnl_dump_filter(&rth, print_vlan_rtm_global_filter, &subject); + if (ret < 0) { + fprintf(stderr, "Dump terminated\n"); + exit(1); + } + + if (vlan_rtm_cur_ifidx != -1) + close_vlan_port(); + + delete_json_obj(); + fflush(stdout); + return 0; +} + void print_vlan_info(struct rtattr *tb, int ifindex) { struct rtattr *i, *list = tb; @@ -889,6 +994,22 @@ void print_vlan_info(struct rtattr *tb, int ifindex) close_vlan_port(); } +static int vlan_global(int argc, char **argv) +{ + if (argc > 0) { + if (matches(*argv, "show") == 0 || + matches(*argv, "lst") == 0 || + matches(*argv, "list") == 0) + return vlan_global_show(argc-1, argv+1); + else + usage(); + } else { + return vlan_global_show(0, NULL); + } + + return 0; +} + int do_vlan(int argc, char **argv) { ll_init_map(&rth); @@ -907,6 +1028,8 @@ int do_vlan(int argc, char **argv) } if (matches(*argv, "set") == 0) return vlan_option_set(argc-1, argv+1); + if (matches(*argv, "global") == 0) + return vlan_global(argc-1, argv+1); if (matches(*argv, "help") == 0) usage(); } else { diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index eec7df4383bc..9ec4cb1dec67 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -152,6 +152,13 @@ bridge \- show / manipulate bridge addresses and devices .B dev .IR DEV " ]" +.ti -8 +.BR "bridge vlan global" " [ " show " ] [ " +.B dev +.IR DEV " ] [ " +.B vid +.IR VID " ]" + .ti -8 .BR "bridge monitor" " [ " all " | " neigh " | " link " | " mdb " | " vlan " ]" @@ -895,6 +902,20 @@ option, the command displays per-vlan traffic statistics. This command displays the current vlan tunnel info mapping. +.SS bridge vlan global show - list global vlan options. + +This command displays the global VLAN options for each VLAN entry. + +.TP +.BI dev " DEV" +the interface only whose VLAN global options should be listed. Default is to list +all bridge interfaces. + +.TP +.BI vid " VID" +the VLAN ID only whose global options should be listed. Default is to list +all vlans. + .SH bridge monitor - state monitoring The From patchwork Thu Aug 26 13:05:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459731 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 A3BAFC4320E for ; Thu, 26 Aug 2021 13:09:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80B9760F39 for ; Thu, 26 Aug 2021 13:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242527AbhHZNKS (ORCPT ); Thu, 26 Aug 2021 09:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241955AbhHZNKH (ORCPT ); Thu, 26 Aug 2021 09:10:07 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C90C0613C1 for ; Thu, 26 Aug 2021 06:09:20 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a25so6150816ejv.6 for ; Thu, 26 Aug 2021 06:09:20 -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=uKAJ9crE5Cz6adBLh36gclXQrRqELaOGODfy6aDMxGU=; b=VFpUDp7wrwdLEMh8U6eJayk5nHUjRnTh+hF9yMJEVe1LFMO0w+H3cYm4Z/wMD1MAqY BA6sVWUjp/b2r8rr3bi/u5WDo7oFfX2Inm+Ospptk1E7DSPhMD7c+JhR2cOyus/hRd/I wRCHa41NIguQkKJgxEwhsPz/fPlC6zA3rR6cvq0gtu1jfxBsc+rrkVI03vtnc6tu+Exo UBoygsiEXEmCuUoVGc4ID2V7nrxSi2xmIZfeMiybyYER3yvnAmskdUdrjc/H7H3HzM4M OXhcGnSrEtkuaYLGL2LATWKsB4xgwtayO1RQVt7X0ByCg+kdpBGwXnp8vPZWoQmUWuKq n6wA== 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=uKAJ9crE5Cz6adBLh36gclXQrRqELaOGODfy6aDMxGU=; b=uRrfDX+Pn2NFwZuwe4byenER79hxQb+5XuE4NwNy6WuQqWLUp9vme5idFxpKp1DSiQ wvmVBvYxvq0cJ5jEPKS95Dux8LPH82aPF3zwoO6CksQ4f1qywlKjYQ0rooHsGdJk9QFL tell2jKFw472Uu8GKpMpagwT1cBkjXR41fmD4Vckldu3VEt680Ye7NLVODxa4QMlb7BN cpT0gLU8u5/zPUM0+Q/vrPIwzkwRHRn4A7kIIZsdmRGA0MgevZccrkI4JMCKLZ0xPz1G dFB2XQZHhorJMToP5HiH4lqF9ZsImkeeQNaR+ltKo+lCre6dvKcCDnmKCDT67pavw6Mz QYFw== X-Gm-Message-State: AOAM531NUyKMOX4yqM5oUG3TjBY1YloR94j5BfgG1JU0uy3y99NGyGu+ 4BOIE7JTTIVXwfeSd0M8a+LvxgqM35WLfbiZ X-Google-Smtp-Source: ABdhPJzfJv79VBS4W/jjFil3SVtyOVf9cIRqr3rBcTZ0m3N8vOcaX44YjjPnaQRLwGyt79P3uoctBQ== X-Received: by 2002:a17:906:1fd4:: with SMTP id e20mr4269634ejt.421.1629983358602; Thu, 26 Aug 2021 06:09:18 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:18 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 03/17] bridge: vlan: add support for vlan filtering when dumping options Date: Thu, 26 Aug 2021 16:05:19 +0300 Message-Id: <20210826130533.149111-4-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov In order to allow vlan filtering when dumping options we need to move all print operations into the option dumping functions and add the filtering after we've parsed the nested attributes so we can extract the start and end vlan ids. Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 9e33995f8f33..69a1d3c295b6 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -622,7 +622,7 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) return 0; } -static void print_vlan_global_opts(struct rtattr *a) +static void print_vlan_global_opts(struct rtattr *a, int ifindex) { struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1]; __u16 vid, vrange = 0; @@ -637,11 +637,24 @@ static void print_vlan_global_opts(struct rtattr *a) vrange = rta_getattr_u16(vtb[BRIDGE_VLANDB_GOPTS_RANGE]); else vrange = vid; + + if (filter_vlan && (filter_vlan < vid || filter_vlan > vrange)) + return; + + if (vlan_rtm_cur_ifidx != ifindex) { + open_vlan_port(ifindex, VLAN_SHOW_VLAN); + open_json_object(NULL); + vlan_rtm_cur_ifidx = ifindex; + } else { + open_json_object(NULL); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); + } print_range("vlan", vid, vrange); print_nl(); + close_json_object(); } -static void print_vlan_opts(struct rtattr *a) +static void print_vlan_opts(struct rtattr *a, int ifindex) { struct rtattr *vtb[BRIDGE_VLANDB_ENTRY_MAX + 1]; struct bridge_vlan_xstats vstats; @@ -662,6 +675,9 @@ static void print_vlan_opts(struct rtattr *a) else vrange = vinfo->vid; + if (filter_vlan && (filter_vlan < vinfo->vid || filter_vlan > vrange)) + return; + if (vtb[BRIDGE_VLANDB_ENTRY_STATE]) state = rta_getattr_u8(vtb[BRIDGE_VLANDB_ENTRY_STATE]); @@ -690,6 +706,15 @@ static void print_vlan_opts(struct rtattr *a) vstats.tx_bytes = rta_getattr_u64(attr); } } + + if (vlan_rtm_cur_ifidx != ifindex) { + open_vlan_port(ifindex, VLAN_SHOW_VLAN); + open_json_object(NULL); + vlan_rtm_cur_ifidx = ifindex; + } else { + open_json_object(NULL); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); + } print_range("vlan", vinfo->vid, vrange); print_vlan_flags(vinfo->flags); print_nl(); @@ -698,6 +723,7 @@ static void print_vlan_opts(struct rtattr *a) print_nl(); if (show_stats) __print_one_vlan_stats(&vstats); + close_json_object(); } int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, bool global_only) @@ -746,25 +772,14 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, bool global_only (global_only && rta_type != BRIDGE_VLANDB_GLOBAL_OPTIONS)) continue; - if (vlan_rtm_cur_ifidx != bvm->ifindex) { - open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN); - open_json_object(NULL); - vlan_rtm_cur_ifidx = bvm->ifindex; - } else { - open_json_object(NULL); - print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); - } - switch (rta_type) { case BRIDGE_VLANDB_ENTRY: - print_vlan_opts(a); + print_vlan_opts(a, bvm->ifindex); break; case BRIDGE_VLANDB_GLOBAL_OPTIONS: - print_vlan_global_opts(a); + print_vlan_global_opts(a, bvm->ifindex); break; } - - close_json_object(); } return 0; From patchwork Thu Aug 26 13:05:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459729 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9833AC432BE for ; Thu, 26 Aug 2021 13:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83DFD60FDC for ; Thu, 26 Aug 2021 13:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242430AbhHZNKO (ORCPT ); Thu, 26 Aug 2021 09:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242049AbhHZNKI (ORCPT ); Thu, 26 Aug 2021 09:10:08 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51BD1C0613CF for ; Thu, 26 Aug 2021 06:09:21 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id n11so4550935edv.11 for ; Thu, 26 Aug 2021 06:09:21 -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=euHTYu09/8UGxE1wYpepPEYohtnAyMYFjilIHBnoIeI=; b=Vm9hheItPRcqo3B9eye2cn9qpweQq3uAuES5ZyXcPaDcXo3r7pVEsbexfbzbsOvEk2 oEP6UZ1vL+Q7+v8KA8dp0QWH+JUeCbuRKZOW8Ozu9aW/sPtdWFNefllfTMKMF7D3yEsG J/SOkozZeN2rbSiCvV3dvrPvvTeKpJcP8AOv6sniFiNBOcKwiBKwY2AGlTL1k340ADl0 msdN7ni/GNDBeM7VJqqDjsAX+2FhBbEZtifHo3R6wsH3svM7a8RcGlgoAlutAt+oxGrR GUOWHMfmYFozokfc3BQW16RsiDs9IFRgfgyKdGLxA8VilolHD7iiFKuOWE9G2dk9CsVY dOog== 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=euHTYu09/8UGxE1wYpepPEYohtnAyMYFjilIHBnoIeI=; b=ZpxYM3CWsoYBDc5+Qftrw2l1hSsM6jGKAVQ5OL9avHQqBxhYHV6iQqzAwLWqt+OvU5 W5IxphpMilME6I/MH+6B4dR5uZW/GLe3TnO3RFHLCnyUJWbfH3bc+v+baqiqKRqIcM87 3hkuNN+YYDOIwLjMfpDtK+qJ9W9wC4eZyX639LA0XfFzNqq79qjWEaXNZbXbyBnNV5bx /AW5RRs1en4amb2XC+1EtQpdm9TWl1k0j7+DT4umPt6r2LP3OOB99yDfzBDzNycIs0A9 7CgFbB/L+ZMTT9nfgENgQh5yd16px1UaYDFZTTKmNBRNt444dxyneKU2mt3LzZtIPR7b 8JYA== X-Gm-Message-State: AOAM530hN7UVs1+QRrQgWcQsQWuWbGByN1vMpjT4OX6ziMngPg0DUGvF 9yMP+ltcg4wcG7ghytEr9h8d7Xbc/iNhKxRM X-Google-Smtp-Source: ABdhPJxVb4FfGDhcZH6uH4nV1jroG6lv90JqLsXX9rV5drhV4lmvLl0HXFsSfFQ/37Dv4N0yzqrIEw== X-Received: by 2002:a05:6402:1d04:: with SMTP id dg4mr3989942edb.157.1629983359616; Thu, 26 Aug 2021 06:09:19 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:19 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 04/17] bridge: vlan: add support to set global vlan options Date: Thu, 26 Aug 2021 16:05:20 +0300 Message-Id: <20210826130533.149111-5-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add support to change global vlan options via a new vlan global set subcommand similar to the current vlan set subcommand. The man page and help are updated accordingly. The command works only with bridge devices. It doesn't support any options yet. Syntax: $ bridge vlan global set vid VID dev DEV Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ man/man8/bridge.8 | 20 ++++++++++++ 2 files changed, 100 insertions(+) diff --git a/bridge/vlan.c b/bridge/vlan.c index 69a1d3c295b6..34fba0a5bdfb 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -37,6 +37,7 @@ static void usage(void) " bridge vlan { set } vid VLAN_ID dev DEV [ state STP_STATE ]\n" " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" + " bridge vlan global { set } vid VLAN_ID dev DEV\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -338,6 +339,83 @@ static int vlan_option_set(int argc, char **argv) return 0; } +static int vlan_global_option_set(int argc, char **argv) +{ + struct { + struct nlmsghdr n; + struct br_vlan_msg bvm; + char buf[1024]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct br_vlan_msg)), + .n.nlmsg_flags = NLM_F_REQUEST, + .n.nlmsg_type = RTM_NEWVLAN, + .bvm.family = PF_BRIDGE, + }; + struct rtattr *afspec; + short vid_end = -1; + char *d = NULL; + short vid = -1; + + afspec = addattr_nest(&req.n, sizeof(req), + BRIDGE_VLANDB_GLOBAL_OPTIONS); + afspec->rta_type |= NLA_F_NESTED; + while (argc > 0) { + if (strcmp(*argv, "dev") == 0) { + NEXT_ARG(); + d = *argv; + req.bvm.ifindex = ll_name_to_index(d); + if (req.bvm.ifindex == 0) { + fprintf(stderr, "Cannot find network device \"%s\"\n", + d); + return -1; + } + } else if (strcmp(*argv, "vid") == 0) { + char *p; + + NEXT_ARG(); + p = strchr(*argv, '-'); + if (p) { + *p = '\0'; + p++; + vid = atoi(*argv); + vid_end = atoi(p); + if (vid >= vid_end || vid_end >= 4096) { + fprintf(stderr, "Invalid VLAN range \"%hu-%hu\"\n", + vid, vid_end); + return -1; + } + } else { + vid = atoi(*argv); + } + if (vid >= 4096) { + fprintf(stderr, "Invalid VLAN ID \"%hu\"\n", + vid); + return -1; + } + addattr16(&req.n, sizeof(req), BRIDGE_VLANDB_GOPTS_ID, + vid); + if (vid_end != -1) + addattr16(&req.n, sizeof(req), + BRIDGE_VLANDB_GOPTS_RANGE, vid_end); + } else { + if (matches(*argv, "help") == 0) + NEXT_ARG(); + } + argc--; argv++; + } + addattr_nest_end(&req.n, afspec); + + if (d == NULL || vid == -1) { + fprintf(stderr, "Device and VLAN ID are required arguments.\n"); + return -1; + } + + if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -1; + + return 0; +} + /* In order to use this function for both filtering and non-filtering cases * we need to make it a tristate: * return -1 - if filtering we've gone over so don't continue @@ -1016,6 +1094,8 @@ static int vlan_global(int argc, char **argv) matches(*argv, "lst") == 0 || matches(*argv, "list") == 0) return vlan_global_show(argc-1, argv+1); + else if (matches(*argv, "set") == 0) + return vlan_global_option_set(argc-1, argv+1); else usage(); } else { diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 9ec4cb1dec67..796d20b662ab 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -152,6 +152,13 @@ bridge \- show / manipulate bridge addresses and devices .B dev .IR DEV " ]" +.ti -8 +.BR "bridge vlan global set" +.B dev +.I DEV +.B vid +.IR VID " [ ]" + .ti -8 .BR "bridge vlan global" " [ " show " ] [ " .B dev @@ -902,6 +909,19 @@ option, the command displays per-vlan traffic statistics. This command displays the current vlan tunnel info mapping. +.SS bridge vlan global set - change vlan filter entry's global options + +This command changes vlan filter entry's global options. + +.TP +.BI dev " NAME" +the interface with which this vlan is associated. Only bridge devices are +supported for global options. + +.TP +.BI vid " VID" +the VLAN ID that identifies the vlan. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459735 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 2DB86C4320E for ; Thu, 26 Aug 2021 13:09:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D05E60EAF for ; Thu, 26 Aug 2021 13:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242604AbhHZNKY (ORCPT ); Thu, 26 Aug 2021 09:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242278AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F155C0617A8 for ; Thu, 26 Aug 2021 06:09:22 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id r19so4520392eds.13 for ; Thu, 26 Aug 2021 06:09:22 -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=ZM29v3ealuL3u63ymxXiHwHpgDk5gIlTm7WUhOMS5n4=; b=irjnN2oaMh46cxPwsyyEeytL9U1hf2oPbgyj64aNt4xWdOK9/YdzoX0wV3YCLDP2S2 AIhJSyhEkuL3ykMmhSyjKTmNTSv+3YCZghbo0F9YgTQkbQbH0AL/B2HUEFPMtvHlsFal H5Hotvzj5pLkhzKJgyD4bWSOlByFszJ7Z2uC8xfq5rzX6zkYo5LSMhwpJKyg01Wjl/lV vRs1/KeO4NJLOXa1BjF1fwwUtPToNZV7iY3lOz5JPG7/tIWhNC9818QQz5Kcb+YYoTTN mA2+CdnpWjG0AYAKP3mw8Ttzr/0//CLex53Bg2W+HleRLZfxaJT4oPx3su37KbxYN8Ll T/tg== 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=ZM29v3ealuL3u63ymxXiHwHpgDk5gIlTm7WUhOMS5n4=; b=Ze6evdBZQwqU6FpOdvdbSmF9oQ6jpe/hqdtqJRCXjvJNNqTLV6DpsXIfMcBn8zMX62 BVV0C/iOAuALTbk31XJ5yCdksDfzKCzlH9Bd/XXtxxNdScfTx3RhXGHFPCDyp2yJNfwZ T+3fI0Pi541Lty18647s7DScgrmRcli/ZruY63zJ6UKkbMhuZfTbs6i4K2rSjj3QwAUy 45YqIl31l/MMZumO8OWsupdryXZoh8lAXrdmTAdWSB5jiReRenXXpqwJVK8DL/H7htWI xBvIYwD6J4ZSuTV8SnjTNoZGxkuieNSXk/8vHwP4FygHa58YKH33wtXumeRmj4WUfulg 7kXg== X-Gm-Message-State: AOAM532FJpIMum/TSJ63fvnPyJ3vP2laXUnK6/TeM2Fb+UXwcAtk+qYT ZGCuXvZU8GiDTuzUV7z+jq7cCqTNqwobrSgi X-Google-Smtp-Source: ABdhPJyxKLMPlFM7CrHDlZacOHt8lnFT4NW16z2CdOMlcj6ornF7KAzFvl5azM8i/88hUsVvOLwdlA== X-Received: by 2002:a05:6402:8c6:: with SMTP id d6mr4336707edz.30.1629983360783; Thu, 26 Aug 2021 06:09:20 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:20 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 05/17] bridge: vlan: add global mcast_snooping option Date: Thu, 26 Aug 2021 16:05:21 +0300 Message-Id: <20210826130533.149111-6-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_snooping option which controls if multicast snooping is enabled or disabled for a single vlan. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_snooping 1 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 19 +++++++++++++++++-- man/man8/bridge.8 | 11 ++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 34fba0a5bdfb..372e5b43be0f 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "json_print.h" #include "libnetlink.h" @@ -37,7 +38,7 @@ static void usage(void) " bridge vlan { set } vid VLAN_ID dev DEV [ state STP_STATE ]\n" " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" - " bridge vlan global { set } vid VLAN_ID dev DEV\n" + " bridge vlan global { set } vid VLAN_ID dev DEV [ mcast_snooping MULTICAST_SNOOPING ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -355,6 +356,7 @@ static int vlan_global_option_set(int argc, char **argv) short vid_end = -1; char *d = NULL; short vid = -1; + __u8 val8; afspec = addattr_nest(&req.n, sizeof(req), BRIDGE_VLANDB_GLOBAL_OPTIONS); @@ -397,6 +399,12 @@ static int vlan_global_option_set(int argc, char **argv) if (vid_end != -1) addattr16(&req.n, sizeof(req), BRIDGE_VLANDB_GOPTS_RANGE, vid_end); + } else if (strcmp(*argv, "mcast_snooping") == 0) { + NEXT_ARG(); + if (get_u8(&val8, *argv, 0)) + invarg("invalid mcast_snooping", *argv); + addattr8(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING, val8); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -702,7 +710,7 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) static void print_vlan_global_opts(struct rtattr *a, int ifindex) { - struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1]; + struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1], *vattr; __u16 vid, vrange = 0; if ((a->rta_type & NLA_TYPE_MASK) != BRIDGE_VLANDB_GLOBAL_OPTIONS) @@ -729,6 +737,13 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) } print_range("vlan", vid, vrange); print_nl(); + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING]; + print_uint(PRINT_ANY, "mcast_snooping", "mcast_snooping %u ", + rta_getattr_u8(vattr)); + } + print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 796d20b662ab..d894289b2dc2 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -157,7 +157,9 @@ bridge \- show / manipulate bridge addresses and devices .B dev .I DEV .B vid -.IR VID " [ ]" +.IR VID " [ " +.B mcast_snooping +.IR MULTICAST_SNOOPING " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -922,6 +924,13 @@ supported for global options. .BI vid " VID" the VLAN ID that identifies the vlan. +.TP +.BI mcast_snooping " MULTICAST_SNOOPING " +turn multicast snooping for VLAN entry with VLAN ID on +.RI ( MULTICAST_SNOOPING " > 0) " +or off +.RI ( MULTICAST_SNOOPING " == 0). Default is on. " + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459733 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 467AEC432BE for ; Thu, 26 Aug 2021 13:09:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 286A460F39 for ; Thu, 26 Aug 2021 13:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242580AbhHZNKW (ORCPT ); Thu, 26 Aug 2021 09:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242341AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82520C0617AD for ; Thu, 26 Aug 2021 06:09:23 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id b7so4605750edu.3 for ; Thu, 26 Aug 2021 06:09:23 -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=NftQxmYPxo3GG5EzKsDrgiloRa3JulEDPqpRpzypQNI=; b=mP2kZK9OTQgDN9CDUyvabj1K2KC0RYUGOw1IVUHGtsI37odo4DsQJ3ywqRWeMF20// fjQ30LxQFd0zV5G7ZuLJR8lz/qgm85LfNPTpGZGDKSkhKAs/uLKJ6frX7TfnLvpMYmRi xxbhZXsICIWy42oLnUi2QSdUdqp2Sw6iCiDCWpseLdZvUFm8zKDnL8bmiunyK2F/xQXg otdww/D79FIk+IhD49MdC8sGR3mTeVI/vnBvWNB1e7ubILXadL/HtkCnMn7dIEkDmjG9 sPlFnYwFt20YQfmhy6Cjsw9nPnYRHL0FB5ybzHGRCj5tCh5cD1YGtBWRjs2370W/Pn+5 NmkQ== 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=NftQxmYPxo3GG5EzKsDrgiloRa3JulEDPqpRpzypQNI=; b=hiiuXZDnd0Uj8lOlDk8nAMRDPwiAeLeNnkYaHSHbFCBJSFvEPSGE+BgInC0Rf0J3qi SaPRQ5+wZaANcQxtBitHLwMHBty519kfBBGNgasYqauFR2O4FoC1WgXGMukC9CPYVP28 a8l9igqNCTbnbKNBFyzMncGRg9dmozOSRScJAHCSzv58RyC6lZFodmm6ab6TML9CpbAI ldM56+I8t7AZ2IT4QxrZvsQec515+3EbMGjaLjuVxCgcE9vsKf/OBJPbDLKkB71/UwNp YG5zhuho3RUBrSlPiVoUUVJho4qwXuUw6jS+iZV2d6CSoKBajM9bbH1MfAC4UCQjIIdj WPhg== X-Gm-Message-State: AOAM5315fSKdQA2hxce2RjqJjh/bWYnFrhmRpREhYveMj+mJ0BzXumU6 Ek7XI5jNNy6EFoPZeyoW0IXh5bJnvQvH/4jy X-Google-Smtp-Source: ABdhPJyfm5mGp6K+Oh3hHprfD74MF2hPULZ6UTpO+R+LhKAdwFoMoV2ponHNYVOz+1o6Zh+vLdPrqg== X-Received: by 2002:a05:6402:d6b:: with SMTP id ec43mr916075edb.107.1629983361863; Thu, 26 Aug 2021 06:09:21 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:21 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 06/17] bridge: vlan: add global mcast_igmp_version option Date: Thu, 26 Aug 2021 16:05:22 +0300 Message-Id: <20210826130533.149111-7-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_igmp_version option which controls the IGMP version on the vlan (default 2). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_igmp_version 3 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 12 ++++++++++++ man/man8/bridge.8 | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 372e5b43be0f..346026b6f955 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -39,6 +39,7 @@ static void usage(void) " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan global { set } vid VLAN_ID dev DEV [ mcast_snooping MULTICAST_SNOOPING ]\n" + " [ mcast_igmp_version IGMP_VERSION ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -405,6 +406,12 @@ static int vlan_global_option_set(int argc, char **argv) invarg("invalid mcast_snooping", *argv); addattr8(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING, val8); + } else if (strcmp(*argv, "mcast_igmp_version") == 0) { + NEXT_ARG(); + if (get_u8(&val8, *argv, 0)) + invarg("invalid mcast_igmp_version", *argv); + addattr8(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION, val8); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -743,6 +750,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) print_uint(PRINT_ANY, "mcast_snooping", "mcast_snooping %u ", rta_getattr_u8(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]; + print_uint(PRINT_ANY, "mcast_igmp_version", + "mcast_igmp_version %u ", rta_getattr_u8(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index d894289b2dc2..224647b49843 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -159,7 +159,9 @@ bridge \- show / manipulate bridge addresses and devices .B vid .IR VID " [ " .B mcast_snooping -.IR MULTICAST_SNOOPING " ]" +.IR MULTICAST_SNOOPING " ] [ " +.B mcast_igmp_version +.IR IGMP_VERSION " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -931,6 +933,10 @@ turn multicast snooping for VLAN entry with VLAN ID on or off .RI ( MULTICAST_SNOOPING " == 0). Default is on. " +.TP +.BI mcast_igmp_version " IGMP_VERSION " +set the IGMP version. Default is 2. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459737 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 E08DDC432BE for ; Thu, 26 Aug 2021 13:09:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C05E060F39 for ; Thu, 26 Aug 2021 13:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242522AbhHZNK0 (ORCPT ); Thu, 26 Aug 2021 09:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242365AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9C60C0617AE for ; Thu, 26 Aug 2021 06:09:25 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id g22so4547722edy.12 for ; Thu, 26 Aug 2021 06:09:25 -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=Hye+h2craTGXO3/8i1mqA88tF8d6QqW/HA7G4Bin9aw=; b=ruN/zXezT/vglxL3bmoOxtPokVPM3/dqhJ5fz2Lbc4ZAQHev8XLFS7W4OmEhQ1bm5F BwVj90FJJWif+ydi20dyCI7DJL7JQtTq9wRge6vRLvWp3wb/eGey3LaqNCwDY5MWu6wK IPaWcX/dy7Bx6FDscs2tsyaVt6h7Sz/DaTDYMeJSX9OH/sXTUqNZJ2nSVubsI7DFT4eJ NCPwdI4SCJAXewlJhLUtRyZfRAVDzbxQye/xhIv03+uTSyxPg9QnS1GoCnJP1k6WH6fP Bn/GvE2WM884+fctD8+aA7aJFGOhUBaJi6FvEDTUnAgv/MlRU+qWkOHCmdgwB8LLfiBt E39w== 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=Hye+h2craTGXO3/8i1mqA88tF8d6QqW/HA7G4Bin9aw=; b=QFthBPtvQxIahzr0DesHEV0tY44EHrfxBbG55DfLlYsTBT3yovkNkvwBT4bueCiZCV MaVQtTelKew3cf+etO3vjF2cL1gmUW57DUpxWOzdhSNINXFfbv87WX93JTJmmjJ9RG5t QDO8NtRIlnkAzk89ck58Oipz9Sj9xUFPaMb+/KZwbtuncLyjv4RBaPHHVv7twnY0fYLj GUVFdsSJbJD7DQLBANwW8MsMw9xCIADRRyofj7fc9SkZimMdUfRCT+jgz2JwWrPn8Dx/ yiS/dhkiCV90WYQCgBCivbq2JVjjo3xo9BpdS7f7xOKxUa4S8rAOkgKrRi2l8ds7sgq6 p/Yg== X-Gm-Message-State: AOAM531fnhz6h8A0QcVYfMTrk8yuJIz7v90XlFcPTxXqCtKVOAk/zf/N KOPXfyrKRU/cPbZk6jmVo+9NVYGNFHMy/Wlb X-Google-Smtp-Source: ABdhPJyvr0Vg7eb9kNg+SgK5MWj55LTa/OunEmVScpYpFCwaqQoxqvFwuHkok8uSwYBs48rfLylqqg== X-Received: by 2002:a05:6402:714:: with SMTP id w20mr368976edx.62.1629983363575; Thu, 26 Aug 2021 06:09:23 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:23 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 07/17] bridge: vlan: add global mcast_mld_version option Date: Thu, 26 Aug 2021 16:05:23 +0300 Message-Id: <20210826130533.149111-8-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_mld_version option which controls the MLD version on the vlan (default 1). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_mld_version 2 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 12 ++++++++++++ man/man8/bridge.8 | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 346026b6f955..00b4f8a00d9b 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -40,6 +40,7 @@ static void usage(void) " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan global { set } vid VLAN_ID dev DEV [ mcast_snooping MULTICAST_SNOOPING ]\n" " [ mcast_igmp_version IGMP_VERSION ]\n" + " [ mcast_mld_version MLD_VERSION ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -412,6 +413,12 @@ static int vlan_global_option_set(int argc, char **argv) invarg("invalid mcast_igmp_version", *argv); addattr8(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION, val8); + } else if (strcmp(*argv, "mcast_mld_version") == 0) { + NEXT_ARG(); + if (get_u8(&val8, *argv, 0)) + invarg("invalid mcast_mld_version", *argv); + addattr8(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION, val8); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -755,6 +762,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) print_uint(PRINT_ANY, "mcast_igmp_version", "mcast_igmp_version %u ", rta_getattr_u8(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION]; + print_uint(PRINT_ANY, "mcast_mld_version", + "mcast_mld_version %u ", rta_getattr_u8(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 224647b49843..dcbff9367334 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -161,7 +161,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_snooping .IR MULTICAST_SNOOPING " ] [ " .B mcast_igmp_version -.IR IGMP_VERSION " ]" +.IR IGMP_VERSION " ] [ " +.B mcast_mld_version +.IR MLD_VERSION " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -937,6 +939,10 @@ or off .BI mcast_igmp_version " IGMP_VERSION " set the IGMP version. Default is 2. +.TP +.BI mcast_mld_version " MLD_VERSION " +set the MLD version. Default is 1. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459739 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 E1020C4320A for ; Thu, 26 Aug 2021 13:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C484360EAF for ; Thu, 26 Aug 2021 13:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241444AbhHZNK3 (ORCPT ); Thu, 26 Aug 2021 09:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242091AbhHZNKN (ORCPT ); Thu, 26 Aug 2021 09:10:13 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48836C0613C1 for ; Thu, 26 Aug 2021 06:09:26 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id s25so4662129edw.0 for ; Thu, 26 Aug 2021 06:09:26 -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=SAHIuM6aUX02e/D7QQ2Nf6PHecj7go+UggKGNFx80hk=; b=l+M/EVJz/dxoklzcE66JmNc9UgcPb7CmYTNDx7YmaHFSKmMH7HckgHvMna85FyMW28 BzNWelxVO4d+e5zk6k8my/I643gUludXo2qtfAdtS7dQ+oGHg9izLtfBXfgHwSVcKJEK 0bVYpKaXi//JGpIb1idWtynSNn4NtxQKuN3kwFXsusnqokcZCwS3uAPGeIKZuDAYK7xU lEzH3kezIrb25eXweWwb9sGrB+moXTsSGtWpjQZqJ6JE9CSMsrGyyALl4OKCKHk3OnuK lnJuZMI0yugt5zo6d1IfF04ygw9VqL90qaa04i5cUuzRubbdhj9nvIVAhVVAvFdLMrAz 5JRA== 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=SAHIuM6aUX02e/D7QQ2Nf6PHecj7go+UggKGNFx80hk=; b=Fg/VZYJJWmRCj0Icfc4ejxxuZXCZc81LYFdzZwmcQ7XvR3D67kqBCMwCxElyRvcccr DfP3Aqei5Cyye4qcH2Y+7fOATNQZ1mbT6OC9y+hpTm30LBpwzknzRjhOgPp5nL1T6P0O Y4xZMk9AwqVrltPEyx8KEP/kRa+qkE/0G2iMlrcGrx6venWCeaxucJXIyYWiKGF4Ifux IUtJ1PZS0gBLpzJwczFc+pFRR/Ns1GXE/NbSU9azgh6VI8kwyEcnAqwLV3YH25sXnV7t MBw6rVE9KXurcm3vR5EibZmNhswuAmLAS2EoPA1jQ22T9moqf7ka3cx2DZqk4lgZDkWC ebvQ== X-Gm-Message-State: AOAM5313Zs6S/YsblrFOIn5NmfxkvQuKcRawr5HLJkBc+SLNoHwPfT61 IDjcB5qroH4Nmu+mJ0exFL93S5CY9mDypxWZ X-Google-Smtp-Source: ABdhPJzK1mV08PZVd5NTiZV1AMQKaSs/O6YWtu2hFmmVBRl363d8mk0dsEAa1RVYHvFpz3Ap+7yTbA== X-Received: by 2002:aa7:cf82:: with SMTP id z2mr4263012edx.254.1629983364624; Thu, 26 Aug 2021 06:09:24 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:24 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 08/17] bridge: vlan: add global mcast_last_member_count option Date: Thu, 26 Aug 2021 16:05:24 +0300 Message-Id: <20210826130533.149111-9-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_last_member_count option which controls the number of queries the bridge will send on the vlan after a leave is received (default 2). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_last_member_count 10 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 00b4f8a00d9b..ee9442e3908f 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -41,6 +41,7 @@ static void usage(void) " bridge vlan global { set } vid VLAN_ID dev DEV [ mcast_snooping MULTICAST_SNOOPING ]\n" " [ mcast_igmp_version IGMP_VERSION ]\n" " [ mcast_mld_version MLD_VERSION ]\n" + " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -358,6 +359,7 @@ static int vlan_global_option_set(int argc, char **argv) short vid_end = -1; char *d = NULL; short vid = -1; + __u32 val32; __u8 val8; afspec = addattr_nest(&req.n, sizeof(req), @@ -419,6 +421,13 @@ static int vlan_global_option_set(int argc, char **argv) invarg("invalid mcast_mld_version", *argv); addattr8(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION, val8); + } else if (strcmp(*argv, "mcast_last_member_count") == 0) { + NEXT_ARG(); + if (get_u32(&val32, *argv, 0)) + invarg("invalid mcast_last_member_count", *argv); + addattr32(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT, + val32); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -767,6 +776,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) print_uint(PRINT_ANY, "mcast_mld_version", "mcast_mld_version %u ", rta_getattr_u8(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT]; + print_uint(PRINT_ANY, "mcast_last_member_count", + "mcast_last_member_count %u ", + rta_getattr_u32(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index dcbff9367334..cea755184336 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -163,7 +163,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_igmp_version .IR IGMP_VERSION " ] [ " .B mcast_mld_version -.IR MLD_VERSION " ]" +.IR MLD_VERSION " ] [ " +.B mcast_last_member_count +.IR LAST_MEMBER_COUNT " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -943,6 +945,12 @@ set the IGMP version. Default is 2. .BI mcast_mld_version " MLD_VERSION " set the MLD version. Default is 1. +.TP +.BI mcast_last_member_count " LAST_MEMBER_COUNT " +set multicast last member count, ie the number of queries the bridge +will send before stopping forwarding a multicast group after a "leave" +message has been received. Default is 2. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459741 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 2F687C432BE for ; Thu, 26 Aug 2021 13:09:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09CCF60F39 for ; Thu, 26 Aug 2021 13:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242610AbhHZNKa (ORCPT ); Thu, 26 Aug 2021 09:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242466AbhHZNKP (ORCPT ); Thu, 26 Aug 2021 09:10:15 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C30C061757 for ; Thu, 26 Aug 2021 06:09:28 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id t19so6141952ejr.8 for ; Thu, 26 Aug 2021 06:09:28 -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=h+MjvZZhi13YxfUdVl5lVW2QMBSGT4N4+4fOZEIOdRc=; b=dkDcBpMmO4ufJQAEAnjNt/uLZNk/3GRtfmlIdhq1r2OdhU0IggMIOY+7NK08iLNWD4 M3SjHwQMBK8oaD1enVqu42BchoT8EyCHBPuC7+00r/pv8CuLqh0YIRhapnNjhQBrnrqo vwXuIoZv6wsOwpdXlfWSaiQKDPPnGrYVuRGfeXro2jC7toHrLEWtmPJWmAYc5PNF8QHW EOGqU0p+jKofZuWe9DKfQ4A2ECk7uS7lCqTTIiQZm1b+WaoNG2CWgIv611LgiJ7QJjTw BoJdGxfbYHNm4TaLRAHzDb8nYnVluTY6bYLxaBzCT5Z9Iy/hAcWhRRS4P73vBiLx7st4 vuuA== 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=h+MjvZZhi13YxfUdVl5lVW2QMBSGT4N4+4fOZEIOdRc=; b=aBZkALHFwWtmEUZQMOFDM+9wDGo0toZ0HZ8SY7ypC3iolooWM764ChucmoJI3nJtvA M3OR4kdqplNKENuJJVgF6pP9g2L74wY5q4wEnxAKi8scFiMGJV9Bi7mqBLfpluqlYaw+ aP5eiIPIvbJ/4uF7hIDEHfoGYMWSvMar13gdvkIRI8qH6/nVqxjskZUZvzryzRBgsBnI d+8ev3b61TOlAUhUizoJpre+fRWNclVt48lN6zto3Li2B9Xk+3Q2dpgPK9gvZ20efoLc 8ePSKcuAVolhJtBVAQ7mRNHsBcKeVZvxOqgAUXuknQvZOI77WX0oV/vE6t2thbj+JOTI SoKA== X-Gm-Message-State: AOAM532/KbdZPJaJHrl+M+3Js5svadnWYuw9tMp6lkzls6TAmzmdk97g XIzwLdL6XorOGP1dRkrpG7WzCyt2RlStALDY X-Google-Smtp-Source: ABdhPJwOuv7jYUAWrSP5Dwd0UuLqq8arJXlxPmYs8ojWkfbVC1pb6NVPgnhmKF2EDPgznTIiNkItbA== X-Received: by 2002:a17:907:12d5:: with SMTP id vp21mr4187961ejb.144.1629983365601; Thu, 26 Aug 2021 06:09:25 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:25 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 09/17] bridge: vlan: add global mcast_startup_query_count option Date: Thu, 26 Aug 2021 16:05:25 +0300 Message-Id: <20210826130533.149111-10-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_startup_query_count option which controls the number of queries the bridge will send on the vlan during startup phase (default 2). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_startup_query_count 5 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 8 +++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index ee9442e3908f..bf8555b87b33 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -42,6 +42,7 @@ static void usage(void) " [ mcast_igmp_version IGMP_VERSION ]\n" " [ mcast_mld_version MLD_VERSION ]\n" " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" + " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -428,6 +429,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr32(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT, val32); + } else if (strcmp(*argv, "mcast_startup_query_count") == 0) { + NEXT_ARG(); + if (get_u32(&val32, *argv, 0)) + invarg("invalid mcast_startup_query_count", + *argv); + addattr32(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT, + val32); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -782,6 +791,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_last_member_count %u ", rta_getattr_u32(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT]; + print_uint(PRINT_ANY, "mcast_startup_query_count", + "mcast_startup_query_count %u ", + rta_getattr_u32(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index cea755184336..7741382321cb 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -165,7 +165,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_mld_version .IR MLD_VERSION " ] [ " .B mcast_last_member_count -.IR LAST_MEMBER_COUNT " ]" +.IR LAST_MEMBER_COUNT " ] [ " +.B mcast_startup_query_count +.IR STARTUP_QUERY_COUNT " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -951,6 +953,10 @@ set multicast last member count, ie the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received. Default is 2. +.TP +.BI mcast_startup_query_count " STARTUP_QUERY_COUNT " +set the number of queries to send during startup phase. Default is 2. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459743 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 353A4C4320A for ; Thu, 26 Aug 2021 13:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1148260F39 for ; Thu, 26 Aug 2021 13:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242635AbhHZNKb (ORCPT ); Thu, 26 Aug 2021 09:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242491AbhHZNKQ (ORCPT ); Thu, 26 Aug 2021 09:10:16 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47ED8C0613CF for ; Thu, 26 Aug 2021 06:09:29 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id bt14so6190422ejb.3 for ; Thu, 26 Aug 2021 06:09:29 -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=VHIb4g/rbWh8Qy+OOXTamr/Z4haRg+kioKbGIb/RsaY=; b=XtljKKh6p09zS8028ja7SuIaqZAqYqW0peUbhOmyil/n1g3q5E16ujNKSAMaJpdMUr bI/q5qKDHaFy2TudKsfuUn719aECPpU6nr7kePPWrioBN6LgLmqxTgUNViwqSlRW6Fne PGvyzTdYhAop6pRICeoum2hAgC64PPIKE95OnO0TUNVoujD+yIb4XEMd/sds89yObRv2 7KAFDjPs0Ot5Slmc13M1hwn16KJabWO2/cZOa4QUBVWL2Tn4408S2RKjNvun84dmtvrR v4IEAQfQek5EHg5TQzk5Y2ts3aOvTqg/AvjhjxmlNxT2vydmEOWevFjgeDsIPYsH4bEl sxLg== 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=VHIb4g/rbWh8Qy+OOXTamr/Z4haRg+kioKbGIb/RsaY=; b=LYaN9zh9ufLefCUUKP82tUMbKcbDak/p1S9fF/HX4FnqU8XXlD/hDpeuOYUtAb+ZVv aq5D5PXa90AW0tuS3Kb560Kg63i7PMSIIdRruOShhn+ZMKel6m5BO6W2GAXU3h4ELA6R UtocyuNpY2UynfN8zmh0Mr8u5dd4due5mSYEq2cUY62BQIbVwe3vXKM1krUaer1e5IpG IC2zVWbhZsBqh6jLXnljMCuPgAjwcT9OTn/Wz2Ju2wMVK3I78JEQDq/evwAteb6IeoSZ Gj3OS6fKORueKfO80cDKQtHSglRbGcvOgVwIGw2gzFmJ0n9oKkCGTKERfo9mOFJblUSX nCGA== X-Gm-Message-State: AOAM5300rVtFIcXwCYyUwAU0WdF+qYyjBxY+vQkP5uRj/Qh1ga/+B8bn vjnnYooUa0pjx6WG3vYmWvo62VCGV6pSeCWo X-Google-Smtp-Source: ABdhPJzdtOP6qvnCrqy86u/lKFiJ1W6b2YgThaVmpObIcG7t75MHyR/ckueEQXOfvtF0BGmDLDm8LQ== X-Received: by 2002:a17:906:1f82:: with SMTP id t2mr4108433ejr.499.1629983367620; Thu, 26 Aug 2021 06:09:27 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:27 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 10/17] bridge: vlan: add global mcast_last_member_interval option Date: Thu, 26 Aug 2021 16:05:26 +0300 Message-Id: <20210826130533.149111-11-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_last_member_interval option which controls the interval between queries to find remaining members of a group after a leave message. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. The default is 100 (1 second). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_last_member_interval 200 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 16 ++++++++++++++++ man/man8/bridge.8 | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/bridge/vlan.c b/bridge/vlan.c index bf8555b87b33..c3234a90b4fa 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -42,6 +42,7 @@ static void usage(void) " [ mcast_igmp_version IGMP_VERSION ]\n" " [ mcast_mld_version MLD_VERSION ]\n" " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" + " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); @@ -360,6 +361,7 @@ static int vlan_global_option_set(int argc, char **argv) short vid_end = -1; char *d = NULL; short vid = -1; + __u64 val64; __u32 val32; __u8 val8; @@ -437,6 +439,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr32(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT, val32); + } else if (strcmp(*argv, "mcast_last_member_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_last_member_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -791,6 +801,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_last_member_count %u ", rta_getattr_u32(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL]; + print_lluint(PRINT_ANY, "mcast_last_member_interval", + "mcast_last_member_interval %llu ", + rta_getattr_u64(vattr)); + } if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT]) { vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT]; print_uint(PRINT_ANY, "mcast_startup_query_count", diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 7741382321cb..0d973a9db0e0 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -166,6 +166,8 @@ bridge \- show / manipulate bridge addresses and devices .IR MLD_VERSION " ] [ " .B mcast_last_member_count .IR LAST_MEMBER_COUNT " ] [ " +.B mcast_last_member_interval +.IR LAST_MEMBER_INTERVAL " ] [ " .B mcast_startup_query_count .IR STARTUP_QUERY_COUNT " ]" @@ -953,6 +955,11 @@ set multicast last member count, ie the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received. Default is 2. +.TP +.BI mcast_last_member_interval " LAST_MEMBER_INTERVAL " +interval between queries to find remaining members of a group, +after a "leave" message is received. + .TP .BI mcast_startup_query_count " STARTUP_QUERY_COUNT " set the number of queries to send during startup phase. Default is 2. From patchwork Thu Aug 26 13:05:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459745 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 88985C432BE for ; Thu, 26 Aug 2021 13:09:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DB6B60FDC for ; Thu, 26 Aug 2021 13:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242600AbhHZNKd (ORCPT ); Thu, 26 Aug 2021 09:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242505AbhHZNKR (ORCPT ); Thu, 26 Aug 2021 09:10:17 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BDBBC0613D9 for ; Thu, 26 Aug 2021 06:09:30 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id q17so4619976edv.2 for ; Thu, 26 Aug 2021 06:09:30 -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=LXoTQjT690UTi85KZOBEPTBy3nlvqPY2wCUxhhXWuoA=; b=TH2GLBq9ijzPCJO+Nk7BH2DkXgsoKLBJZoJ0y7/bobujYjrryzJzlTPDfTpaABX+Fq 5Qg0RTU2bRGFwtI4sdkjDzEwkgcHN6WIvFxgvb1iwVEqX4V8O1rKQ3KDH1/7SjlERXPW pcYW6bJD97ht33wtHAnKPACCZflSQVYJq5MGLcySEbFtHKd1Xpf1lXgSir2pW5pCdn3l W2ovXC8aEtLWrNhIX5NJP9rRx4nqZfRFMSJEFuQebnIJv/YyjAh3zTwlcbGdqFB1nsZ6 VURN6T9UAH+CHTlliSyHzSfKmpDGqqZLTAHImQjTyIiOfFFf7P7usvZSaQAQ0ThVnEoB d5Sw== 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=LXoTQjT690UTi85KZOBEPTBy3nlvqPY2wCUxhhXWuoA=; b=NfwdERNx6sJSVCoYOC8Avhdjc7PDtZK90jia1WX/V1woFOU21nWyvV385of6KtGzov VVTUSgsIKgohm2M5n5b7E6WSLA2EeBIgrNqtP1Cix46u1H4Ogz3MtvsXw9EuJdS5LxOu 8Z1kUxM4EXWzn8QCYgRDm4L89Pfnp+DoxcDCr5GgnnQHTQUchWqL0nnGoBe1YI+lDLyg Wxx46YySAV3mIiaLW0js17/Sgi63PKNMX+VphW/Zic4tsIbwG5vT/7z/THSjPcadhRPw yKzlTBnxwK6jZ/dnNBYR5uuQbPlnUdLQQNh9TE80QOaikogonX8fvOoUH2MfAgO3M6Nr 9uhw== X-Gm-Message-State: AOAM530/ui2Ow1TWdCArLqm/lpxMIi8Vqi8x7fb63G+ARYWs3Y2G4PnW roMp/VeF6Aq0LVH+BdD+y4jxBBmzgvkz2DmG X-Google-Smtp-Source: ABdhPJxEO0U+KfLBpqHFmakXAm2TO8K1qPTBI6baEi82MB4Op27FvczBwIEkxsQrxzz9X5tFdDxSwQ== X-Received: by 2002:aa7:dd12:: with SMTP id i18mr4146889edv.368.1629983368701; Thu, 26 Aug 2021 06:09:28 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:28 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 11/17] bridge: vlan: add global mcast_membership_interval option Date: Thu, 26 Aug 2021 16:05:27 +0300 Message-Id: <20210826130533.149111-12-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_membership_interval option which controls the interval after which the bridge will leave a group if no reports have been received for it. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. The default is 26000 (260 seconds). Syntax: $ bridge vlan global set dev bridge vid 1 mcast_membership_interval 13000 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index c3234a90b4fa..757c34c6497b 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -44,6 +44,7 @@ static void usage(void) " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" + " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -447,6 +448,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr64(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL, val64); + } else if (strcmp(*argv, "mcast_membership_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_membership_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -813,6 +822,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_startup_query_count %u ", rta_getattr_u32(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL]; + print_lluint(PRINT_ANY, "mcast_membership_interval", + "mcast_membership_interval %llu ", + rta_getattr_u64(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 0d973a9db0e0..a026ca16f89a 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -169,7 +169,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_last_member_interval .IR LAST_MEMBER_INTERVAL " ] [ " .B mcast_startup_query_count -.IR STARTUP_QUERY_COUNT " ]" +.IR STARTUP_QUERY_COUNT " ] [ " +.B mcast_membership_interval +.IR MEMBERSHIP_INTERVAL " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -964,6 +966,11 @@ after a "leave" message is received. .BI mcast_startup_query_count " STARTUP_QUERY_COUNT " set the number of queries to send during startup phase. Default is 2. +.TP +.BI mcast_membership_interval " MEMBERSHIP_INTERVAL " +delay after which the bridge will leave a group, +if no membership reports for this group are received. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459747 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 B41A4C4320A for ; Thu, 26 Aug 2021 13:09:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94FE360EAF for ; Thu, 26 Aug 2021 13:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242091AbhHZNKe (ORCPT ); Thu, 26 Aug 2021 09:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242564AbhHZNKT (ORCPT ); Thu, 26 Aug 2021 09:10:19 -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 5A59EC0617A8 for ; Thu, 26 Aug 2021 06:09:31 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id bt14so6190595ejb.3 for ; Thu, 26 Aug 2021 06:09:31 -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=Sjd0EUn1Nz66aOXuJU4ejq3SwyE3zJni8Naxa0nEgqI=; b=Pl4NIj+Y0G4g2PJJTvpFUzJ5ETuNvULzaiiqtDS75T9R/t90cEfKkIFpVv75Ev8K0u iZBUU8BtnLzvHqWyll54+owJ7/ERBVo/WFdEoCSSnKNGYWuhieM41A1cirsgOcHCsYFy mTt5iud3Ssuq/hy8n3h7zXYMS4DreIHXlX6c3XyqOhmxremFdaqZgHh3s/OUw8F/TLUS QHvvIudyYN+dAtRBrv4qVhVM5/yjgr6hqq7SIF3p4D2BWlZYDZA8UjOAX2UepzPAXz+3 fhSbK3i1Bzy1CNUQ++ttwFmUfl4pVUtTMWm9Ms2d9NCYCgxH6Z+lTun6nyJ0Td4SucW2 /NhA== 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=Sjd0EUn1Nz66aOXuJU4ejq3SwyE3zJni8Naxa0nEgqI=; b=azPiqfwnsd/pIfLyvx3MeMGg6le+pB8XO8mT007+1Idx00YZ3QZ3VNqIlfjQQ+9+qG DoPy94vB8IhCmWb1Dn+Jb77+2kjC6GZkgqm/eYWoREMrJ0cQQ/n89exWjrORtkQoIMEq dBZmxgj6XhCSSb5mefsHk8ss3cmhULlLGFvBdjZKMR1LD0euasViuWl+WxtDdzp5zZ1T EK4OtAybQg5eB2oP6QX7HFNo8kmhnUkIgU4FcB1+ouEGMbvv1O0UU/SsH7YuDIAdgo0P i9zKBoRUZ5hqaiCIxfDZHznIfwHcIANR/hCgP6J8Weake289b2lz6WrKQ1IfveF1YbpE vnPw== X-Gm-Message-State: AOAM531dSTSmTBp8ww2yGJVqh8hCB/xP4TDCF+Fab0tj+0HsOl172poI oluNuguIXuxDZmOmBUVpivm2lSu0NbYEp1hr X-Google-Smtp-Source: ABdhPJy6gdJHTZXhfTymSiVSiaEct/H91INF9Os4djFbUeINItCGjN/q220vTr3t3lueFk/AnVE48g== X-Received: by 2002:a17:906:30d8:: with SMTP id b24mr4162771ejb.358.1629983369637; Thu, 26 Aug 2021 06:09:29 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:29 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 12/17] bridge: vlan: add global mcast_querier_interval option Date: Thu, 26 Aug 2021 16:05:28 +0300 Message-Id: <20210826130533.149111-13-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_querier_interval option which controls the interval after which if no other router queries are seen the bridge will start sending its own queries. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_querier_interval 13000 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 12 +++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 757c34c6497b..c7cd069c29a4 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -45,6 +45,7 @@ static void usage(void) " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" + " [ mcast_querier_interval QUERIER_INTERVAL ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -456,6 +457,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr64(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL, val64); + } else if (strcmp(*argv, "mcast_querier_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_querier_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -828,6 +837,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_membership_interval %llu ", rta_getattr_u64(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL]; + print_lluint(PRINT_ANY, "mcast_querier_interval", + "mcast_querier_interval %llu ", + rta_getattr_u64(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index a026ca16f89a..f5c72ec83f93 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -171,7 +171,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_startup_query_count .IR STARTUP_QUERY_COUNT " ] [ " .B mcast_membership_interval -.IR MEMBERSHIP_INTERVAL " ]" +.IR MEMBERSHIP_INTERVAL " ] [ " +.B mcast_querier_interval +.IR QUERIER_INTERVAL " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -971,6 +973,14 @@ set the number of queries to send during startup phase. Default is 2. delay after which the bridge will leave a group, if no membership reports for this group are received. +.TP +.BI mcast_querier_interval " QUERIER_INTERVAL " +interval between queries sent by other routers. If no queries are seen +after this delay has passed, the bridge will start to send its own queries +(as if +.BI mcast_querier +was enabled). + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459749 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 CE593C43214 for ; Thu, 26 Aug 2021 13:09:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4C5D60F39 for ; Thu, 26 Aug 2021 13:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242630AbhHZNKf (ORCPT ); Thu, 26 Aug 2021 09:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242565AbhHZNKT (ORCPT ); Thu, 26 Aug 2021 09:10:19 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9E7C0617AE for ; Thu, 26 Aug 2021 06:09:32 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ia27so6132247ejc.10 for ; Thu, 26 Aug 2021 06:09:32 -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=EFcZZdhQYrOSc7ekJCimNuGSWWEbvofzt4SglFR8sLg=; b=ZHt+gLaczvD3GXB/FGAYHFzDdtbRtDIExHJXu0+DiydojAhPn1w0jMAoCgAxovg6Mb TlcTXbDs44V7bV5h9FuuU7t79H1dzmFY3KitNu3xYPDaU5YinYBUEdf7njHxBrSlD98Z gwPgRgGjB0LGtxQfEUi38ktPKctSIgLUnHg9NI7/lEX9YizzOhsAk8tsaI58NqF8hOL5 xGjR0UgcFNOUIUNeKcWi/eQC/DHovLZk7JAcq7k1AS5cjYABvPJEDy3aYRPJnFUEV+ER JBb3QrM8RxeltjjJna4lBRpNwoQgKnBR5R7b/E7+kbOmMxmi+etpBla4P+cCQqBPAoZO 919g== 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=EFcZZdhQYrOSc7ekJCimNuGSWWEbvofzt4SglFR8sLg=; b=i5KTMOES6lC4nKzBoXeWuHzvl9jzenYs3OYf3VHi7IT++6PGju5dJkBzToNPF2GJNW XnzyfV3pDkZ0lD1XQh0Qn2BskNaPDgBFzGmHyYT0SiINNTusRZbNkl4b9tzWaY8xlxAm bhCbSaWiq8rIrnSgnfqCzq64+oYV4uOqpcDNrQ/1w8Yc6uIKwEboqPl1QYO34Huk8q6X pEPpFFTu3N+8x3Do2bw10+g/W5y3mUY5ZglZFnyhz9da5Xv99ftF4uEGSg7uod9s5+/N OlvlObuDjVB0tsKhee6rKBqQyxvcPEhWyUkG7MDQ6OGLKxtqhNjBV9QoCNmYZVS+l9Ut PtPw== X-Gm-Message-State: AOAM53174DuCdOnJpV8UEvB7+hNhZEGM/aOjyfAuqXU2F1zZb8C7Ei8l AL40tvJaBCfveYDniOGqznZzxvMUaVF77KLq X-Google-Smtp-Source: ABdhPJy9kfCbY8UcFpVdk8Sm5OFCBN8O8srKSkfGcb1dAojsUmGFCbMP+J/nlQf8ol0D6xmgQVlX6w== X-Received: by 2002:a17:906:8258:: with SMTP id f24mr4208100ejx.375.1629983370665; Thu, 26 Aug 2021 06:09:30 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:30 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 13/17] bridge: vlan: add global mcast_query_interval option Date: Thu, 26 Aug 2021 16:05:29 +0300 Message-Id: <20210826130533.149111-14-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_query_interval option which controls the interval between queries sent by the bridge after the end of the startup phase. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_query_interval 13000 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index c7cd069c29a4..206cbdea10cb 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -46,6 +46,7 @@ static void usage(void) " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" " [ mcast_querier_interval QUERIER_INTERVAL ]\n" + " [ mcast_query_interval QUERY_INTERVAL ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -465,6 +466,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr64(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL, val64); + } else if (strcmp(*argv, "mcast_query_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_query_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -843,6 +852,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_querier_interval %llu ", rta_getattr_u64(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL]; + print_lluint(PRINT_ANY, "mcast_query_interval", + "mcast_query_interval %llu ", + rta_getattr_u64(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index f5c72ec83f93..cb1170f8d5c9 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -173,7 +173,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_membership_interval .IR MEMBERSHIP_INTERVAL " ] [ " .B mcast_querier_interval -.IR QUERIER_INTERVAL " ]" +.IR QUERIER_INTERVAL " ] [ " +.B mcast_query_interval +.IR QUERY_INTERVAL " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -981,6 +983,11 @@ after this delay has passed, the bridge will start to send its own queries .BI mcast_querier was enabled). +.TP +.BI mcast_query_interval " QUERY_INTERVAL " +interval between queries sent by the bridge after the end of the +startup phase. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459751 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9D7E0C432BE for ; Thu, 26 Aug 2021 13:09:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FC1360EAF for ; Thu, 26 Aug 2021 13:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242647AbhHZNKh (ORCPT ); Thu, 26 Aug 2021 09:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242583AbhHZNKX (ORCPT ); Thu, 26 Aug 2021 09:10:23 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64312C0612E7 for ; Thu, 26 Aug 2021 06:09:33 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id i21so6198553ejd.2 for ; Thu, 26 Aug 2021 06:09:33 -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=rh7b2Wwkbp6esgEZ9J931WL5wtmpsrFSUK5at9Uty1o=; b=jcdF7ZWiZqI4imWAHWOYdOnKaa/k9SMBpgxMrlgOG8kUObAIhD8AHkrDfQ8EPudT2L ViOLh+VuuOVcdYKZziytaBOY6LITyVHB+koKvh0fKxwPbKgNIVdvAvzn9lbNaa91xu38 VVuDsfugb00tvMLBZuIiXA3YHytorlgagpYgbXFE0rr/jfmxqF8u3WL4rGZ+Ytdrhk/T KX/IX0a8VR8g+Q+pQdquMxIDLsC317ajj7h1VjrRLRJ88SfuFcidv+qyiuPqxKcyP61F TatF2Wz+JypXiBWVnHTWhgnClNh0RJdh5ZccbvxPrtXo+f06MilOvqUzvqt9baZ7SmZ5 Tf8Q== 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=rh7b2Wwkbp6esgEZ9J931WL5wtmpsrFSUK5at9Uty1o=; b=tMsuCt3OY/ibd02Vkp3K7GUlZLl4RP3TN+t/mw6XWsUHaykXpsBJOxDA2AgYMRnhJG BpEc4i25fHNB6OER8jSW3+MyUV/icDxoptZSOIx7aIq/E0wraQefHsC4OWtRwAdDHuZc 5Rf+OlQokT7ZFzbNeBn1X9b28wzH7dQ8YKrYh/NnhW+7weD9P/XawEK5biRFm4EFwZ5p TrSrnODZYZ7uNi+FXify5bOJdQ/Wn0QdN9MtTCkf1ZXR4q2rB0acjUf9FXnZixJ1y5mR 2g/0mRlumqdc4vMSG7s5J+2ECodqxOsJ6hqxxsxF9uvcE7dfqVSUhXU27sK4ekplnd+/ Ph0A== X-Gm-Message-State: AOAM530T34uPxNwJRP4028ZCFaRxwhWIkU7kHlKAI2PKVLQoHpjnf1yO KpZrgrjb74c4ZH2x6jWZEAHJvu2NfZkyXIyO X-Google-Smtp-Source: ABdhPJzhbirsYnGYpSyJA7Yp4ZZ8Rq3DQPQkdOo65wicgpvh7BLuHUDu0NSf0fMJK5k4m5UTwZPNTA== X-Received: by 2002:a17:906:f207:: with SMTP id gt7mr4096742ejb.380.1629983371739; Thu, 26 Aug 2021 06:09:31 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:31 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 14/17] bridge: vlan: add global mcast_query_response_interval option Date: Thu, 26 Aug 2021 16:05:30 +0300 Message-Id: <20210826130533.149111-15-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_query_response_interval option which sets the Max Response Time/Maximum Response Delay for IGMP/MLD queries sent by the bridge. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_query_response_interval 13000 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 206cbdea10cb..0f6d8849843f 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -47,6 +47,7 @@ static void usage(void) " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" " [ mcast_querier_interval QUERIER_INTERVAL ]\n" " [ mcast_query_interval QUERY_INTERVAL ]\n" + " [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -474,6 +475,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr64(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL, val64); + } else if (strcmp(*argv, "mcast_query_response_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_query_response_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -858,6 +867,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_query_interval %llu ", rta_getattr_u64(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL]; + print_lluint(PRINT_ANY, "mcast_query_response_interval", + "mcast_query_response_interval %llu ", + rta_getattr_u64(vattr)); + } print_nl(); close_json_object(); } diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index cb1170f8d5c9..e9cd5f9f4fe6 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -175,7 +175,9 @@ bridge \- show / manipulate bridge addresses and devices .B mcast_querier_interval .IR QUERIER_INTERVAL " ] [ " .B mcast_query_interval -.IR QUERY_INTERVAL " ]" +.IR QUERY_INTERVAL " ] [ " +.B mcast_query_response_interval +.IR QUERY_RESPONSE_INTERVAL " ]" .ti -8 .BR "bridge vlan global" " [ " show " ] [ " @@ -988,6 +990,11 @@ was enabled). interval between queries sent by the bridge after the end of the startup phase. +.TP +.BI mcast_query_response_interval " QUERY_RESPONSE_INTERVAL " +set the Max Response Time/Maximum Response Delay for IGMP/MLD +queries sent by the bridge. + .SS bridge vlan global show - list global vlan options. This command displays the global VLAN options for each VLAN entry. From patchwork Thu Aug 26 13:05:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459755 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 73CD0C4320E for ; Thu, 26 Aug 2021 13:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59B6D60FDC for ; Thu, 26 Aug 2021 13:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242662AbhHZNKk (ORCPT ); Thu, 26 Aug 2021 09:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242595AbhHZNKX (ORCPT ); Thu, 26 Aug 2021 09:10:23 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525B9C061292 for ; Thu, 26 Aug 2021 06:09:34 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id ia27so6132421ejc.10 for ; Thu, 26 Aug 2021 06:09:34 -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=ClaN8lopGILywhWB4yU24sYj1z57kxETA0aK5OrHPjg=; b=TRbiwVG4zwmwJEBhgE3wYwAeNHMe7dsnBr2AMlF2y1eC24diV1tbwoEv9P8Q7qv1tZ wHclSAYX05D6+JZFPS1AeAmMzyFTE3Ycz0InKp9NTko4DQnwzz2gQCqOG+lnRSLbIXAs DD5bzV34mj+KWxBwChS25nP4cyYEV+PXb/xULu6BRVPGDe0FLbQ66euMOQ9Yg9mJqE0e B8a6L+bcOSfVZtuDEonmbw5/C+JDOjn2dDTAQd8eChrCiSAQCzW/dn0Qe5HDYxS+M1+B ONtOQCUYbNhxNr5njPIin69Cdp/TNtpvBB8gIhVPox3woqpNIzSD6ZWswaJaZ6l+fw2g t4cQ== 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=ClaN8lopGILywhWB4yU24sYj1z57kxETA0aK5OrHPjg=; b=jDDZ8R9o2dxD/gcPVESKlPYqEaVFXsd2eQOrvj1A2oTPILG+9+yzb4bd7cZ15qisNU dZYdSjhKW9IXjMHnIZSYDUdeUsCUw6VAHetKVN2e9EtVWqMq9f889svdVRNNkpTJBOBx bLpNN6TeJ1uk/ZpwO/qcpQP8m8jyV/1dRrxE2+EYIZw9qVBSR4LbHNDi3GFXklWjgvpy 9aShp6ldI55/i5u9b18FDBVlAXiqFpgOyjLigmvST3eOovJvI9R4lXQQD8NwYQvLItD1 GmlNOE8eYDG5XXt61SN1M9NLja9DFfkM6AkczTxShKadQuDNqYxvP+teadugnyDtRKE0 Og5A== X-Gm-Message-State: AOAM531suY96tntkocFKzEap1U0PAmXEmH+XA+eBWQtyvyPFbKQD0yGp RYcxvZHNDimhaRT45ZIM+7ITeaNVMMHsfiai X-Google-Smtp-Source: ABdhPJwwWBVMVJETKl5QvnJNuM8Rw+Gap92Oa3VNgSHxZxBJ7cS/aHZDVBXvWyyvmARxjU8C5fm0bg== X-Received: by 2002:a17:906:a0c:: with SMTP id w12mr4144124ejf.376.1629983372642; Thu, 26 Aug 2021 06:09:32 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:32 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 15/17] bridge: vlan: add global mcast_startup_query_interval option Date: Thu, 26 Aug 2021 16:05:31 +0300 Message-Id: <20210826130533.149111-16-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_startup_query_interval option which controls the interval between queries in the startup phase. To be consistent with the same bridge-wide option the value is reported with USER_HZ granularity and the same granularity is expected when setting it. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_startup_query_interval 15000 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 15 +++++++++++++++ man/man8/bridge.8 | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/bridge/vlan.c b/bridge/vlan.c index 0f6d8849843f..6bd9feebba72 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -44,6 +44,7 @@ static void usage(void) " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" + " [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n" " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" " [ mcast_querier_interval QUERIER_INTERVAL ]\n" " [ mcast_query_interval QUERY_INTERVAL ]\n" @@ -483,6 +484,14 @@ static int vlan_global_option_set(int argc, char **argv) addattr64(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL, val64); + } else if (strcmp(*argv, "mcast_startup_query_interval") == 0) { + NEXT_ARG(); + if (get_u64(&val64, *argv, 0)) + invarg("invalid mcast_startup_query_interval", + *argv); + addattr64(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL, + val64); } else { if (matches(*argv, "help") == 0) NEXT_ARG(); @@ -849,6 +858,12 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) "mcast_startup_query_count %u ", rta_getattr_u32(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL]; + print_lluint(PRINT_ANY, "mcast_startup_query_interval", + "mcast_startup_query_interval %llu ", + rta_getattr_u64(vattr)); + } if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL]) { vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL]; print_lluint(PRINT_ANY, "mcast_membership_interval", diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index e9cd5f9f4fe6..eeceb309d219 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -170,6 +170,8 @@ bridge \- show / manipulate bridge addresses and devices .IR LAST_MEMBER_INTERVAL " ] [ " .B mcast_startup_query_count .IR STARTUP_QUERY_COUNT " ] [ " +.B mcast_startup_query_interval +.IR STARTUP_QUERY_INTERVAL " ] [ " .B mcast_membership_interval .IR MEMBERSHIP_INTERVAL " ] [ " .B mcast_querier_interval @@ -972,6 +974,10 @@ after a "leave" message is received. .BI mcast_startup_query_count " STARTUP_QUERY_COUNT " set the number of queries to send during startup phase. Default is 2. +.TP +.BI mcast_startup_query_interval " STARTUP_QUERY_INTERVAL " +interval between queries in the startup phase. + .TP .BI mcast_membership_interval " MEMBERSHIP_INTERVAL " delay after which the bridge will leave a group, From patchwork Thu Aug 26 13:05:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459753 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9ABBDC432BE for ; Thu, 26 Aug 2021 13:09:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80FB160EAF for ; Thu, 26 Aug 2021 13:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242654AbhHZNKj (ORCPT ); Thu, 26 Aug 2021 09:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242601AbhHZNKX (ORCPT ); Thu, 26 Aug 2021 09:10:23 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D865C06129D for ; Thu, 26 Aug 2021 06:09:35 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id h9so6182233ejs.4 for ; Thu, 26 Aug 2021 06:09:35 -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=u5XtiFItYdd7uR4ZlYXGn1qUQ0JotICTN4TUEvviF2s=; b=IgF6W6QLXuOwckUyGavEwCxC6zp0505s+Pvt2ABYTuvRpKOKxgujp65Kyfd/6N404Q GRiN/JKOeZrO7QN0w1JxiAg8JJbLqRrVyfZPjA/c2xI7AR0M/J1L3AazVdtrNWbSExgt 4nenEUe92TgWjqdho3cC57SU84dHnWFsA1Eq5X8qZkqdOrYD16WHfI/qFywX02AztpUo qb54Rac1ALJZXlopWRu1PMiwzVtL8LCFuV1iKJrAni6pp3AH5QeXHR82GUOkTBdRiRdf yFCdxGZZ7DiEw36eQ+KbtMlA04kcufFx6Ulv+tNIdMgocQ61vgKviL3RcbVs1yDb6BRS BYQg== 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=u5XtiFItYdd7uR4ZlYXGn1qUQ0JotICTN4TUEvviF2s=; b=X2R4vehJCnLQtZ9a/AImawXJGr+tGRI2luYyfs5mJ+QrIY7Q0yzL/QreiXgsLK3wFC X2k7SNFzfc1wJ5L1IfgxAmeSa622wVIOW8GvMwmSYJ9gvphEajSvYP+0YhmKK4h2KIS0 pRctv3NZlsy3WeQcliK66aa1ATHhosmUAoHU6wnt49t/sUbZPhI5O5h9chXPtagy4pZV rKhxIYPUeglqqQxkdzKAlrSFR0toXuNplnqZ6zTBf9tHMMRe6An2BKysJ89iSaa5nmOq LHhFiAerRSZ3V769XrprDIH6pidDYyXb0iBCbhpei42hV1dEaSelH6+h7QLf7otH9Zdz JRtw== X-Gm-Message-State: AOAM530GS2IWGjSNauF/kHWK3d7/aivv7TCRa30DhRlFwKhZOLhZVsuS vjgDEhjjbL1Tuqsft3NaEEtqhyyAbBx+xpdl X-Google-Smtp-Source: ABdhPJz+H89VKOXD2+w3cfTX/X1rP5iQ3aHBr+L4Yrro0fugdx9BP8heQjSx0G6Dml6EQ37p/DKd4g== X-Received: by 2002:a17:906:a04f:: with SMTP id bg15mr4317384ejb.417.1629983373791; Thu, 26 Aug 2021 06:09:33 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:33 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 16/17] bridge: vlan: add global mcast_querier option Date: Thu, 26 Aug 2021 16:05:32 +0300 Message-Id: <20210826130533.149111-17-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add control and dump support for the global mcast_querier option which controls if the bridge will act as a multicast querier for that vlan. Syntax: $ bridge vlan global set dev bridge vid 1 mcast_querier 1 Signed-off-by: Nikolay Aleksandrov --- bridge/vlan.c | 12 ++++++++++++ man/man8/bridge.8 | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/bridge/vlan.c b/bridge/vlan.c index 6bd9feebba72..acc6a2e4b885 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -39,6 +39,7 @@ static void usage(void) " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan { tunnelshow } [ dev DEV ] [ vid VLAN_ID ]\n" " bridge vlan global { set } vid VLAN_ID dev DEV [ mcast_snooping MULTICAST_SNOOPING ]\n" + " [ mcast_querier MULTICAST_QUERIER ]\n" " [ mcast_igmp_version IGMP_VERSION ]\n" " [ mcast_mld_version MLD_VERSION ]\n" " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" @@ -417,6 +418,12 @@ static int vlan_global_option_set(int argc, char **argv) invarg("invalid mcast_snooping", *argv); addattr8(&req.n, 1024, BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING, val8); + } else if (strcmp(*argv, "mcast_querier") == 0) { + NEXT_ARG(); + if (get_u8(&val8, *argv, 0)) + invarg("invalid mcast_querier", *argv); + addattr8(&req.n, 1024, + BRIDGE_VLANDB_GOPTS_MCAST_QUERIER, val8); } else if (strcmp(*argv, "mcast_igmp_version") == 0) { NEXT_ARG(); if (get_u8(&val8, *argv, 0)) @@ -830,6 +837,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) print_uint(PRINT_ANY, "mcast_snooping", "mcast_snooping %u ", rta_getattr_u8(vattr)); } + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER]) { + vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_QUERIER]; + print_uint(PRINT_ANY, "mcast_querier", "mcast_querier %u ", + rta_getattr_u8(vattr)); + } if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]) { vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION]; print_uint(PRINT_ANY, "mcast_igmp_version", diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index eeceb309d219..76d2fa09d5bc 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -160,6 +160,8 @@ bridge \- show / manipulate bridge addresses and devices .IR VID " [ " .B mcast_snooping .IR MULTICAST_SNOOPING " ] [ " +.B mcast_querier +.IR MULTICAST_QUERIER " ] [ " .B mcast_igmp_version .IR IGMP_VERSION " ] [ " .B mcast_mld_version @@ -951,6 +953,14 @@ turn multicast snooping for VLAN entry with VLAN ID on or off .RI ( MULTICAST_SNOOPING " == 0). Default is on. " +.TP +.BI mcast_querier " MULTICAST_QUERIER " +enable +.RI ( MULTICAST_QUERIER " > 0) " +or disable +.RI ( MULTICAST_QUERIER " == 0) " +IGMP/MLD querier, ie sending of multicast queries by the bridge. Default is disabled. + .TP .BI mcast_igmp_version " IGMP_VERSION " set the IGMP version. Default is 2. From patchwork Thu Aug 26 13:05:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 12459757 X-Patchwork-Delegate: dsahern@gmail.com 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 3284EC432BE for ; Thu, 26 Aug 2021 13:09:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15C5C60FDC for ; Thu, 26 Aug 2021 13:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242676AbhHZNKm (ORCPT ); Thu, 26 Aug 2021 09:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242551AbhHZNKZ (ORCPT ); Thu, 26 Aug 2021 09:10:25 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08435C0612A3 for ; Thu, 26 Aug 2021 06:09:37 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id i6so4618803edu.1 for ; Thu, 26 Aug 2021 06:09:36 -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=8N2re8clnk6JqvcltxkYZ1Njjnm96fT4O114rkbfUCI=; b=x2wwmhvDkCOm3UFyFK9vA5skA6QteKFYcUrOxixAS/adBP2tg4QXWpSRjnzn9ac5dc olArXFRinmalyP4EUzz6rEfAf7e75ddae1ejKGIxTxkBZlBNStW907wa59YVsUxlB6Om G81+s6pMv3kzvdjekyzIykUW4tE0oVaLsuf0z20zDMuZvHFrmZ4EWcYiv3ECjxvb6kRS gtJajiwljSLXKlWzu2FnTR0EBXiE9HWj11S3GPefnJ423VT9qcMcXwsaBzCGHPIruv+T 1jLI+ESzWVDvPf5h4pkEV50aununLG2f+CA7eH8MWM6bz26QyWiiKppEz8ll2y61GKa7 znkA== 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=8N2re8clnk6JqvcltxkYZ1Njjnm96fT4O114rkbfUCI=; b=ZuW5CG2/fTjyNiUdobDsrFQ5U8+HLqJ6tePVFYp6TS3iXZjzIgieC/T9zccAF7WOqk /RRIr8VXr+pKQkumKwkVqJ2eOF71nzeQhj7tj9N+BNtfwwOxyOVQOqBqHUkFHdsO7AFk S7VNiVUnBeuQMfpnBMzY5il3yJLGdwjRXndw0T+wU3rUbhJKwcmRqZ5UKrdSNX3nDVqT RTuEEtzynqSY5lD3cxq7cVo2NuObPo0+j3X7NIxVnTcisCZuA7bAmtASrYZl8tROZSA2 /hkNDMNPmUF6mGlGK4ZlMY8N1cN03Z8ESYVDXcvzmq0dAX5voXVbSZbU9/aEpq/HGSsy lw6Q== X-Gm-Message-State: AOAM531Ge6ctuhSSX16sL+40sAOquxe3XASGYKVigvFc+wxT0KKkkHKJ 2FFBFfUK140hrE8aIDXmoKbYlWCj1UxRhqu8 X-Google-Smtp-Source: ABdhPJzHmvvg6tV3ANp0q8erZoeZ3ibb96Qx675vJ1qYOcsUmuWyzT+CjleIlcTwHVhO092oiJBlyA== X-Received: by 2002:a05:6402:5212:: with SMTP id s18mr4176778edd.160.1629983375357; Thu, 26 Aug 2021 06:09:35 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id bl16sm1378303ejb.37.2021.08.26.06.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 06:09:34 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, Joachim Wiberg , dsahern@gmail.com, Nikolay Aleksandrov Subject: [PATCH iproute2-next 17/17] bridge: vlan: add support for dumping router ports Date: Thu, 26 Aug 2021 16:05:33 +0300 Message-Id: <20210826130533.149111-18-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826130533.149111-1-razor@blackwall.org> References: <20210826130533.149111-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Nikolay Aleksandrov Add dump support for vlan multicast router ports and their details if requested. If details are requested we print 1 entry per line, otherwise we print all router ports on a single line similar to how mdb prints them. Looks like: $ bridge vlan global show vid 100 port vlan-id bridge 100 mcast_snooping 1 mcast_querier 0 mcast_igmp_version 2 mcast_mld_version 1 mcast_last_member_count 2 mcast_last_member_interval 100 mcast_startup_query_count 2 mcast_startup_query_interval 3125 mcast_membership_interval 26000 mcast_querier_interval 25500 mcast_query_interval 12500 mcast_query_response_interval 1000 router ports: ens20 ens16 Looks like (with -s): $ bridge -s vlan global show vid 100 port vlan-id bridge 100 mcast_snooping 1 mcast_querier 0 mcast_igmp_version 2 mcast_mld_version 1 mcast_last_member_count 2 mcast_last_member_interval 100 mcast_startup_query_count 2 mcast_startup_query_interval 3125 mcast_membership_interval 26000 mcast_querier_interval 25500 mcast_query_interval 12500 mcast_query_response_interval 1000 router ports: ens20 187.57 temp ens16 118.27 temp Signed-off-by: Nikolay Aleksandrov --- bridge/br_common.h | 1 + bridge/mdb.c | 6 +++--- bridge/vlan.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/bridge/br_common.h b/bridge/br_common.h index 09f42c814918..610e83f65603 100644 --- a/bridge/br_common.h +++ b/bridge/br_common.h @@ -14,6 +14,7 @@ void print_stp_state(__u8 state); int parse_stp_state(const char *arg); int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor, bool global_only); +void br_print_router_port_stats(struct rtattr *pattr); int do_fdb(int argc, char **argv); int do_mdb(int argc, char **argv); diff --git a/bridge/mdb.c b/bridge/mdb.c index b427d878677f..7b5863d31c46 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -59,7 +59,7 @@ static const char *format_timer(__u32 ticks, int align) return tbuf; } -static void __print_router_port_stats(FILE *f, struct rtattr *pattr) +void br_print_router_port_stats(struct rtattr *pattr) { struct rtattr *tb[MDBA_ROUTER_PATTR_MAX + 1]; @@ -101,13 +101,13 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr, print_string(PRINT_JSON, "port", NULL, port_ifname); if (show_stats) - __print_router_port_stats(f, i); + br_print_router_port_stats(i); close_json_object(); } else if (show_stats) { fprintf(f, "router ports on %s: %s", brifname, port_ifname); - __print_router_port_stats(f, i); + br_print_router_port_stats(i); fprintf(f, "\n"); } else { fprintf(f, "%s ", port_ifname); diff --git a/bridge/vlan.c b/bridge/vlan.c index acc6a2e4b885..40e2c4f7b50c 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -802,6 +802,36 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) return 0; } +static void print_vlan_router_ports(struct rtattr *rattr) +{ + int rem = RTA_PAYLOAD(rattr); + struct rtattr *i; + + print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); + open_json_array(PRINT_ANY, is_json_context() ? "router_ports" : + "router ports: "); + for (i = RTA_DATA(rattr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { + uint32_t *port_ifindex = RTA_DATA(i); + const char *port_ifname = ll_index_to_name(*port_ifindex); + + open_json_object(NULL); + if (show_stats && i != RTA_DATA(rattr)) { + print_nl(); + /* start: IFNAMSIZ + 4 + strlen("router ports: ") */ + print_string(PRINT_FP, NULL, + "%-" __stringify(IFNAMSIZ) "s " + " ", + ""); + } + print_string(PRINT_ANY, "port", "%s ", port_ifname); + if (show_stats) + br_print_router_port_stats(i); + close_json_object(); + } + close_json_array(PRINT_JSON, NULL); + print_nl(); +} + static void print_vlan_global_opts(struct rtattr *a, int ifindex) { struct rtattr *vtb[BRIDGE_VLANDB_GOPTS_MAX + 1], *vattr; @@ -901,6 +931,10 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex) rta_getattr_u64(vattr)); } print_nl(); + if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]) { + vattr = RTA_DATA(vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]); + print_vlan_router_ports(vattr); + } close_json_object(); }