diff options
author | glebius <glebius@FreeBSD.org> | 2012-10-16 13:37:54 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-10-16 13:37:54 +0000 |
commit | 05f24a6b77a43334f14f31cd33a4f3e34a418ea2 (patch) | |
tree | 0f54a9446bfe2083d3c0a3f744318b2be8a0db05 /sys/netpfil/ipfw/ip_fw_log.c | |
parent | 745884b065065ffc8847d3ea463bf751ffcaf863 (diff) | |
download | FreeBSD-src-05f24a6b77a43334f14f31cd33a4f3e34a418ea2.zip FreeBSD-src-05f24a6b77a43334f14f31cd33a4f3e34a418ea2.tar.gz |
Make the "struct if_clone" opaque to users of the cloning API. Users
now use function calls:
if_clone_simple()
if_clone_advanced()
to initialize a cloner, instead of macros that initialize if_clone
structure.
Discussed with: brooks, bz, 1 year ago
Diffstat (limited to 'sys/netpfil/ipfw/ip_fw_log.c')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_log.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_log.c b/sys/netpfil/ipfw/ip_fw_log.c index 3cbb5fa..c33e365 100644 --- a/sys/netpfil/ipfw/ip_fw_log.c +++ b/sys/netpfil/ipfw/ip_fw_log.c @@ -102,7 +102,7 @@ static struct rwlock log_if_lock; #define LOGIF_WLOCK(x) rw_wlock(&log_if_lock) #define LOGIF_WUNLOCK(x) rw_wunlock(&log_if_lock) -#define IPFWNAME "ipfw" +static const char ipfwname[] = "ipfw"; /* we use this dummy function for all ifnet callbacks */ static int @@ -133,7 +133,7 @@ static int ipfw_log_clone_match(struct if_clone *ifc, const char *name) { - return (strncmp(name, IPFWNAME, sizeof(IPFWNAME) - 1) == 0); + return (strncmp(name, ipfwname, sizeof(ipfwname) - 1) == 0); } static int @@ -157,9 +157,9 @@ ipfw_log_clone_create(struct if_clone *ifc, char *name, size_t len, ifc_free_unit(ifc, unit); return (ENOSPC); } - ifp->if_dname = IPFWNAME; + ifp->if_dname = ipfwname; ifp->if_dunit = unit; - snprintf(ifp->if_xname, IFNAMSIZ, "%s%d", IPFWNAME, unit); + snprintf(ifp->if_xname, IFNAMSIZ, "%s%d", ipfwname, unit); strlcpy(name, ifp->if_xname, len); ifp->if_mtu = 65536; ifp->if_flags = IFF_UP | IFF_SIMPLEX | IFF_MULTICAST; @@ -214,9 +214,7 @@ ipfw_log_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) return (0); } -static struct if_clone ipfw_log_cloner = IFC_CLONE_INITIALIZER( - IPFWNAME, NULL, IF_MAXUNIT, - NULL, ipfw_log_clone_match, ipfw_log_clone_create, ipfw_log_clone_destroy); +static struct if_clone *ipfw_log_cloner; void ipfw_log_bpf(int onoff) @@ -224,9 +222,11 @@ ipfw_log_bpf(int onoff) if (onoff) { LOGIF_LOCK_INIT(); - if_clone_attach(&ipfw_log_cloner); + ipfw_log_cloner = if_clone_advanced(ipfwname, 0, + ipfw_log_clone_match, ipfw_log_clone_create, + ipfw_log_clone_destroy); } else { - if_clone_detach(&ipfw_log_cloner); + if_clone_detach(ipfw_log_cloner); LOGIF_LOCK_DESTROY(); } } |