summaryrefslogtreecommitdiffstats
path: root/sys/contrib/pf/net
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2004-06-22 20:13:25 +0000
committerbrooks <brooks@FreeBSD.org>2004-06-22 20:13:25 +0000
commite1dd867b5532da103ae1459a89ca3df2b8b6f0f6 (patch)
treebebe9375487f298832806df2423be9c48dba04e6 /sys/contrib/pf/net
parentdd32b92c2514b98b8c9d9af7ac82532d833c6db2 (diff)
downloadFreeBSD-src-e1dd867b5532da103ae1459a89ca3df2b8b6f0f6.zip
FreeBSD-src-e1dd867b5532da103ae1459a89ca3df2b8b6f0f6.tar.gz
Major overhaul of pseudo-interface cloning. Highlights include:
- Split the code out into if_clone.[ch]. - Locked struct if_clone. [1] - Add a per-cloner match function rather then simply matching names of the form <name><unit> and <name>. - Use the match function to allow creation of <interface>.<tag> vlan interfaces. The old way is preserved unchanged! - Also the match function to allow creation of stf(4) interfaces named stf0, stf, or 6to4. This is the only major user visible change in that "ifconfig stf" creates the interface stf rather then stf0 and does not print "stf0" to stdout. - Allow destroy functions to fail so they can refuse to delete interfaces. Currently, we forbid the deletion of interfaces which were created in the init function, particularly lo0, pflog0, and pfsync0. In the case of lo0 this was a panic implementation so it does not count as a user visiable change. :-) - Since most interfaces do not need the new functionality, an family of wrapper functions, ifc_simple_*(), were created to wrap old style cloner functions. - The IF_CLONE_INITIALIZER macro is replaced with a new incompatible IFC_CLONE_INITIALIZER and ifc_simple consumers use IFC_SIMPLE_DECLARE instead. Submitted by: Maurycy Pawlowski-Wieronski <maurycy at fouk.org> [1] Reviewed by: andre, mlaier Discussed on: net
Diffstat (limited to 'sys/contrib/pf/net')
-rw-r--r--sys/contrib/pf/net/if_pflog.c6
-rw-r--r--sys/contrib/pf/net/if_pfsync.c6
-rw-r--r--sys/contrib/pf/net/pfvar.h1
3 files changed, 9 insertions, 4 deletions
diff --git a/sys/contrib/pf/net/if_pflog.c b/sys/contrib/pf/net/if_pflog.c
index 960f709..ee0ec79 100644
--- a/sys/contrib/pf/net/if_pflog.c
+++ b/sys/contrib/pf/net/if_pflog.c
@@ -63,6 +63,9 @@
#endif
#include <net/if.h>
+#if defined(__FreeBSD__)
+#include <net/if_clone.h>
+#endif
#include <net/if_types.h>
#include <net/route.h>
#include <net/bpf.h>
@@ -123,8 +126,7 @@ extern int ifqmaxlen;
#ifdef __FreeBSD__
static MALLOC_DEFINE(M_PFLOG, PFLOGNAME, "Packet Filter Logging Interface");
static LIST_HEAD(pflog_list, pflog_softc) pflog_list;
-struct if_clone pflog_cloner = IF_CLONE_INITIALIZER(PFLOGNAME,
- pflog_clone_create, pflog_clone_destroy, 1, IF_MAXUNIT);
+IFC_SIMPLE_DECLARE(pflog, 1);
static void
pflog_clone_destroy(struct ifnet *ifp)
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c
index 936479d..1fa2a1f 100644
--- a/sys/contrib/pf/net/if_pfsync.c
+++ b/sys/contrib/pf/net/if_pfsync.c
@@ -62,6 +62,9 @@
#endif
#include <net/if.h>
+#if defined(__FreeBSD__)
+#include <net/if_clone.h>
+#endif
#include <net/if_types.h>
#include <net/route.h>
#include <net/bpf.h>
@@ -148,8 +151,7 @@ extern int hz;
#ifdef __FreeBSD__
static MALLOC_DEFINE(M_PFSYNC, PFSYNCNAME, "Packet Filter State Sync. Interface");
static LIST_HEAD(pfsync_list, pfsync_softc) pfsync_list;
-struct if_clone pfsync_cloner = IF_CLONE_INITIALIZER(PFSYNCNAME,
- pfsync_clone_create, pfsync_clone_destroy, 1, IF_MAXUNIT);
+IFC_SIMPLE_DECLARE(pfsync, 1);
static void
pfsync_clone_destroy(struct ifnet *ifp)
diff --git a/sys/contrib/pf/net/pfvar.h b/sys/contrib/pf/net/pfvar.h
index a6c739a..af32857 100644
--- a/sys/contrib/pf/net/pfvar.h
+++ b/sys/contrib/pf/net/pfvar.h
@@ -40,6 +40,7 @@
#include <net/radix.h>
#ifdef __FreeBSD__
+#include <net/if_clone.h>
#include <vm/uma.h>
#else
#include <netinet/ip_ipsp.h>
OpenPOWER on IntegriCloud