aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2006-11-09 06:32:38 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2006-11-09 06:32:38 +0000
commit3df7fad0cfacfde79974d7963938924212aee329 (patch)
treecf54c5483f37944549b7a3563be875b05ec80027 /sbin
parentafe898bca2850b1aa5aece0e0a0b3826348dc775 (diff)
downloadsrc-3df7fad0cfacfde79974d7963938924212aee329.tar.gz
src-3df7fad0cfacfde79974d7963938924212aee329.zip
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.
Notes
Notes: svn path=/head/; revision=164112
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 3f708b2c2eb8..1100aab26b86 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 0221909bc605..018a0fae7650 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