naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

Blame SOURCES/0029-bridge-Add-learning-and-flood-support.patch

4aca6e
From 8e5969521d5df7a63d9a20597cb9d52b776c3e6e Mon Sep 17 00:00:00 2001
4aca6e
From: Phil Sutter <psutter@redhat.com>
4aca6e
Date: Tue, 28 Feb 2017 16:09:08 +0100
4aca6e
Subject: [PATCH] bridge: Add learning and flood support
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
4aca6e
Upstream Status: iproute2.git commit f0f4ab600b5a9
4aca6e
4aca6e
commit f0f4ab600b5a9d1f718c8812e20dffe61ca95989
4aca6e
Author: Vlad Yasevich <vyasevic@redhat.com>
4aca6e
Date:   Wed May 21 09:53:43 2014 -0400
4aca6e
4aca6e
    bridge: Add learning and flood support
4aca6e
4aca6e
    Add ability to control learning and flood flags on bridge
4aca6e
    ports.
4aca6e
4aca6e
    Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
4aca6e
---
4aca6e
 bridge/link.c     | 22 ++++++++++++++++++++++
4aca6e
 man/man8/bridge.8 | 12 ++++++++++++
4aca6e
 2 files changed, 34 insertions(+)
4aca6e
4aca6e
diff --git a/bridge/link.c b/bridge/link.c
4aca6e
index 19d0642..176c906 100644
4aca6e
--- a/bridge/link.c
4aca6e
+++ b/bridge/link.c
4aca6e
@@ -185,6 +185,12 @@ int print_linkinfo(const struct sockaddr_nl *who,
4aca6e
 				if (prtb[IFLA_BRPORT_FAST_LEAVE])
4aca6e
 					print_onoff(fp, "fastleave",
4aca6e
 						    rta_getattr_u8(prtb[IFLA_BRPORT_FAST_LEAVE]));
4aca6e
+				if (prtb[IFLA_BRPORT_LEARNING])
4aca6e
+					print_onoff(fp, "learning",
4aca6e
+						    rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING]));
4aca6e
+				if (prtb[IFLA_BRPORT_UNICAST_FLOOD])
4aca6e
+					print_onoff(fp, "flood",
4aca6e
+						    rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD]));
4aca6e
 			}
4aca6e
 		} else
4aca6e
 			print_portstate(fp, rta_getattr_u8(tb[IFLA_PROTINFO]));
4aca6e
@@ -214,6 +220,8 @@ static void usage(void)
4aca6e
 	fprintf(stderr, "                               [ hairpin {on | off} ] \n");
4aca6e
 	fprintf(stderr, "                               [ fastleave {on | off} ]\n");
4aca6e
 	fprintf(stderr,	"                               [ root_block {on | off} ]\n");
4aca6e
+	fprintf(stderr,	"                               [ learning {on | off} ]\n");
4aca6e
+	fprintf(stderr,	"                               [ flood {on | off} ]\n");
4aca6e
 	fprintf(stderr, "                               [ hwmode {vepa | veb} ]\n");
4aca6e
 	fprintf(stderr, "       bridge link show [dev DEV]\n");
4aca6e
 	exit(-1);
4aca6e
@@ -243,6 +251,8 @@ static int brlink_modify(int argc, char **argv)
4aca6e
 		char             buf[512];
4aca6e
 	} req;
4aca6e
 	char *d = NULL;
4aca6e
+	__s8 learning = -1;
4aca6e
+	__s8 flood = -1;
4aca6e
 	__s8 hairpin = -1;
4aca6e
 	__s8 bpdu_guard = -1;
4aca6e
 	__s8 fast_leave = -1;
4aca6e
@@ -281,6 +291,14 @@ static int brlink_modify(int argc, char **argv)
4aca6e
 			NEXT_ARG();
4aca6e
 			if (!on_off("root_block", &root_block, *argv))
4aca6e
 				exit(-1);
4aca6e
+		} else if (strcmp(*argv, "learning") == 0) {
4aca6e
+			NEXT_ARG();
4aca6e
+			if (!on_off("learning", &learning, *argv))
4aca6e
+				exit(-1);
4aca6e
+		} else if (strcmp(*argv, "flood") == 0) {
4aca6e
+			NEXT_ARG();
4aca6e
+			if (!on_off("flood", &flood, *argv))
4aca6e
+				exit(-1);
4aca6e
 		} else if (strcmp(*argv, "cost") == 0) {
4aca6e
 			NEXT_ARG();
4aca6e
 			cost = atoi(*argv);
4aca6e
@@ -335,6 +353,10 @@ static int brlink_modify(int argc, char **argv)
4aca6e
 			 fast_leave);
4aca6e
 	if (root_block >= 0)
4aca6e
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block);
4aca6e
+	if (flood >= 0)
4aca6e
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
4aca6e
+	if (learning >= 0)
4aca6e
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning);
4aca6e
 
4aca6e
 	if (cost > 0)
4aca6e
 		addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
4aca6e
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
4aca6e
index 4f48546..5e51d54 100644
4aca6e
--- a/man/man8/bridge.8
4aca6e
+++ b/man/man8/bridge.8
4aca6e
@@ -37,6 +37,8 @@ bridge \- show / manipulate bridge addresses and devices
4aca6e
 .BR hairpin " { " on " | " off " } ] [ "
4aca6e
 .BR fastleave " { " on " | " off " } ] [ "
4aca6e
 .BR root_block " { " on " | " off " } ] [ "
4aca6e
+.BR learning " { " on " | " off " } ] [ "
4aca6e
+.BR flood " { " on " | " off " } ] [ "
4aca6e
 .BR hwmode " { " vepa " | " veb " } ] "
4aca6e
 
4aca6e
 .ti -8
4aca6e
@@ -255,6 +257,16 @@ Controls whether a given port is allowed to become root port or not. Only used
4aca6e
 when STP is enabled on the bridge. By default the flag is off.
4aca6e
 
4aca6e
 .TP
4aca6e
+.BR "learning on " or " learning off "
4aca6e
+Controls whether a given port will learn MAC addresses from received traffic or
4aca6e
+not.  If learning if off, the bridge will end up flooding any traffic for which
4aca6e
+it has no FDB entry.  By default this flag is on.
4aca6e
+
4aca6e
+.TP
4aca6e
+.BR "flooding on " or " flooding off "
4aca6e
+Controls whether a given port will flood unicast traffic for which there is no FDB entry.  By default this flag is on.
4aca6e
+
4aca6e
+.TP
4aca6e
 .BI hwmode
4aca6e
 Some network interface cards support HW bridge functionality and they may be
4aca6e
 configured in different modes. Currently support modes are:
4aca6e
-- 
4aca6e
1.8.3.1
4aca6e