aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorLutz Donnerhacke <donner@FreeBSD.org>2021-02-06 10:25:04 +0000
committerLutz Donnerhacke <donner@FreeBSD.org>2021-02-06 14:01:15 +0000
commitc869d905baa4e329dfd6793e7487b5985248ddb6 (patch)
tree1b3a9d610a989df670ff8983b6bd10066f7501ba /sys/netgraph
parent689561d4032233bc171cff30d6756c3cf3b22720 (diff)
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_bridge.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index a21da545e210..ed08020ead70 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -105,7 +105,8 @@ struct ng_bridge_private {
u_int numBuckets; /* num buckets in table */
u_int hashMask; /* numBuckets - 1 */
int numLinks; /* num connected links */
- int persistent; /* can exist w/o hooks */
+ unsigned int persistent : 1, /* can exist w/o hooks */
+ sendUnknown : 1;/* links receive unknowns by default */
struct callout timer; /* one second periodic timer */
};
typedef struct ng_bridge_private *priv_p;
@@ -309,6 +310,7 @@ ng_bridge_constructor(node_p node)
priv->conf.loopTimeout = DEFAULT_LOOP_TIMEOUT;
priv->conf.maxStaleness = DEFAULT_MAX_STALENESS;
priv->conf.minStableAge = DEFAULT_MIN_STABLE_AGE;
+ priv->sendUnknown = 1; /* classic bridge */
/*
* This node has all kinds of stuff that could be screwed by SMP.
@@ -371,9 +373,11 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name)
if (isUplink) {
link->learnMac = 0;
link->sendUnknown = 1;
+ if (priv->numLinks == 0) /* if the first link is an uplink */
+ priv->sendUnknown = 0; /* switch to restrictive mode */
} else {
link->learnMac = 1;
- link->sendUnknown = 1;
+ link->sendUnknown = priv->sendUnknown;
}
NG_HOOK_SET_PRIVATE(hook, link);