netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joachim Wiberg <troglobit@gmail.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Joachim Wiberg <troglobit@gmail.com>
Subject: [PATCH iproute2-next v2 1/6] bridge: support for controlling flooding of broadcast per port
Date: Wed,  9 Mar 2022 08:17:11 +0100	[thread overview]
Message-ID: <20220309071716.2678952-2-troglobit@gmail.com> (raw)
In-Reply-To: <20220309071716.2678952-1-troglobit@gmail.com>

Add per-port support for controlling flooding of broadcast traffic.
Similar to unicast and multcast flooding that already exist.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
 bridge/link.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bridge/link.c b/bridge/link.c
index bc7837a9..407dc8ea 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -153,6 +153,9 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)
 		if (prtb[IFLA_BRPORT_MCAST_FLOOD])
 			print_on_off(PRINT_ANY, "mcast_flood", "mcast_flood %s ",
 				     rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_FLOOD]));
+		if (prtb[IFLA_BRPORT_BCAST_FLOOD])
+			print_on_off(PRINT_ANY, "bcast_flood", "bcast_flood %s ",
+				     rta_getattr_u8(prtb[IFLA_BRPORT_BCAST_FLOOD]));
 		if (prtb[IFLA_BRPORT_MCAST_TO_UCAST])
 			print_on_off(PRINT_ANY, "mcast_to_unicast", "mcast_to_unicast %s ",
 				     rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_TO_UCAST]));
@@ -265,6 +268,7 @@ static void usage(void)
 		"                               [ learning_sync {on | off} ]\n"
 		"                               [ flood {on | off} ]\n"
 		"                               [ mcast_flood {on | off} ]\n"
+		"                               [ bcast_flood {on | off} ]\n"
 		"                               [ mcast_to_unicast {on | off} ]\n"
 		"                               [ neigh_suppress {on | off} ]\n"
 		"                               [ vlan_tunnel {on | off} ]\n"
@@ -296,6 +300,7 @@ static int brlink_modify(int argc, char **argv)
 	__s8 flood = -1;
 	__s8 vlan_tunnel = -1;
 	__s8 mcast_flood = -1;
+	__s8 bcast_flood = -1;
 	__s8 mcast_to_unicast = -1;
 	__s8 isolated = -1;
 	__s8 hairpin = -1;
@@ -354,6 +359,11 @@ static int brlink_modify(int argc, char **argv)
 			mcast_flood = parse_on_off("mcast_flood", *argv, &ret);
 			if (ret)
 				return ret;
+		} else if (strcmp(*argv, "bcast_flood") == 0) {
+			NEXT_ARG();
+			bcast_flood = parse_on_off("bcast_flood", *argv, &ret);
+			if (ret)
+				return ret;
 		} else if (strcmp(*argv, "mcast_to_unicast") == 0) {
 			NEXT_ARG();
 			mcast_to_unicast = parse_on_off("mcast_to_unicast", *argv, &ret);
@@ -456,6 +466,9 @@ static int brlink_modify(int argc, char **argv)
 	if (mcast_flood >= 0)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_FLOOD,
 			 mcast_flood);
+	if (bcast_flood >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_BCAST_FLOOD,
+			 bcast_flood);
 	if (mcast_to_unicast >= 0)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_TO_UCAST,
 			 mcast_to_unicast);
-- 
2.25.1


  reply	other threads:[~2022-03-09  7:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  7:17 [PATCH iproute2-next v2 0/6] bridge: support for controlling broadcast flooding per port Joachim Wiberg
2022-03-09  7:17 ` Joachim Wiberg [this message]
2022-03-09  7:17 ` [PATCH iproute2-next v2 2/6] man: bridge: document new bcast_flood flag for bridge ports Joachim Wiberg
2022-03-09  7:17 ` [PATCH iproute2-next v2 3/6] ip: iplink_bridge_slave: support for broadcast flooding Joachim Wiberg
2022-03-09  7:17 ` [PATCH iproute2-next v2 4/6] man: ip-link: document new bcast_flood flag on bridge ports Joachim Wiberg
2022-03-09  7:28   ` Stephen Hemminger
2022-03-09 12:34     ` Joachim Wiberg
2022-03-09  7:17 ` [PATCH iproute2-next v2 5/6] man: ip-link: mention bridge port's default mcast_flood state Joachim Wiberg
2022-03-09  7:17 ` [PATCH iproute2-next v2 6/6] man: ip-link: whitespace fixes to odd line breaks mid sentence Joachim Wiberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309071716.2678952-2-troglobit@gmail.com \
    --to=troglobit@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).