summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifbridge.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2007-08-01 00:33:52 +0000
committerthompsa <thompsa@FreeBSD.org>2007-08-01 00:33:52 +0000
commitaa0911f2041ef5f70ebe1165b72029c30c030427 (patch)
tree5374e51582956994e2fe77a4be88a5b6059ab5f0 /sbin/ifconfig/ifbridge.c
parent465b2caeed873f769899aeb76aedc4d62b20a72e (diff)
downloadFreeBSD-src-aa0911f2041ef5f70ebe1165b72029c30c030427.zip
FreeBSD-src-aa0911f2041ef5f70ebe1165b72029c30c030427.tar.gz
Add a bridge interface flag called PRIVATE where any private port can not
communicate with another private port. All unicast/broadcast/multicast layer2 traffic is blocked so it works much the same way as using firewall rules but scales better and is generally easier as firewall packages usually do not allow ARP blocking. An example usage would be having a number of customers on separate vlans bridged with a server network. All the vlans are marked private, they can all communicate with the server network unhindered, but can not exchange any traffic whatsoever with each other. Approved by: re (rwatson)
Diffstat (limited to 'sbin/ifconfig/ifbridge.c')
-rw-r--r--sbin/ifconfig/ifbridge.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index 72fd491..d8176a8 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -665,6 +665,20 @@ setbridge_timeout(const char *arg, int d, int s, const struct afswtch *afp)
err(1, "BRDGSTO %s", arg);
}
+static void
+setbridge_private(const char *val, int d, int s, const struct afswtch *afp)
+{
+
+ do_bridgeflag(s, val, IFBIF_PRIVATE, 1);
+}
+
+static void
+unsetbridge_private(const char *val, int d, int s, const struct afswtch *afp)
+{
+
+ do_bridgeflag(s, val, IFBIF_PRIVATE, 0);
+}
+
static struct cmd bridge_cmds[] = {
DEF_CMD_ARG("addm", setbridge_add),
DEF_CMD_ARG("deletem", setbridge_delete),
@@ -701,6 +715,8 @@ static struct cmd bridge_cmds[] = {
DEF_CMD_ARG2("ifpriority", setbridge_ifpriority),
DEF_CMD_ARG2("ifpathcost", setbridge_ifpathcost),
DEF_CMD_ARG("timeout", setbridge_timeout),
+ DEF_CMD_ARG("private", setbridge_private),
+ DEF_CMD_ARG("-private", unsetbridge_private),
};
static struct afswtch af_bridge = {
.af_name = "af_bridge",
OpenPOWER on IntegriCloud