aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_clone.c
diff options
context:
space:
mode:
authorMax Laier <mlaier@FreeBSD.org>2006-06-19 22:20:45 +0000
committerMax Laier <mlaier@FreeBSD.org>2006-06-19 22:20:45 +0000
commit0dad3f0e15122c6e8f3bab0515e51f6486a9860f (patch)
tree1d514a3c44a007d12f9a4007d15e7afe23180bb0 /sys/net/if_clone.c
parent343ed0a875f9f68c4c4f00d3cb82d8f6e35bffaa (diff)
downloadsrc-0dad3f0e15122c6e8f3bab0515e51f6486a9860f.tar.gz
src-0dad3f0e15122c6e8f3bab0515e51f6486a9860f.zip
Import interface groups from OpenBSD. This allows to group interfaces in
order to - for example - apply firewall rules to a whole group of interfaces. This is required for importing pf from OpenBSD 3.9 Obtained from: OpenBSD (with changes) Discussed on: -net (back in April)
Notes
Notes: svn path=/head/; revision=159781
Diffstat (limited to 'sys/net/if_clone.c')
-rw-r--r--sys/net/if_clone.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index 89d679d67922..aa2c21af7fa7 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -158,6 +158,8 @@ if_clone_createif(struct if_clone *ifc, char *name, size_t len)
if (ifp == NULL)
panic("%s: lookup failed for %s", __func__, name);
+ if_addgroup(ifp, ifc->ifc_name);
+
IF_CLONE_LOCK(ifc);
IFC_IFLIST_INSERT(ifc, ifp);
IF_CLONE_UNLOCK(ifc);
@@ -210,9 +212,13 @@ if_clone_destroyif(struct if_clone *ifc, struct ifnet *ifp)
IFC_IFLIST_REMOVE(ifc, ifp);
IF_CLONE_UNLOCK(ifc);
+ if_delgroup(ifp, ifc->ifc_name);
+
err = (*ifc->ifc_destroy)(ifc, ifp);
if (err != 0) {
+ if_addgroup(ifp, ifc->ifc_name);
+
IF_CLONE_LOCK(ifc);
IFC_IFLIST_INSERT(ifc, ifp);
IF_CLONE_UNLOCK(ifc);