bridge/link: add learning_sync policy flag
v2:
Resending now that the dust has cleared in 3.18 on "self" vs. hwmode debate for
brport settings. learning_sync is now set/cleared using "self" qualifier on
brport.
v1:
Add 'learned_sync' flag to turn on/off syncing of learned MAC addresses from
offload device to bridge's FDB. Flag is be set/cleared on offload device port
using "self" qualifier:
$ sudo bridge link set dev swp1 learning_sync on self
$ bridge -d link show dev swp1
2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 2
hairpin off guard off root_block off fastleave off learning off flood off
2: swp1 state UNKNOWN : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br0
learning on learning_sync on
Adds new IFLA_BRPORT_LEARNED_SYNCED attribute for IFLA_PROTINFO on the SELF
brport.
Signed-off-by: Scott Feldman <sfeldma@gmail.com>
This commit is contained in:
parent
b93fe57840
commit
674bb438bc
|
|
@ -188,6 +188,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
|
||||||
if (prtb[IFLA_BRPORT_LEARNING])
|
if (prtb[IFLA_BRPORT_LEARNING])
|
||||||
print_onoff(fp, "learning",
|
print_onoff(fp, "learning",
|
||||||
rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING]));
|
rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING]));
|
||||||
|
if (prtb[IFLA_BRPORT_LEARNING_SYNC])
|
||||||
|
print_onoff(fp, "learning_sync",
|
||||||
|
rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING_SYNC]));
|
||||||
if (prtb[IFLA_BRPORT_UNICAST_FLOOD])
|
if (prtb[IFLA_BRPORT_UNICAST_FLOOD])
|
||||||
print_onoff(fp, "flood",
|
print_onoff(fp, "flood",
|
||||||
rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD]));
|
rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD]));
|
||||||
|
|
@ -221,6 +224,7 @@ static void usage(void)
|
||||||
fprintf(stderr, " [ fastleave {on | off} ]\n");
|
fprintf(stderr, " [ fastleave {on | off} ]\n");
|
||||||
fprintf(stderr, " [ root_block {on | off} ]\n");
|
fprintf(stderr, " [ root_block {on | off} ]\n");
|
||||||
fprintf(stderr, " [ learning {on | off} ]\n");
|
fprintf(stderr, " [ learning {on | off} ]\n");
|
||||||
|
fprintf(stderr, " [ learning_sync {on | off} ]\n");
|
||||||
fprintf(stderr, " [ flood {on | off} ]\n");
|
fprintf(stderr, " [ flood {on | off} ]\n");
|
||||||
fprintf(stderr, " [ hwmode {vepa | veb} ]\n");
|
fprintf(stderr, " [ hwmode {vepa | veb} ]\n");
|
||||||
fprintf(stderr, " bridge link show [dev DEV]\n");
|
fprintf(stderr, " bridge link show [dev DEV]\n");
|
||||||
|
|
@ -252,6 +256,7 @@ static int brlink_modify(int argc, char **argv)
|
||||||
} req;
|
} req;
|
||||||
char *d = NULL;
|
char *d = NULL;
|
||||||
__s8 learning = -1;
|
__s8 learning = -1;
|
||||||
|
__s8 learning_sync = -1;
|
||||||
__s8 flood = -1;
|
__s8 flood = -1;
|
||||||
__s8 hairpin = -1;
|
__s8 hairpin = -1;
|
||||||
__s8 bpdu_guard = -1;
|
__s8 bpdu_guard = -1;
|
||||||
|
|
@ -295,6 +300,10 @@ static int brlink_modify(int argc, char **argv)
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (!on_off("learning", &learning, *argv))
|
if (!on_off("learning", &learning, *argv))
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
} else if (strcmp(*argv, "learning_sync") == 0) {
|
||||||
|
NEXT_ARG();
|
||||||
|
if (!on_off("learning_sync", &learning_sync, *argv))
|
||||||
|
exit(-1);
|
||||||
} else if (strcmp(*argv, "flood") == 0) {
|
} else if (strcmp(*argv, "flood") == 0) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (!on_off("flood", &flood, *argv))
|
if (!on_off("flood", &flood, *argv))
|
||||||
|
|
@ -359,6 +368,9 @@ static int brlink_modify(int argc, char **argv)
|
||||||
addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
|
addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
|
||||||
if (learning >= 0)
|
if (learning >= 0)
|
||||||
addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning);
|
addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning);
|
||||||
|
if (learning_sync >= 0)
|
||||||
|
addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING_SYNC,
|
||||||
|
learning_sync);
|
||||||
|
|
||||||
if (cost > 0)
|
if (cost > 0)
|
||||||
addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
|
addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ bridge \- show / manipulate bridge addresses and devices
|
||||||
.BR fastleave " { " on " | " off " } ] [ "
|
.BR fastleave " { " on " | " off " } ] [ "
|
||||||
.BR root_block " { " on " | " off " } ] [ "
|
.BR root_block " { " on " | " off " } ] [ "
|
||||||
.BR learning " { " on " | " off " } ] [ "
|
.BR learning " { " on " | " off " } ] [ "
|
||||||
|
.BR learning_sync " { " on " | " off " } ] [ "
|
||||||
.BR flood " { " on " | " off " } ] [ "
|
.BR flood " { " on " | " off " } ] [ "
|
||||||
.BR hwmode " { " vepa " | " veb " } ] "
|
.BR hwmode " { " vepa " | " veb " } ] "
|
||||||
|
|
||||||
|
|
@ -262,6 +263,11 @@ Controls whether a given port will learn MAC addresses from received traffic or
|
||||||
not. If learning if off, the bridge will end up flooding any traffic for which
|
not. If learning if off, the bridge will end up flooding any traffic for which
|
||||||
it has no FDB entry. By default this flag is on.
|
it has no FDB entry. By default this flag is on.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR "learning_sync on " or " learning_sync off "
|
||||||
|
Controls whether a given port will sync MAC addresses learned on device port to
|
||||||
|
bridge FDB.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR "flooding on " or " flooding off "
|
.BR "flooding on " or " flooding off "
|
||||||
Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on.
|
Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue