summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2006-11-09 06:32:38 +0000
committerthompsa <thompsa@FreeBSD.org>2006-11-09 06:32:38 +0000
commite6cf955ad4f3c344435f4523de9215f577f8c646 (patch)
treecf54c5483f37944549b7a3563be875b05ec80027 /sbin
parent2294e5e2a949e36f69b95aeea4f26f4a817f0e57 (diff)
downloadFreeBSD-src-e6cf955ad4f3c344435f4523de9215f577f8c646.zip
FreeBSD-src-e6cf955ad4f3c344435f4523de9215f577f8c646.tar.gz
Add a new address cache type called sticky. On an interface marked sticky any
address learned by the bridge is made permanent, the address will not age out and most importantly will not migrate to another interface. This can be used to stop mac address poisoning or clients roaming in much the same way as static entries without the hassle of preloading the table.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifbridge.c16
-rw-r--r--sbin/ifconfig/ifconfig.812
2 files changed, 28 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index 3f708b2..1100aab 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -321,6 +321,20 @@ unsetbridge_learn(const char *val, int d, int s, const struct afswtch *afp)
}
static void
+setbridge_sticky(const char *val, int d, int s, const struct afswtch *afp)
+{
+
+ do_bridgeflag(s, val, IFBIF_STICKY, 1);
+}
+
+static void
+unsetbridge_sticky(const char *val, int d, int s, const struct afswtch *afp)
+{
+
+ do_bridgeflag(s, val, IFBIF_STICKY, 0);
+}
+
+static void
setbridge_span(const char *val, int d, int s, const struct afswtch *afp)
{
struct ifbreq req;
@@ -639,6 +653,8 @@ static struct cmd bridge_cmds[] = {
DEF_CMD_ARG("-discover", unsetbridge_discover),
DEF_CMD_ARG("learn", setbridge_learn),
DEF_CMD_ARG("-learn", unsetbridge_learn),
+ DEF_CMD_ARG("sticky", setbridge_sticky),
+ DEF_CMD_ARG("-sticky", unsetbridge_sticky),
DEF_CMD_ARG("span", setbridge_span),
DEF_CMD_ARG("-span", unsetbridge_span),
DEF_CMD_ARG("stp", setbridge_stp),
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 0221909..018a0fa 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1245,6 +1245,18 @@ This is the default for all interfaces added to a bridge.
Clear the
.Dq learning
attribute on a member interface.
+.It Cm sticky Ar interface
+Mark an interface as a
+.Dq sticky
+interface.
+Dynamically learned address entries are treated at static once entered into
+the cache.
+Sticky entries are never aged out of the cache or replaced, even if the
+address is seen on a different interface.
+.It Cm -sticky Ar interface
+Clear the
+.Dq sticky
+attribute on a member interface.
.It Cm span Ar interface
Add the interface named by
.Ar interface
OpenPOWER on IntegriCloud