From 3df7fad0cfacfde79974d7963938924212aee329 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Thu, 9 Nov 2006 06:32:38 +0000 Subject: 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. --- sbin/ifconfig/ifbridge.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sbin/ifconfig/ifbridge.c') 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 @@ -320,6 +320,20 @@ unsetbridge_learn(const char *val, int d, int s, const struct afswtch *afp) do_bridgeflag(s, val, IFBIF_LEARNING, 0); } +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) { @@ -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), -- cgit v1.2.3