From patchwork Sat Aug 28 11:07:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504268 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 3DA2AC432BE for ; Sat, 28 Aug 2021 11:08:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AD32601FD for ; Sat, 28 Aug 2021 11:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbhH1LJL (ORCPT ); Sat, 28 Aug 2021 07:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233892AbhH1LJH (ORCPT ); Sat, 28 Aug 2021 07:09:07 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4700FC061756 for ; Sat, 28 Aug 2021 04:08:17 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id g22so13808231edy.12 for ; Sat, 28 Aug 2021 04:08:17 -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=m6Wtwp06wnIGyXDtLEeUAXt85Va4XDGQcRgeFp4+iTo=; b=a6jVOcawf5lYUAYxukEO+ZMEf5agxdZ/Z5DPLeoCo8EkqLCogfr4YclWHlf8pwuqS4 d2AQwIPYglRjF24OAXFdN02io9R7Culkj28xRUqnU8RlLLuKHKxA4YNJ2MsXggYOxKqX vYFyqKhc/ghR47EjkO5LQEz5VT31qjFCywudrK8gr6nba5woOQIfci6NbrZm7xg4yYIE SyUIgyvD2395hYnoSuKRJNsx/KvwmS0/mjgORlLLOwJOeUx8rbi9G8q1wlkhfJDgo/TG nMu/9oSYMo2bbpZ8Cyodrw8x/kN5cztmu7RqcaeTVfGsS0MmU1EZJ4ByV+XyCY4OwED2 k+Rw== 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=m6Wtwp06wnIGyXDtLEeUAXt85Va4XDGQcRgeFp4+iTo=; b=BHtnS56WwJlHHYdVurkvja001o8mL+S4ZtMl3Xh4n+NBo2Mw+N4EruNmL0xRicJCcz t998blbX25NDuywySyd+hRCCq+IeRpiWkytKJw+h7BcQf1XTJBCBYFylAK9qWeT1ok1r GOtvOqDBwOmO0veBXqpB8wMfTAYIhcWq4E4ayedg/FNfJiEhuJ9AVpbmv/v0tnc9cjwU 2JAmkxTCCkhqi2FAj1lCAxo49QHvOkMD0DnwhdPgvOLUMQeq1onkAPrIC3Acm2MnHsEc trPNEJeqVPpVRD92bQcd9EnRqWAgvWctduGJ1Dxoq6zTjAySra3AIAv4+C6nl2NsaCe4 FoXA== X-Gm-Message-State: AOAM531snLjwDBUDYolYUqyL4yago7ZsZzC6rOdZ93GiverLomBvZpOa T3zpYAjaMDahKHV1YBFrXvN0dkA0TYF0ULb3 X-Google-Smtp-Source: ABdhPJzlLysyZyk7DUtNkJpDEG5k9e0wPaQnLKN0TO4hKy6YoVzpeBab9hCcGOCt+aAVfDHxumJtGQ== X-Received: by 2002:a05:6402:3d8:: with SMTP id t24mr13991883edw.214.1630148895519; Sat, 28 Aug 2021 04:08:15 -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 i19sm4710429edx.54.2021.08.28.04.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:15 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 01/19] ip: bridge: add support for mcast_vlan_snooping Date: Sat, 28 Aug 2021 14:07:47 +0300 Message-Id: <20210828110805.463429-2-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: use strcmp instead of matches for option name matching 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..c2e63f6e0fcf 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 (strcmp(*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 Sat Aug 28 11:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503968 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 2D9A5C4320A for ; Sat, 28 Aug 2021 11:08:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 113FA60E8B for ; Sat, 28 Aug 2021 11:08:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234006AbhH1LJX (ORCPT ); Sat, 28 Aug 2021 07:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233999AbhH1LJI (ORCPT ); Sat, 28 Aug 2021 07:09:08 -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 7ECB2C061756 for ; Sat, 28 Aug 2021 04:08:18 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id g21so13851820edw.4 for ; Sat, 28 Aug 2021 04:08: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=O6PU9BNFRciVQMe7iAxXKKxQJbsvApp/c24DcKGAh/A=; b=o2ZCgLqhw/x6qId4fUk38s17i6+GDldgZOQxE7KR5e/frKPnb73L7kSUH9FoSuCMvX oQexf8+xljSkTzsrskE1l0mykgtoTbs/SfYRBZCXMtuNVw44Gv31q4T1GVM09dnriFAg 4XddtKivRFRqwQTOD7yuHqqIHa0ZJjghS23OcK+OAku90Jj5CBPd55yHIocdmNjhAVZ/ Fiqv3oGNGHFtn3PkQru5MUtCcNsBRmW543qgX6yywh29+btVO/vhkDSdZeyT4XKo5Hrg vGA5vCjfStith8dLx1whn25Biq79yvBWvw8HK9xmRBrcRxfs0fbmKDF5nqzcfzBGu/iK jGNw== 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=O6PU9BNFRciVQMe7iAxXKKxQJbsvApp/c24DcKGAh/A=; b=ZsrmyeV5U7lMqkAEFsKkyHy1QQJxxBUwG4cF26sh+EbeMTe7vDbTkRgB35eL8zQFKi rfy1tGGCBbmjOkdMJAIXHWeiPsgQqG0zPnK0fw2ULecuyWtjdNVdASBvdCSORiBNF2nH RNwvRY7gTZiwhHRdjx0HYPWAt8exC1bYGgDbqzB69SEAWDBqibrhuaAOxQzVhautexpP +eVHEDQc5tIVIzS5p/4LDT8X5G6QJtnusR3P9t3A2jyeREfQ6INcnYq11IJbfMAT3nSQ VA1i5LQ0smv8ZHBS5+YAIwicTyQH/KZ7FjsPWEP1XUFRBXde78IUWEEQ4UEJZ5bQMjpC ffvQ== X-Gm-Message-State: AOAM531NvUQ8q2BHnGDLdvqJ37MY9cAA/c9Z4mOZ/u3QWiULZFdYN+Tf EewI0CMKsvinl3kqC2n0d7t1grhVwx5ZYPOT X-Google-Smtp-Source: ABdhPJzw/1hRrzE6MbZVXvdut6I9YwPTlDnt0/ncLF14Ncsz6ziZF5b12itR8GMnHwXYqzR+CMU0fA== X-Received: by 2002:a05:6402:1248:: with SMTP id l8mr14332457edw.94.1630148896722; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:16 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 02/19] bridge: vlan: factor out vlan option printing Date: Sat, 28 Aug 2021 14:07:48 +0300 Message-Id: <20210828110805.463429-3-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Factor out the code which prints current per-vlan options from print_vlan_rtm without any changes, later we'll filter based on the vlan attribute and add support for global vlan option printing. Signed-off-by: Nikolay Aleksandrov --- v2: new patch (split off of previous patch 02) bridge/vlan.c | 110 ++++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 52 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 9b6511f189ff..b9d928010cb4 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -621,11 +621,67 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) return 0; } +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; + + 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) { - 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 +716,6 @@ 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]); - - 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); - } - } if (vlan_rtm_cur_ifidx != bvm->ifindex) { open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN); open_json_object(NULL); @@ -711,14 +724,7 @@ 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); + print_vlan_opts(a); close_json_object(); } From patchwork Sat Aug 28 11:07:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503967 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 1F003C4320E for ; Sat, 28 Aug 2021 11:08:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0536660E77 for ; Sat, 28 Aug 2021 11:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234073AbhH1LJY (ORCPT ); Sat, 28 Aug 2021 07:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234012AbhH1LJK (ORCPT ); Sat, 28 Aug 2021 07:09:10 -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 BC89CC0613D9 for ; Sat, 28 Aug 2021 04:08:19 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id u3so19573512ejz.1 for ; Sat, 28 Aug 2021 04:08: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=6CJLUELi4OYj8pc2y744ciouGC/ra4+49LNOIX5UUXM=; b=sbNWVsNJ+YaS4T0yaefxWuu4retgIMzDFRNekCH/8wEJXAHA+dZfrBrAmLtojzWBCm XVg65rVq5tnKh0nphr//tVZI53ZP5xOIrGd1YbDBb6iqYaNWARI9QeXZCRYWv+rGdOCQ VyWpd0bVWEuRWIZhxNPr2dciPXjmrqZPgjzRf/FEEp2M/aeHc46llA0a16Gfo9AHrH1m XthlFXyBzG5pijY/NvY6B9C9FE89Gz5mnHdZgPmZUh/AgZniFZ9pUV1CFPSJY/LlQbr6 UAMCC60eVc0c+J8fs5BwBcE68BgqChPGSmwyb3eHxNxHy9PQJLcNBNO1QTym3xPkqKVM 6ruw== 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=6CJLUELi4OYj8pc2y744ciouGC/ra4+49LNOIX5UUXM=; b=G6x/zHEBntXG70joyGObn1B/fHbjzZiPP9Qg183HJiJR6Nlv52FWWAQNqi5GU+B+Wf oMAzwKg3lDQrFhCHOsReVacsPXPbTa60XBP9dMTzrSRZhJYjAwBhu+lusIlkdB7gzi71 RISxRygTT0xIjn+bebWaKUExcyuJ41+FDwOhuru3WKMcr54+OmMRrn8SJF/6xgr5kwZ1 mEEPXs5CDG5vmBcZUrKSHFZC5O9Cs+E2cL6zENuSmmjDVQ1QWSWZLkOXBbKqctdlQjl9 Q1WVGRyvTZ/usw/1ZrYr2v9CIxowh3EQIH0zLovApNn2W92sFXJfhOA1W9CJjm7KTobs ZT7w== X-Gm-Message-State: AOAM531CcuA0z29JHmWGpCJvU+sC460++7Cleqc2JPb2Lx6A9huTgDAg LnAkCN959GJKe8w0uL6WNGVKB+vOEIkzmik2 X-Google-Smtp-Source: ABdhPJx5G5VHqRyETDgS0gpTvBVQgmWP+4MZ+F7DQvLHj32a7XU7fkw87ftdgL33g+F0O4Iq47m4Tw== X-Received: by 2002:a17:906:d541:: with SMTP id cr1mr14609014ejc.81.1630148898057; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:17 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 03/19] bridge: vlan: skip unknown attributes when printing options Date: Sat, 28 Aug 2021 14:07:49 +0300 Message-Id: <20210828110805.463429-4-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov Skip unknown attributes when printing vlan options in print_vlan_rtm. Make sure print_vlan_opts doesn't accept attributes it doesn't understand. Currently we print only one type, later global vlan options support will be added. Signed-off-by: Nikolay Aleksandrov --- v2: new patch, split off of previous patch 02 bridge/vlan.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index b9d928010cb4..7e4254283373 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -629,6 +629,9 @@ static void print_vlan_opts(struct rtattr *a) __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]); @@ -716,6 +719,12 @@ 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)) { + unsigned short rta_type = a->rta_type & NLA_TYPE_MASK; + + /* skip unknown attributes */ + if (rta_type > BRIDGE_VLANDB_MAX) + continue; + if (vlan_rtm_cur_ifidx != bvm->ifindex) { open_vlan_port(bvm->ifindex, VLAN_SHOW_VLAN); open_json_object(NULL); @@ -724,7 +733,11 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) open_json_object(NULL); print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", ""); } - print_vlan_opts(a); + switch (rta_type) { + case BRIDGE_VLANDB_ENTRY: + print_vlan_opts(a); + break; + } close_json_object(); } From patchwork Sat Aug 28 11:07:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504266 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 1209FC4320A for ; Sat, 28 Aug 2021 11:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2A57601FD for ; Sat, 28 Aug 2021 11:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbhH1LJa (ORCPT ); Sat, 28 Aug 2021 07:09:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234020AbhH1LJM (ORCPT ); Sat, 28 Aug 2021 07:09:12 -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 EE733C061756 for ; Sat, 28 Aug 2021 04:08:20 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id bt14so19702252ejb.3 for ; Sat, 28 Aug 2021 04:08: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=DD7LcPhr/pr5PsIEFmZ+1SXoj1kQBxj9xbFMpbeFkjI=; b=JH8bS1C3+Z9aP/wBRH9TwSlGJtnw5zJihP29xXzdSa492HV04LPqAxzoXoGXkjHsnR qjtG8QVnuIDLjTqBmNhE/Jbc8lbbgTF3USOkH7oF08dgc4stBYO/Kg71kF1X22n8fSmu fpO7IzxvaV1tycOFuLgprTZxHAe2duSVIDLldqGKP3mrXLj/tKFfH1pOrod/xY+3xKeH Y2604b9e5kj54gnKePTEtUVom7inZXMTDxeqfo9xRosqWwGQfjc/8Ydf8EudSpW2FsZT 8tYPBT7YOcnMBpCE2OAdwKzIV+myMJRpbbPHpE3pwcgprFCxIfxMn2pVz/jr0DY28HLs 1m9w== 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=DD7LcPhr/pr5PsIEFmZ+1SXoj1kQBxj9xbFMpbeFkjI=; b=pbhGu9iVH4AhTqgH95ucknI7csfJpyfoX1js2MGYgdUbvmLjMQ4BjIYYTJHYXTyHWh WgpgXdfY4ytA+w/v1wxzOKe9tB0KIREO/3faQj1310bH5qEGonpRut4F+XKXOnav9+yf 3ZNWogPVhLeVP/TEJJOlHWmKOcd5NGE+NKKizeeK3gIx6IF/UD6ftN42TT8QBCJeN0qR yGXNXsWhd7T1alvI3gmoX7FbS0QV0L8oDANxt44Dx4voVZhXOEngJ8ZLS3UO3KlhOCF3 2nBpNu650O0TXM7v73tvLrtUDoUliVYyq9gIWIZaqdq3qpUX3K1rAelh9ZoHPVqaZCYd 6PTw== X-Gm-Message-State: AOAM530l6loMczTqG2u7n5Xjqb05eUhsyfyBfxmdyDUFqnVuGWaVbc0f Z8io7LEgFUsfaRGbgHBB4LNkv6WhBNcJZbDm X-Google-Smtp-Source: ABdhPJw7/+v2nWyjyA0WlICSsfOazmA3+9k7Yaiim+idBho2XDrNgiPIekpITzI+SrXuZGR/r3zPDg== X-Received: by 2002:a17:906:3548:: with SMTP id s8mr15326407eja.185.1630148899065; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:18 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 04/19] bridge: vlan: add support to show global vlan options Date: Sat, 28 Aug 2021 14:07:50 +0300 Message-Id: <20210828110805.463429-5-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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". To do that we update print_vlan_rtm to recognize the global vlan options attribute and parse it properly. 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 --- v2: previously this was patch 02 which is now split in 02-04 use strcmp instead of matches bridge/br_common.h | 3 +- bridge/monitor.c | 2 +- bridge/vlan.c | 110 +++++++++++++++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 21 +++++++++ 4 files changed, 130 insertions(+), 6 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 7e4254283373..8a2cc306cb07 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,6 +622,25 @@ static int print_vlan_stats(struct nlmsghdr *n, void *arg) return 0; } +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]; @@ -680,7 +700,7 @@ static void print_vlan_opts(struct rtattr *a) __print_one_vlan_stats(&vstats); } -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) { struct br_vlan_msg *bvm = NLMSG_DATA(n); int len = n->nlmsg_len; @@ -722,7 +742,8 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) unsigned short rta_type = a->rta_type & NLA_TYPE_MASK; /* skip unknown attributes */ - if (rta_type > BRIDGE_VLANDB_MAX) + if (rta_type > BRIDGE_VLANDB_MAX || + (global_only && rta_type != BRIDGE_VLANDB_GLOBAL_OPTIONS)) continue; if (vlan_rtm_cur_ifidx != bvm->ifindex) { @@ -737,6 +758,9 @@ int print_vlan_rtm(struct nlmsghdr *n, void *arg, bool monitor) case BRIDGE_VLANDB_ENTRY: print_vlan_opts(a); break; + case BRIDGE_VLANDB_GLOBAL_OPTIONS: + print_vlan_global_opts(a); + break; } close_json_object(); } @@ -746,7 +770,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) @@ -864,6 +893,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; @@ -908,6 +992,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 (strcmp(*argv, "show") == 0 || + strcmp(*argv, "lst") == 0 || + strcmp(*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); @@ -926,6 +1026,8 @@ int do_vlan(int argc, char **argv) } if (matches(*argv, "set") == 0) return vlan_option_set(argc-1, argv+1); + if (strcmp(*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 Sat Aug 28 11:07:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503966 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 8DEC4C432BE for ; Sat, 28 Aug 2021 11:08:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71C9460E8B for ; Sat, 28 Aug 2021 11:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234111AbhH1LJ2 (ORCPT ); Sat, 28 Aug 2021 07:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234027AbhH1LJM (ORCPT ); Sat, 28 Aug 2021 07:09:12 -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 EB38FC0613D9 for ; Sat, 28 Aug 2021 04:08:21 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id b7so13861651edu.3 for ; Sat, 28 Aug 2021 04:08: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=uvcpjl3RMdixDibCiplQ5MzSh09Qn5UHrWTxz2yOydw=; b=ArHx3d0DVnuPcO6SxxiDIkZ9rv8sNpC6l1aaT3IBZFE31LtSKQR4VC6yLBQzAeOEpA mUu+puZG12lkrmMsrBVrAx5zOK7a8rOHSYAzJiKJONgmFn+aYiYwEWf9NZGq/aJQIA6+ 9sbWstGrcvthgbvxRKReku+6TWj6hDVJZ5ZLmoK5DFoScGcN1gD760kDaZYmdc56rxKF LxOpftykcI7MHJmNdPMzs5YlbOL0Ztxzl3CJQx+0whOHrKf5kcsDbGPUYb9R8Y1bdf+H smx+/WbBrImRnS1SW9ihmTdtm0IY/oT0D5Q9Y4HH4vr08dFLfrpbFex8v5tuEc42t5FU pKLA== 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=uvcpjl3RMdixDibCiplQ5MzSh09Qn5UHrWTxz2yOydw=; b=YMv7S1BzZVyb+bzuBahZfLMo2CEYV9qNM9gfXcIVdCS1YcBFTD4WBo6hvgbqUUBgBA ssvZ2UQqqnRfL2i1/5LJqD6fnS/kQ9CxJ25StodJOulffHVrWMQrwbcxSG+lHZ1RSayE fJQcVaEjeV/AfV4TMMRRCHIgQ4Bgcfv06fsoE/v+KWU3RljCIyXTmNs2JQUIxqQPERni ix2HFTL/VwduuGbYhCLFxdClwFLokUov9kG2doVM6B3YxY7ryOAwQYSHjZqAii8mEV0g 5Q+z/1oizh5HqhfzbUOGL8MIcXxtAimjFiE7MOh+mIZxA4SNHuKxNcpHjhLSddBMbGpd HK2A== X-Gm-Message-State: AOAM531+Kl7zqZ99yE++mnAtLRN1n1tMFzwsyIFrmcc3lsD4ZZkFS7xD /sRi6rZ2EB1ZzBU6SucVV5AMpVG46a1SHsMa X-Google-Smtp-Source: ABdhPJwZQOZpv8wjW0wqzbrjeYjyESSqLLNbVdu2RwdFQgiyH67HB9v/czYzdlVT5T5YIs+uCwCrIw== X-Received: by 2002:a50:c905:: with SMTP id o5mr14655908edh.250.1630148900252; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:19 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 05/19] bridge: vlan: add support for vlan filtering when dumping options Date: Sat, 28 Aug 2021 14:07:51 +0300 Message-Id: <20210828110805.463429-6-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 424fe8371733..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,23 +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 Sat Aug 28 11:07:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504267 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 05E28C432BE for ; Sat, 28 Aug 2021 11:08:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEDB3601FD for ; Sat, 28 Aug 2021 11:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234092AbhH1LJ0 (ORCPT ); Sat, 28 Aug 2021 07:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234033AbhH1LJN (ORCPT ); Sat, 28 Aug 2021 07:09:13 -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 3C4A2C061796 for ; Sat, 28 Aug 2021 04:08:23 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id lc21so19673398ejc.7 for ; Sat, 28 Aug 2021 04:08: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=6+/dH1RUzHQbYPGZADuO/5z2krp3b1Uxq6uqezknPhM=; b=K/WvTp4B/oshlUrro67kKihnB8DoHGHZ+fxjgC4aS52lnebWpdMSZJonA8wDW257Tt 5AjOYYQkNeZYKhuHuhjTKINhTdNvCFWB5Asc3FIO2UsVUEnZX2Ap6u5fwK9l1oZmIjet dKF10/vSUBO9RKY4j1msNKgm/QnVvMS9856q0SsmIqSXdC997xp45hDUZ473mh+L6CYz 64ClVa15BHYpEuXVC4fiUOUrFZPYWiOjYb+dfWzOL8m8mwu7TPxUKFsvKrhKHF2ySdLo N2peHAA3zS8hYXSZZb9SPnQ5w3FuYlePly/CHPT6f26JzYYSCqA4tHhIuaN6mqnuEdES ikhg== 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=6+/dH1RUzHQbYPGZADuO/5z2krp3b1Uxq6uqezknPhM=; b=rDIEsSWc4OACRDRnT0kQ0Sk4AnfK03jbzIyaCrjnoX0sA/KQ6gNjex9zYyWeOCU7ET zqqIU8y0fK3b03MzZ/FPUQ96ytrGtYSoTHQERjvoImCHwIzfUURNKADX3gKSudMWjijO VOXeFnYYhL6x0NBDWf4/d/GV3Es7snYtRIRJnge7blg56e+P7MFY/8UDnFk7dgEZyJ9v WIpsegKArykXtDyX5RFUkgHo+Pv0pc0bcll/b0lNq+s0Me+KpXJhmxwNy+eI7vflK67H bX2P4WsJJn+ysJUWpX86gjxnoyzVWyHZlUxTSmsQ3TSL+QfjJ14m2B+JPZCuiF8keTkX loVQ== X-Gm-Message-State: AOAM532TJXki78wJ5Wi5rG2wvPT43Fu9qFyHJZOehayBCRkfWlNiOFWE aY6tugHizUa+XRu9JE5Na5BTATQrDfhol+uK X-Google-Smtp-Source: ABdhPJyr1XOCm7YnJZ9i7ioN7RCDyFSpWub4MT+cwtWqPaj7ZFC/b2axRWs+sYhyg9cGpYm/vrLgog== X-Received: by 2002:a17:907:266f:: with SMTP id ci15mr14710554ejc.509.1630148901224; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:20 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 06/19] bridge: vlan: add support to set global vlan options Date: Sat, 28 Aug 2021 14:07:52 +0300 Message-Id: <20210828110805.463429-7-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: use strcmp instead of matches 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 77db90d8a617..c9b445bc65aa 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 (strcmp(*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) strcmp(*argv, "lst") == 0 || strcmp(*argv, "list") == 0) return vlan_global_show(argc-1, argv+1); + else if (strcmp(*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 Sat Aug 28 11:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504263 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 500A2C432BE for ; Sat, 28 Aug 2021 11:08:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 328FF601FD for ; Sat, 28 Aug 2021 11:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234116AbhH1LJk (ORCPT ); Sat, 28 Aug 2021 07:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234039AbhH1LJO (ORCPT ); Sat, 28 Aug 2021 07:09:14 -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 ECFC3C06179A for ; Sat, 28 Aug 2021 04:08:23 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id z10so13827232edb.6 for ; Sat, 28 Aug 2021 04:08: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=ncMJODkts9053bN1DtpTCrMWkuDdLSmgLzTrOvQly80=; b=FDOtoCNr1+0OYgD7nY+n7b791pgPcdcBl3aZ1gvQy2odS35rzbrxNgvHug8S8wZZ9K 7EQPaMo9ckMtn+BsVg7C6tbpBHZOIhcZ/qccnOe9kENTvPc5ty+tzKcNsQBfYhyag1tH CDimlShAEsBF7RzRm6HzrNi02FjTxwI5u9gKvY3CcNFa2iqPsYte/z5W34QeEw9v12bp /MQfWN8lC+w7oB1GQUb23UVpXwa7zS1HLMncFCJBR8Xvf9f1D55sqK28m2o/oMNUMHfk XHk9GAVceMzL4J5gtONCy25wRrpXdttQTbc+JfGHTLwQe63sDR06zwCwbsgZQC32PiUX p+kw== 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=ncMJODkts9053bN1DtpTCrMWkuDdLSmgLzTrOvQly80=; b=siGYSRZplvOWI0Cz4h7ekUDS/cE2UKeaYaqYNCdJi4pKPamnfSbzHZObdg31GvR4WF 4b0Re205uniZjQ4eBSA8/bUaZcuTpqabf6ZmWgLwSzlOjhVR4JiaDRhPkCB9VxxnPUKe IbR0W5efVxik/0PnQw4W53XQBUqrPIRgqolm75rJZ7s3rNQ0QdlXKyr536vyBsiu6ML2 xQg4JcPOxnUshnKBExqzbXZORpldp20Ktu/SHDwsPZ3dsPngm2hFcY1wii32snnLoHAo RytBhyOXdsamo4bzOVrOc/19rNg6NUKkdiRhw9m2dSgK8DMcmZnAlT4QOriuTBpAa3Md Hazg== X-Gm-Message-State: AOAM533SDAaWj/udmE3KDYpNuXq3qwGY24A6Jv32/wzOJBWJqt0d66Lm iuFMEhv2Uc5DX8j6GUozeu0M4lure7SLBfJU X-Google-Smtp-Source: ABdhPJzYFijoM9YRKHBci1x7mhufMOsb6S9EavvPXCaQgHJTY6cQ09Ts3pYh2pQhIPVEeNzuD/t5VA== X-Received: by 2002:aa7:db82:: with SMTP id u2mr14880128edt.299.1630148902236; Sat, 28 Aug 2021 04:08:22 -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 i19sm4710429edx.54.2021.08.28.04.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:21 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 07/19] bridge: vlan: add global mcast_snooping option Date: Sat, 28 Aug 2021 14:07:53 +0300 Message-Id: <20210828110805.463429-8-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns bridge/vlan.c | 18 +++++++++++++++++- man/man8/bridge.8 | 11 ++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/bridge/vlan.c b/bridge/vlan.c index 34fba0a5bdfb..b1a8cfc4a362 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "json_print.h" #include "libnetlink.h" @@ -38,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\n" + " [ mcast_snooping MULTICAST_SNOOPING ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -355,6 +357,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 +400,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 +711,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 +738,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 Sat Aug 28 11:07:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503963 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 DE073C4320A for ; Sat, 28 Aug 2021 11:08:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEEA7601FD for ; Sat, 28 Aug 2021 11:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234174AbhH1LJj (ORCPT ); Sat, 28 Aug 2021 07:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbhH1LJP (ORCPT ); Sat, 28 Aug 2021 07:09:15 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 067F1C0617A8 for ; Sat, 28 Aug 2021 04:08:25 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id dm15so13824147edb.10 for ; Sat, 28 Aug 2021 04:08:24 -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=ZPvX4xvAYuHDrdy/StfRSGZZ9Dqb5yZIKAfBkMsrUAY=; b=gZwNv+qCQFcGEqFVRekbgU8htPKI7CHBURc4DAH1Qf1NWV/mGIsN5H6GLul7P3DjQg cDtzd7ioIOmDJpq0SG8fkm9U35M7C/kPGVtxIgI6A4Hp4Pt2IQKf7ayDPX9jsbtoMMVL ORxBCfS3Doe8xsndPyiNg3mSKDSVhpqdBfU5hMAOaU+hPizYFLMTOJpWftmg80IH3utf A63dShm4vjGS53Xua44K722OhH++8yLzIdumDkBdqIi7mSwwiyCzYDmXGS4Fx7hihoDP K+UO4JZ9KPLDd929aT4icvelUnu3VNMnQIIUW6b5/2HiUpg5BbnW6zBw4gos3UvI1Isq 8aMg== 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=ZPvX4xvAYuHDrdy/StfRSGZZ9Dqb5yZIKAfBkMsrUAY=; b=LmGEXdvGInQ87srJbvHTSb2n6wyQvx/xWQuPWNvT7JiJQxxd7NrckbVqt1tSVgUtw/ dVef87nTJ9mg+FWNXW1veqVPnTPqXjGtR5PLnV0OqT6RJ5Uia7ROI8HXlCtfRqbI5NF9 QaAfgyrZKeDvVWQhWfyHJLAOXmjne9iUL38s8dqSbV02rYB5aHkMV8hi4qJ9coK5gbhW f/VcRpVAU284mEK/njDqP4PcjT1rFdKBlQDLV3c8k2CCtToV3xMU3OiNgAYDb/xIoBwW IxGDVodq/lgUIKGkBS0k9dz+vqYfJW/O2g5PfQEfIWQpPtAYfPrw4hOkq1ByLzkUo8X8 Uhzw== X-Gm-Message-State: AOAM533ufoYcX6xOVUb4PQ2ofFyrg1AiUCHN89iGqFWt6PIcQabJSqEx dXlB1kEcV9D9Mn+MhWfc7uG/v0OJFEHcc+iI X-Google-Smtp-Source: ABdhPJxx1N5mtJl1WnOjB8/jkfVsXLYB12RiV/eh+zR9+hdomRAkKHKiC30FseszF6n/MVE3AA9QKg== X-Received: by 2002:a50:f0d5:: with SMTP id a21mr563661edm.244.1630148903255; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:22 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 08/19] bridge: vlan: add global mcast_igmp_version option Date: Sat, 28 Aug 2021 14:07:54 +0300 Message-Id: <20210828110805.463429-9-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 b1a8cfc4a362..5b97f4a167bd 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\n" " [ mcast_snooping MULTICAST_SNOOPING ]\n" + " [ mcast_igmp_version IGMP_VERSION ]\n" " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); exit(-1); } @@ -406,6 +407,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(); @@ -744,6 +751,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 Sat Aug 28 11:07:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503964 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 631F6C4320E for ; Sat, 28 Aug 2021 11:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4900D601FD for ; Sat, 28 Aug 2021 11:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234158AbhH1LJg (ORCPT ); Sat, 28 Aug 2021 07:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234046AbhH1LJQ (ORCPT ); Sat, 28 Aug 2021 07:09:16 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509CFC0617AD for ; Sat, 28 Aug 2021 04:08:26 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id z10so13827312edb.6 for ; Sat, 28 Aug 2021 04:08: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=y7EMagU7OglvRT33eUoDOX6tHTvsQYqQZDQ2olHJMiE=; b=Xf1bZ5JCF2HWo4Rt1CpPUQU6S9wbblLeb6a5wvhCCdg3lDchHjOS2KYeJV44YmmL+i GrIcSFo3SSJQ/Ul75brPz+goAJ0R1MwpSVRBPjoQui3IuFr2d4YLt5c0ia5LcyFyRkST nYtB1p5lb6jA0BWvC2zB4HVm28bIRPYm7tjKG+c1zu2lUA5tr5DjkDmmj6Ag7xYqmYq5 KClOMBWNfxEYUiLBsQdWjFwQz1bMKi03xIvyjJKIlQn4TsuCyRE3dKROEoc6RexPDeKa r38DAtIUyUZAHfN5vdEKxy2pvyx75zDf5fdo7/98gsBpqPls+tI/vZh0XKlY3+x18dJM FUXA== 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=y7EMagU7OglvRT33eUoDOX6tHTvsQYqQZDQ2olHJMiE=; b=hxrXH7gizXWgCMtd5Fh3C61yja/+5gieuOwNYCtW7MZFw4WKg2FllBIXWiQEhVHqAh A1niTbZ7S8kdFRHJlheC2Wpokbr9qJrP4Ji24ahn74quxoEA7wluBc+bDV+gGky3wyHf vhJyzknHtHtgvxKkJm9ATNCcM6FEvW5kmXhli7AdXXW3djoUg4W4dqXXOdP6wGLqwO4e aaHt4eB1U/vv5GUXgD3Gqmndu3yqxMhG35iMgT8lbKhD38ejdKET7jae5KKXNB5Y2e/x y/UMwlrskGk2Naup0Oncupjn7ReY8tWBgYQxR3AfgqIQxOAozKhyYadfLgBNbZaghwHh KrLQ== X-Gm-Message-State: AOAM531JEJw24qsp9og5xtvRcOJTbM8p26FkNXA20i7uJqMFtN9htZIv ezyNkC4bCZfIMGpbBNpXFGSff80+s3V2tPty X-Google-Smtp-Source: ABdhPJyqDuzzpIRnWxCjZg/X21PO8Nf7qj3CgHohEaxHYUi53mDBJl84vj+G6FdeCBIVmKNIoDyt8A== X-Received: by 2002:aa7:c4c3:: with SMTP id p3mr14388471edr.122.1630148904414; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:23 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 09/19] bridge: vlan: add global mcast_mld_version option Date: Sat, 28 Aug 2021 14:07:55 +0300 Message-Id: <20210828110805.463429-10-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 5b97f4a167bd..aa6fbef27b06 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\n" " [ 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); } @@ -413,6 +414,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(); @@ -756,6 +763,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 Sat Aug 28 11:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504264 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 CBD1BC432BE for ; Sat, 28 Aug 2021 11:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A727D601FD for ; Sat, 28 Aug 2021 11:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234106AbhH1LJi (ORCPT ); Sat, 28 Aug 2021 07:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbhH1LJR (ORCPT ); Sat, 28 Aug 2021 07:09:17 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA7DC0617AE for ; Sat, 28 Aug 2021 04:08:27 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id dm15so13824252edb.10 for ; Sat, 28 Aug 2021 04:08:27 -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=AmYqgX6IPfYoCbluzwDmXfORiaqNshXT81BLb8ZHCLc=; b=smrcBiGHSi2AIQeUCDivwsCZeEcAXyx6bLw4H7boBJKx3aVEO4Lnv09SpAycD7XDN0 vktYgjTZPP48InSxtNyrEzdi39PoO+aq6v7bNP/NCz7lyWoprJMeS8fCADTP0Y9XvAY+ xYq3q580EXwF4B9Ad+3InJ/pJUiiSNI/iF1z9UyYaHy4PdR1l60Drr8FmYtwNQGEAvn0 ZQji7WjBEQi+/Rl4AjNplbHi220oO6jneeu4EOJvE/plxu98qzJLGqAdxTpV9oYBhPED CX3E0B9/dgRLl4gbOkaWOQxbVhdPzrqgWvUz0Um7lRL/PoUspPp0nyPj7yX9yGXN7HN6 L6rg== 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=AmYqgX6IPfYoCbluzwDmXfORiaqNshXT81BLb8ZHCLc=; b=bSPqZXZjSYmDMH6bpA/3+BEprfz969Cq9ZHHGxXVaXGn8wqfosO8hyIibXOlVHtRs5 g+nGlZbowGAeK+B3MHPaUojgbQlQlD4vfDsoNyLpV7pxdcLvr7l9z5mSz32LIdJd7rhB NJ1mwygw0Sr8T7GGRcp4NsdXJ85u+zZrPSDMhH+fMKN7dyUyDqmE7GDZ/kbxhmqjAwdk k0zU5QCTG4k5kxQ4Wn6hjuk8YF7J8zIC/et6Qpu1MAHIOS7TwmIBy92qELGQcWuPdQRy 2HZV451MBJryu9LekpRxHalrGR5nI6tNt04xhGjWykJRJ0u2YmjqYF9I5cw/TpPvR/vq kw+w== X-Gm-Message-State: AOAM532b5FYhiHWj+dW4vJtrvnbqdL2hCfloavnH4yZKxCDQ+M6EYahr /MeV8WeWbVXC9xL7151Y7e2Uzx25YezZJqw8 X-Google-Smtp-Source: ABdhPJxDY1B9h+AvSTr2i86DCNOQgTsmNhY2ICl8+WY7qk54WydUFnexNjTVsayQNeJ1G8ui6daYLw== X-Received: by 2002:a50:c043:: with SMTP id u3mr1270185edd.207.1630148905573; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:25 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 10/19] bridge: vlan: add global mcast_last_member_count option Date: Sat, 28 Aug 2021 14:07:56 +0300 Message-Id: <20210828110805.463429-11-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 aa6fbef27b06..479574ca38e5 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -42,6 +42,7 @@ static void usage(void) " [ 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); } @@ -359,6 +360,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), @@ -420,6 +422,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(); @@ -768,6 +777,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 Sat Aug 28 11:07:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504265 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 3E104C432BE for ; Sat, 28 Aug 2021 11:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 217EF601FD for ; Sat, 28 Aug 2021 11:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234138AbhH1LJf (ORCPT ); Sat, 28 Aug 2021 07:09:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234067AbhH1LJT (ORCPT ); Sat, 28 Aug 2021 07:09:19 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 806E7C0612E7 for ; Sat, 28 Aug 2021 04:08:28 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id d6so13847318edt.7 for ; Sat, 28 Aug 2021 04:08: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=X0ZJ4kZ2XhcaybYsFDJ41WM5Pk0FLWYN3uprFlzMnb8=; b=rvIpoe2zF+o5k6so5oCkBEgVOj3AyqbUcNSDLtAtMzwkbW9VXLUVsUxJucq9CIko4n sF2eP6clfzFI7VOejUHILbX1nrkHoo3EtB29CZttkSuKzeRnsixaozeqmUjx0NDQhGAF Neq7XZfgTbySRnZcL/piIWyuYnDt1L//XUEa9W4aP0p8nBOLHi7/LvzWCPEVF1fc9cTg sgLMGCvLO5+U59Wg6u9K7RxlaUTJFHnMpmX/bMvBH70HdODQqSn1bAu5SbXQoTak9kyp 4PMVJRbuM7VFUglL79IuGMFRusVX37JHcqobTCB3awK8JO0ALeoaKZ+YH2Ql5gt1LxiQ zhYw== 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=X0ZJ4kZ2XhcaybYsFDJ41WM5Pk0FLWYN3uprFlzMnb8=; b=BLdmDxsmHxOP8wvQaFeFGBxvh5LpfzgXnIzmbF9Xwwud22qT2rHFlYqcPLruww3xYd e08IRVa+1E3wdBesCQ0XGc/yjtwT8bCNEKoAwPOXmqoZCt1J53K71V0U80Ig8UzHRKQ2 WyiIbmdRLqJ9r1tD8PoAwcYSXdi7g3WJwMvvOGl1Xajdm5EGZfgACCVHrkuA9LEtKEZW dVvjvHFUdlQ2UzWRHTs1ui8cxaWLOdhPRBgVhPO6TN0TZtZHuY8IkZpqbjIXU6ZEXzpx W045CpbodKjp+sWfvzfEScEY/CDl9vz4G68DlA1ZSq37xFysUpSm+DC5YyOxgT7WMakh f/8g== X-Gm-Message-State: AOAM530M+qana/vwcVzMFU5b7EtRny7thtX3dJEUI/bJN5jOwWM7wpOJ UHXW+DxhIfyDoR0av9HrAop7rD0NXNa9oXiQ X-Google-Smtp-Source: ABdhPJxQYtD2A32j7cyqQKfFCSTtrAvY6F9oxm8n7q/73CUwqknPHqoBS9LuqEfUSB4LY0FUxbByaQ== X-Received: by 2002:aa7:d2cb:: with SMTP id k11mr8455898edr.227.1630148906739; Sat, 28 Aug 2021 04:08:26 -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 i19sm4710429edx.54.2021.08.28.04.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:26 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 11/19] bridge: vlan: add global mcast_startup_query_count option Date: Sat, 28 Aug 2021 14:07:57 +0300 Message-Id: <20210828110805.463429-12-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 479574ca38e5..2c6ebedd2d5f 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -43,6 +43,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); } @@ -429,6 +430,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(); @@ -783,6 +792,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 Sat Aug 28 11:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503965 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 CA79BC4320E for ; Sat, 28 Aug 2021 11:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD581601FD for ; Sat, 28 Aug 2021 11:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234137AbhH1LJc (ORCPT ); Sat, 28 Aug 2021 07:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234069AbhH1LJU (ORCPT ); Sat, 28 Aug 2021 07:09:20 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5A5EC061756 for ; Sat, 28 Aug 2021 04:08:29 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id u14so19576886ejf.13 for ; Sat, 28 Aug 2021 04:08: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=RL0Ykyepjo0ReLcdadP3sSZUjYtB0kKQ6g5gVk7UV1c=; b=XVA+sW+P1RTP0l15Jm68Hdgi4K8ANUlk8npENFd+otgtgTv/5Q4PFPNK8DhGnwTuIN DtfziNH5HDBl9gZ3N5CcBXezuw7JNsVJe0+RCvCepZn1FLwxzUbzGXhSGWsFu0EiVwfY AcFXL/ulvFu2fgxnBXvv824cU1QrjCZvP/AEf+QDIg+jOl4UzR+CL3lzlZHpgEJL5pae g0TvK/VPV5rAqpjN9JI2v55F5iFP27B/mAz/cw2j8GwpxdlP2TBToObtIJQQF1c4ZCro f7rHmplvVwZ1eqzePkxOHMkedkUGPR/WGLECpoqFLZcm8QEPe/cnhzziag9OVOsBkKeB gqPg== 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=RL0Ykyepjo0ReLcdadP3sSZUjYtB0kKQ6g5gVk7UV1c=; b=sVfRYR6DXyrGFl6fYt1+0cm4fDLYBFEQfPvtAjvnbWen4ze0YEFWsFz/MZigo86lXw 1TuVuPdNJ7Od/KN1a+f9VnObrawi5dO85IZu1rdsVIX29Edw5Ceo4LVVgQh92qALbIm5 3uWFTTydMGcvIXk4j3cHk9wYAMFUZAGgtK7AXCgt+u/hJEpnl+fT4VA/ZW+dpt3OGFdb dLbHD1JmydbLXp6joXkzgAllwF4zAJlnxy+QJMUjEr+1hZpp68vNGkfuIczUsLOVeRwd YxHEfJkozTEhBLMJ6oBIuB9K97rL/YrGWaLPOl4RhZbJgQSQZhw5qCC8efj0kyFoEvtJ 5c/Q== X-Gm-Message-State: AOAM531LIVVM0ZF5qxdZH8zl6JmzGCZPR5MKzhhwJWtvXLGEWQWiNW3G AOua5iB29qUcrgpoMmwdkpo6gmXyeIMvXgSl X-Google-Smtp-Source: ABdhPJyoOpJhvIipupykJNdL50ob6z+Qbh5u5iJzwAOEwTiT72ZMAS8ZIrK+Oxg5gtdm6JxDhD/ZgA== X-Received: by 2002:a17:906:c054:: with SMTP id bm20mr14715597ejb.203.1630148907851; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:27 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 12/19] bridge: vlan: add global mcast_last_member_interval option Date: Sat, 28 Aug 2021 14:07:58 +0300 Message-Id: <20210828110805.463429-13-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 2c6ebedd2d5f..2a3dffdbac44 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -43,6 +43,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); @@ -361,6 +362,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; @@ -438,6 +440,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(); @@ -792,6 +802,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 Sat Aug 28 11:07:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503962 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 F3F1DC432BE for ; Sat, 28 Aug 2021 11:08:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBD7B601FD for ; Sat, 28 Aug 2021 11:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234033AbhH1LJm (ORCPT ); Sat, 28 Aug 2021 07:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234070AbhH1LJU (ORCPT ); Sat, 28 Aug 2021 07:09:20 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8ADC0613D9 for ; Sat, 28 Aug 2021 04:08:30 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id lc21so19673996ejc.7 for ; Sat, 28 Aug 2021 04:08: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=YAFMtbvJRGK1GmJcd8X6BZDwj6sFH8EQY+S8GCuya80=; b=AbZXJnRhvCg4mOIAqtFl60xKHecP9IspbZaimUeREnHGzpBJ6qaCTcitvqna5VIbYf 21CJwCOmfWNj1rXv0l4TXChFnbtMmwniql7HNkng0uv+1MrP3PgYnnRi+OYJP8cpvwFO IgKABYs3cPKJ9mGahsXozIpMcKWHK6OKqO4as5X2iP70F0lFCGBHlPuKh5QNz4mDSKYi WvRP4wWSbJMGBG1SM8G1n5F7FuWkGTtHIbQHbJpBzasl4kz38Sb0x5LZvGqONavZtZE7 ylBC78Jz5jA4v8ZRSxjDq48DPMNI+vSQU6HqizeKM7PRzhENQtpNpoiSq6D3G9UWrN4O 5R7g== 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=YAFMtbvJRGK1GmJcd8X6BZDwj6sFH8EQY+S8GCuya80=; b=QQD6xL0yQy3vfauKlUTnou41JlMpWCDSIX3S9uzasrCTdPAhVxtr1nfWSBbUPlTvfI OpVkUIIjL0P3cGWforY306XenIdd+7VKuaeXprG/Lbwz5ZIW4XJJ/pQSHgBuF7510EFQ mTg6tp1PJ6Ixjzcg2zsrmlf9+ltAB5ygI6seg99y42RBtVopSqKSytLItpKhinoiE0ia sz6dwMVp0Ou5AEU83X3tRPIVdcvxOrJQQAq8j+SAiR2oIlxAHSTHmIHG3YAqAqvTXjp5 HYbX9u6UTqYTVOif8sPS/saf0jBLWcIKZQx81K23QIZnGArT8y6l6VowFNyQKw7tBxr7 Fp9A== X-Gm-Message-State: AOAM532CRC4l/mKBlbrQw5vQIH2gslvZ7hhtOQvKp9HRAYaDVpu+r9kt Wt8luoW+BtkuN5HFsEd7DpmQdMl7ioynIwVr X-Google-Smtp-Source: ABdhPJzqxYRtjL1fOUWW63R9yhtz7YVE8uZQXxnj3FiJIvx3j6e+on/mLhupZfficnLDKZPLdHuHNg== X-Received: by 2002:a17:906:d20a:: with SMTP id w10mr15401584ejz.426.1630148908826; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:28 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 13/19] bridge: vlan: add global mcast_membership_interval option Date: Sat, 28 Aug 2021 14:07:59 +0300 Message-Id: <20210828110805.463429-14-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 2a3dffdbac44..acdbb4a1b562 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -45,6 +45,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); } @@ -448,6 +449,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(); @@ -814,6 +823,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 Sat Aug 28 11:08:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504262 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 17D5BC432BE for ; Sat, 28 Aug 2021 11:08:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECE2E60E8B for ; Sat, 28 Aug 2021 11:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234200AbhH1LJo (ORCPT ); Sat, 28 Aug 2021 07:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233892AbhH1LJV (ORCPT ); Sat, 28 Aug 2021 07:09:21 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73323C061756 for ; Sat, 28 Aug 2021 04:08:31 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id q3so13829537edt.5 for ; Sat, 28 Aug 2021 04:08: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=DF+exTBtMRtFeXw/oti+cwAQwyYfRw66qv3NA0eX2E4=; b=oRf01UpXij7KOEMroAYx8+udFFj3IJ6hACZAClgD23GkCKaDW0BzSBuF3Qpsz+0rWt SAaE5tjB1fwOiqjUBE3VvkuWR3Ff/OiaEbhxvOmAgVVqVfp1UzqMocOcQprL54dhETez 9Lso/1bTP/e2OgnePyln7Sl2zPQSc38PbRB7Dvg0lCI+Anr4MCI/EFjH0DAR2H+g7D7Z Nh8zTIj9nqX3A+equFmeAU8KXE+jESpwOlyoJROR2eEa0wyFGJiTN0McIs17YxSyOQoD xu324YCPdvWeuWKtY50UMlSQUPXdz5hyHN6y/uzqvtxkZPc2iOviXeP+KBGxwmi3O76x xXaA== 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=DF+exTBtMRtFeXw/oti+cwAQwyYfRw66qv3NA0eX2E4=; b=DqoRMqkPLi3Vhwk5x9TzNexBlUSTGqk3Avv0uDkOyXyDpibfcS6vH+3VLdaDwHHcxU OsknizQvqFoWBd+z6z0mHhPHDYezcbZ4BOq5UCG0sgduZiheE5clwXgJHLqESP2Eyvr6 hrapPk9m8PkaANy8gkwGwEBc1fkozD9mRfL1GZmErk91lIdqR/BxCcAx3Cb6elP6y0So ivVGjQZxuEpzJfAe6WLclWLu0Etn4auuBS9gvnaStw5Z54+c0jHngGoQQPrI+Wk3Zxvj 1u78joFCWgfhzJpcO6qs9HcoK6hEKJfuAasiDoeNXUmSfqeRo+5NulZi9jChRckBzFWG T8hA== X-Gm-Message-State: AOAM530Dv8kbDMU8TVr16JKJiviN/UnAcv4jyhUe+mQEax72w5V9cOvA zSaJxQi3bpavA/tX5RHynksCjaSrsftw6Zo3 X-Google-Smtp-Source: ABdhPJx5P/z3Yx6q6qdjSJMfUElEUN87kJwD7CKlwXEz8g1Tm0M9w5t17vpC0S6Wzl/R93WtLu4hEw== X-Received: by 2002:aa7:c790:: with SMTP id n16mr14467066eds.223.1630148909765; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:29 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 14/19] bridge: vlan: add global mcast_querier_interval option Date: Sat, 28 Aug 2021 14:08:00 +0300 Message-Id: <20210828110805.463429-15-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 acdbb4a1b562..5494dd15c76e 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -46,6 +46,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); } @@ -457,6 +458,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(); @@ -829,6 +838,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 Sat Aug 28 11:08:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503961 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 99755C432BE for ; Sat, 28 Aug 2021 11:08:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 821D560E77 for ; Sat, 28 Aug 2021 11:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234127AbhH1LJq (ORCPT ); Sat, 28 Aug 2021 07:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbhH1LJW (ORCPT ); Sat, 28 Aug 2021 07:09:22 -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 63AEFC0613D9 for ; Sat, 28 Aug 2021 04:08:32 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a25so19651396ejv.6 for ; Sat, 28 Aug 2021 04:08: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=lT9JvyrdvnM/eoCLoXdcjMOrdoJgyMWFCyFc+y+oquo=; b=y2JnQ6t4k1xXQquDPJsB1mq3hEYtsxEnspzCJ1+F34PGvmuPHPsGu+df2ig4LPTR6Q 7SmpWAjl0WiuqsU3hgSUN2NC7KTVPv6xb87aVVQqH4ZY4WIFW32A7vDvhxQtv2b6+gh3 lUumu4FA1tFu7RMNjXK5WC1VzpKk4NgoGXuCco5GKAjQ7FOrpbI70HwNerRNMMwMxCne EXf+gBXqU0ANNIAY4YAFctEEUXj4n7a10A50I7rWZAbZuZBw/J2/NQX2WGdUYUNIuBcZ 3hw/6DWYPqu/BoRQd22BrSYYf+1Va6/uSK5UxKy4baUnP+P5fuJ+/02RLcXes5Ui4W1D wBHA== 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=lT9JvyrdvnM/eoCLoXdcjMOrdoJgyMWFCyFc+y+oquo=; b=gOrBKbboLShhqVpu4784UZfsRpRdcte7ri5SbEwVKCSjME6/fAMi3ysUKJ6mPU141F AepIzRStXP2p2EWMyJ5/LGW84ZSrne1Ega3+y6Vc2fbl6VWxhSaHcWtw+GFBMs9q5smp WpXZLNnsPfW4DYpa5QKF9NcOk+8zrB3dyRCmdrTpvt2fFstmvZWh+NpOGyo0g2kSvs7H T/Eyrddruxikn0jhuIgXFeBCsD6OXsdzJsFWFOKyCI8MWMztIOJP3SOTsUkPGIs4GPlc yiMD80SZhHazltxGqdACXBlmzSqhJJmIEVEmZ3awMnoF3k/2S5eL0javlyScIMcWnzQ5 U8pA== X-Gm-Message-State: AOAM531dhAYeGX9TiLaZwyJDVdOO5j8p5mtSCn4JmjFkFGMpMiCz+C4C HBJX2SGi6W6C4TtwGTMOlKtWzGMEHW0JV2mE X-Google-Smtp-Source: ABdhPJxHgVTwWo0rfl13UPi7cMh6CbE+G8ha7YSdYaFbcf60r/FLBXDh8ZmJgJ6h5ZgvehmUoNt/ag== X-Received: by 2002:a17:907:78cf:: with SMTP id kv15mr9561876ejc.422.1630148910703; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:30 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 15/19] bridge: vlan: add global mcast_query_interval option Date: Sat, 28 Aug 2021 14:08:01 +0300 Message-Id: <20210828110805.463429-16-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 5494dd15c76e..d7fb27ea752a 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -47,6 +47,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); } @@ -466,6 +467,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(); @@ -844,6 +853,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 Sat Aug 28 11:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504261 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 E8253C4320E for ; Sat, 28 Aug 2021 11:09:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3B9D60E77 for ; Sat, 28 Aug 2021 11:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234160AbhH1LJu (ORCPT ); Sat, 28 Aug 2021 07:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233999AbhH1LJX (ORCPT ); Sat, 28 Aug 2021 07:09:23 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3831EC061796 for ; Sat, 28 Aug 2021 04:08:33 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id u3so19574413ejz.1 for ; Sat, 28 Aug 2021 04:08: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=dt1a/WlIFyW5VTFVG6w4NhMp+2geq96Q/2tjj7O5Ugw=; b=F4O/BvA5CKAmOsCQIA168zL9+/7FKlFXfFoRfGq15Wkn7kRdwVYfdnjrZY8wJoEtMa zgDY8+BqmQTMSkZm9RGSauZn5zO/eVDmke9cLDu5eypJ4PULFW8Wf+FEBt0BttomHmtc iRMeDAaDXkUy7bbb7YwCc425HhZRaOKtPW0mCSrpZVT/oQAOhcREPJ+iKZCCeAkPfQZP ALXIRqtGf6598eZhfzuXguMUTSuGhCvTKqpZJHGo0kszhi9BU3DQZdHMOtr/R0BewMj0 NfSn9oi+KawsKQnGMMHDvPPZ+ig3fQMoNYvVU7uVwdNXcbE51m6UF1FiMBSc1UB+SSeL NFlQ== 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=dt1a/WlIFyW5VTFVG6w4NhMp+2geq96Q/2tjj7O5Ugw=; b=IBjLpt6LHmMbUedmNbt3gC8JQu+ouDHFsyljlEsffOBScD4PfCC+0KD9MY87fkS91J JRpocu58dTb83O5kQ1tzHztpL1rClCFSbfzIpjLK2JNuK4GNYc2Mct6sM2QBac7sbQwv oDNSSRN09jjHfx5HiDjENurck9pbS1VEWfU0JqWPxAlfzL8ZWrx+DVzJ42yCElBog/4Y LHKkvM6UL4iwmBUkrabya6ayXvfQBP/Ymf2G+gCg9p9ab3dzYfZndUcmRL91GpV5TimH UvsgKZPS6o1FVraLTXed9+FDsO80tQAV1N2TLoCwP3DaLD64YTC/x9YA/9gEbd5F3jvx BsGw== X-Gm-Message-State: AOAM533QiWRK0NZ+gWcUFfYjWgU+551U0/Z9iCGzYuGuGYvw4oQLVjlN dSsJekWwlJ2dn0XLa6ZlhOqva3gjIoX9z93A X-Google-Smtp-Source: ABdhPJxXFzJTzPDSYBuBKNq4HNcXaJ/qlVqCKKejF2vSm8h2yK4J47d+LM6wLTBiCTen0u9kpgQUHw== X-Received: by 2002:a17:906:3708:: with SMTP id d8mr15301345ejc.310.1630148911603; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:31 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 16/19] bridge: vlan: add global mcast_query_response_interval option Date: Sat, 28 Aug 2021 14:08:02 +0300 Message-Id: <20210828110805.463429-17-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 d7fb27ea752a..7f6845158bf0 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -48,6 +48,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); } @@ -475,6 +476,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(); @@ -859,6 +868,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 Sat Aug 28 11:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503960 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 9AA00C432BE for ; Sat, 28 Aug 2021 11:09:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 833F1601FD for ; Sat, 28 Aug 2021 11:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234170AbhH1LJv (ORCPT ); Sat, 28 Aug 2021 07:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234012AbhH1LJY (ORCPT ); Sat, 28 Aug 2021 07:09:24 -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 42896C061756 for ; Sat, 28 Aug 2021 04:08:34 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id n27so19709045eja.5 for ; Sat, 28 Aug 2021 04:08: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=VhD2Pji1SPKf/7s4zF8hjiL2wpeUroReD5vXl/QnrWA=; b=eS3MwcX0UqDtZAZKANxftK3ccNTkdYvq/rzNso53MjqCTESHbG9OoHUe2cmybmNxXt 7K5XizAUo083RAzxV0QKmf1PjFnD5I3IbpCRrrj/x66ZAjbTCsDpZEq0Gy6IUBv33m6/ 6P04CRUbjRCIfnoEiaK2twXhskK6TTAJVLjm2ZN7z+bkL2Cgmoo1pGhO/5rERDLdOu8Q Aq0NaG2S/hYs5ZwL1MWT+ubqxmTSW9N1zL964A7b0d9KJcxQ5wzeYHqBhuqdPz5WtsqA L5wGONbb9/CXHouQv17WpYCARH50mtV+BoBLuuCL+aTUPrk5tZDjnc236UHbeCcVdq+e MF0A== 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=VhD2Pji1SPKf/7s4zF8hjiL2wpeUroReD5vXl/QnrWA=; b=enRjWipJTVuwjNEPy8n9bkBCROlRxQ1IkNSf7VY3+s8/JLeO61ppACx+4rcIu2pCRg fxSJij3f2p4F/bMdhPtYeklWOq/LHyXz3ufGjkKoGawHnZPel4ipUTS+equPazCqtEK9 ZYsS7tI7WEQ3UPx/ZjmHkkD9JGiOOGcu+z+Ebkrxanh+JTwIOWmTMacUqCJhdJMk/lZp i4pnQMKc3tTKwuF7gQK/GHMx5yTOm2XrVTsTSOn6Xy15CjIHUeS0A5pWrjVS8UnH8sH9 typgTSGslUj+h7EPWq8E8yVJCCAZCYr1+0yWvK1gvdIgxz2/Q4ZHOnluIXXV1l9/C/Dw KJnA== X-Gm-Message-State: AOAM533QQ2hP1KvMB09KUzcPsouzKjmlgNP5JIq/EsMBt71lzbDp3v4n Dxd7jJ4DuufGL/uWHn7pVrBCi/LAc5kgypNL X-Google-Smtp-Source: ABdhPJxgdWtnpVbV0OWtNgNnmvRUY3quEjC1G0zsdxy4ToTMrmsdp7ntOGiW4EJhudRciqXVAfNEKg== X-Received: by 2002:a17:906:fb19:: with SMTP id lz25mr15124614ejb.162.1630148912529; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:32 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 17/19] bridge: vlan: add global mcast_startup_query_interval option Date: Sat, 28 Aug 2021 14:08:03 +0300 Message-Id: <20210828110805.463429-18-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 7f6845158bf0..e8043f8574fd 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -45,6 +45,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" @@ -484,6 +485,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(); @@ -850,6 +859,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 Sat Aug 28 11:08:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 504260 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 93888C432BE for ; Sat, 28 Aug 2021 11:09:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D599601FD for ; Sat, 28 Aug 2021 11:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234240AbhH1LJ5 (ORCPT ); Sat, 28 Aug 2021 07:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234081AbhH1LJZ (ORCPT ); Sat, 28 Aug 2021 07:09:25 -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 4B56EC061756 for ; Sat, 28 Aug 2021 04:08:35 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id n11so13787768edv.11 for ; Sat, 28 Aug 2021 04:08: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=7ljWNNrdCEzdiywEueBd0MEyhVSwrG0MAfkPuz2/DW0=; b=giMnTdOl287ZWSxXtNkkVDemzxuHtWBIHv0lwUtf/l+FJ6JikKxfv0ULB65oNNkdv5 aGBLXp3LHcMKNNkwszdBFSyLqFYRa84GaLyAAQTYEOS0lol+WqQnQiWZqzNdODExZxGi cqRo25qRFs24Y4oi3CNtR00NhzAJo//OEZq5nfnYWAkagqzj9Cwx6jTM4LIJ9tf6Yr9S I0Dn8+Sl9YPk6S/NUJdDqOCvqabi9NV2lGmSAh+uM3x78zcYWlI0ODASfN/Qb//OejXd fSXhwLENMAQ2BJovRmaXTi5xSPJnvZifUBdnLoqWSuuQbIei7v0F7nF277x1Or5U716Q mheg== 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=7ljWNNrdCEzdiywEueBd0MEyhVSwrG0MAfkPuz2/DW0=; b=KU8ewKt3ctAdA3oJjscGKQcgAiOT/XMgXy0OwR+IBrWILk+2Nqi+cZ8ViEyb5yi8lZ QmgVoGcrSEenCiODrUycx6+1AhMBelCvX1xppXm4xpTnpj2xQQYUTwBQTB3HMw5g/1aw /C4BgyX8mHoFzjAL+Mp036Eewb8bycyTIXYevf7R6SeiIjqRexkKLUtzt5ug31sibB7r SLCVi79t3ER1MB3Fm1PvPin/Hz3OUD3rnBgRowGJ1NFz52NzgYVSY37fZyFzOJfa1GMl SVNsFAJrv7czH8wpY/S2gVTPY0k1ulNxnzsRRiLK7qJcmXj+0qpjXgYbpT1YGl7XplWw tuFg== X-Gm-Message-State: AOAM531JzNqr3AU/Reoi/ov3dRndavO8IABOrrhK/T32fQdwyFROP5q/ Mb1zCiahHyDIk7wS8eiabgipkEb3pBAG8hEB X-Google-Smtp-Source: ABdhPJxuUr28rtpMPmGh1hdmsiD8MnRjM6kVdP0FGG9m39sX6wLW9dTUrD2zUHeUz0IxEroyXZNY5w== X-Received: by 2002:a05:6402:214:: with SMTP id t20mr14304031edv.386.1630148913554; Sat, 28 Aug 2021 04:08: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 i19sm4710429edx.54.2021.08.28.04.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:33 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 18/19] bridge: vlan: add global mcast_querier option Date: Sat, 28 Aug 2021 14:08:04 +0300 Message-Id: <20210828110805.463429-19-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: adjust help msg alignment to fit in 100 columns 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 e8043f8574fd..afb5186d36de 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\n" " [ 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" @@ -418,6 +419,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)) @@ -831,6 +838,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 Sat Aug 28 11:08:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 503959 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 84189C432BE for ; Sat, 28 Aug 2021 11:09:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DFCA60E8B for ; Sat, 28 Aug 2021 11:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234213AbhH1LJ7 (ORCPT ); Sat, 28 Aug 2021 07:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234097AbhH1LJ1 (ORCPT ); Sat, 28 Aug 2021 07:09:27 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76FCBC061756 for ; Sat, 28 Aug 2021 04:08:36 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a25so19651681ejv.6 for ; Sat, 28 Aug 2021 04:08: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=0qYKgnCLen4cBBm6S3pdRBThWsOr6RKmftJwo6Di15U=; b=xDcszBl7xxM60u/49fMgWq+GqKozQxyYq/qAHhBhnVqFcENhnpw5JIb1qI4hm7vR9T QyAQBxhgPf+20poudhcwn74AaO/uvujHJcibdWjxqKheFuKpAk69v10By25yCZJo74j0 knzQwdJW1bJB48sBUabX/Xt5ag8J8iXqGKS+w4vRVtkFHUZ9uhOUmOKfyApRcqKexC0s XgF6xa1PTiBVJt5eHBQU35nIAPZM3MDG2jN1YRp1npca3UkrH6c0aDYv+hr0mT8MF3ZQ jwsuqqIiNwLzjvls5Wm3AtfEM9Bf+tEwPi+6gjF0XSeGUj1dp3dWpz8do8Duh7LxJYFZ k9nQ== 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=0qYKgnCLen4cBBm6S3pdRBThWsOr6RKmftJwo6Di15U=; b=DSjNBuL3uNJTG/D7ZgvPR2NvskPbEnFRtsAxauQSI3Hw7TFQqgMz+AzdOTdNpA7C7t PjgXOvzJJxJpi03NPoCba75N7GWdHARvJOIzA36Y0+fGk9V5l6wK5mpEs/MCB+rVBja8 Fs5IcUx6WZhVByGxMgMq7rCyHe3sLAtPqY/m+VQBG8AxhQ8yM8br8iH5JQEAm/P+h69M OifKin+JL+82wr/mNMYTzzsy2IfwQlIZHbnAEDf95L59SKFrRd4Em/BL+5xRvulnH2EB i8mHtrZCx8IEsVRG3SVnxbwp56QhzYGeArvIesDwMO2sNTmQOsb6IHLoNeQPPleMsQOd CxDQ== X-Gm-Message-State: AOAM533RkdXE7ghNaY9yIsBqrfqPUT1gFnt99Pr/jGXzBsmmJOuoh1yP kG90FfrQ58aNf6dM962Mwa6XB/yTrH1oiJoC X-Google-Smtp-Source: ABdhPJwpED+pg+wFuQT8ICrIo4SdtV009s9lbTjMYRdB67HBLjpAIneQz0IQ9146jLni7zCkaMlspA== X-Received: by 2002:a17:906:1dd6:: with SMTP id v22mr14796984ejh.226.1630148914810; Sat, 28 Aug 2021 04:08:34 -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 i19sm4710429edx.54.2021.08.28.04.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 04:08:34 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, dsahern@gmail.com, stephen@networkplumber.org, Joachim Wiberg , Nikolay Aleksandrov Subject: [PATCH iproute2-next v2 19/19] bridge: vlan: add support for dumping router ports Date: Sat, 28 Aug 2021 14:08:05 +0300 Message-Id: <20210828110805.463429-20-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828110805.463429-1-razor@blackwall.org> References: <20210828110805.463429-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 afb5186d36de..bf3b440fa1b4 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -803,6 +803,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; @@ -902,6 +932,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(); }