Blame SOURCES/0036-bridge-link-add-learning_sync-policy-flag.patch

4aca6e
From 1fbff3fcfe0dc2ba063726d703a39bbfc2182b56 Mon Sep 17 00:00:00 2001
4aca6e
From: Phil Sutter <psutter@redhat.com>
4aca6e
Date: Tue, 28 Feb 2017 16:09:46 +0100
4aca6e
Subject: [PATCH] bridge/link: add learning_sync policy flag
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
4aca6e
Upstream Status: iproute2.git commit 674bb438bc5cc
4aca6e
4aca6e
commit 674bb438bc5cc61a9e16f97a236203ea2f50523f
4aca6e
Author: Scott Feldman <sfeldma@gmail.com>
4aca6e
Date:   Mon Dec 29 12:20:07 2014 -0800
4aca6e
4aca6e
    bridge/link: add learning_sync policy flag
4aca6e
4aca6e
    v2:
4aca6e
4aca6e
    Resending now that the dust has cleared in 3.18 on "self" vs. hwmode debate for
4aca6e
    brport settings.  learning_sync is now set/cleared using "self" qualifier on
4aca6e
    brport.
4aca6e
4aca6e
    v1:
4aca6e
4aca6e
    Add 'learned_sync' flag to turn on/off syncing of learned MAC addresses from
4aca6e
    offload device to bridge's FDB.   Flag is be set/cleared on offload device port
4aca6e
    using "self" qualifier:
4aca6e
4aca6e
      $ sudo bridge link set dev swp1 learning_sync on self
4aca6e
4aca6e
      $ bridge -d link show dev swp1
4aca6e
      2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 2
4aca6e
          hairpin off guard off root_block off fastleave off learning off flood off
4aca6e
      2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0
4aca6e
          learning on learning_sync on
4aca6e
4aca6e
    Adds new IFLA_BRPORT_LEARNED_SYNCED attribute for IFLA_PROTINFO on the SELF
4aca6e
    brport.
4aca6e
4aca6e
    Signed-off-by: Scott Feldman <sfeldma@gmail.com>
4aca6e
---
4aca6e
 bridge/link.c     | 12 ++++++++++++
4aca6e
 man/man8/bridge.8 |  6 ++++++
4aca6e
 2 files changed, 18 insertions(+)
4aca6e
4aca6e
diff --git a/bridge/link.c b/bridge/link.c
4aca6e
index 4e0fd96..8b18931 100644
4aca6e
--- a/bridge/link.c
4aca6e
+++ b/bridge/link.c
4aca6e
@@ -188,6 +188,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
4aca6e
 				if (prtb[IFLA_BRPORT_LEARNING])
4aca6e
 					print_onoff(fp, "learning",
4aca6e
 						    rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING]));
4aca6e
+				if (prtb[IFLA_BRPORT_LEARNING_SYNC])
4aca6e
+					print_onoff(fp, "learning_sync",
4aca6e
+						    rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING_SYNC]));
4aca6e
 				if (prtb[IFLA_BRPORT_UNICAST_FLOOD])
4aca6e
 					print_onoff(fp, "flood",
4aca6e
 						    rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD]));
4aca6e
@@ -221,6 +224,7 @@ static void usage(void)
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,	"                               [ learning_sync {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
@@ -252,6 +256,7 @@ static int brlink_modify(int argc, char **argv)
4aca6e
 	} req;
4aca6e
 	char *d = NULL;
4aca6e
 	__s8 learning = -1;
4aca6e
+	__s8 learning_sync = -1;
4aca6e
 	__s8 flood = -1;
4aca6e
 	__s8 hairpin = -1;
4aca6e
 	__s8 bpdu_guard = -1;
4aca6e
@@ -295,6 +300,10 @@ static int brlink_modify(int argc, char **argv)
4aca6e
 			NEXT_ARG();
4aca6e
 			if (!on_off("learning", &learning, *argv))
4aca6e
 				exit(-1);
4aca6e
+		} else if (strcmp(*argv, "learning_sync") == 0) {
4aca6e
+			NEXT_ARG();
4aca6e
+			if (!on_off("learning_sync", &learning_sync, *argv))
4aca6e
+				exit(-1);
4aca6e
 		} else if (strcmp(*argv, "flood") == 0) {
4aca6e
 			NEXT_ARG();
4aca6e
 			if (!on_off("flood", &flood, *argv))
4aca6e
@@ -359,6 +368,9 @@ static int brlink_modify(int argc, char **argv)
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
+	if (learning_sync >= 0)
4aca6e
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING_SYNC,
4aca6e
+			 learning_sync);
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 5e51d54..42fe922 100644
4aca6e
--- a/man/man8/bridge.8
4aca6e
+++ b/man/man8/bridge.8
4aca6e
@@ -38,6 +38,7 @@ bridge \- show / manipulate bridge addresses and devices
4aca6e
 .BR fastleave " { " on " | " off " } ] [ "
4aca6e
 .BR root_block " { " on " | " off " } ] [ "
4aca6e
 .BR learning " { " on " | " off " } ] [ "
4aca6e
+.BR learning_sync " { " on " | " off " } ] [ "
4aca6e
 .BR flood " { " on " | " off " } ] [ "
4aca6e
 .BR hwmode " { " vepa " | " veb " } ] "
4aca6e
 
4aca6e
@@ -263,6 +264,11 @@ 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 "learning_sync on " or " learning_sync off "
4aca6e
+Controls whether a given port will sync MAC addresses learned on device port to
4aca6e
+bridge FDB.
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
-- 
4aca6e
1.8.3.1
4aca6e