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/net/if_stf.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/net/if_stf.c')
-rw-r--r-- | sys/net/if_stf.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index b19c855..90dac40 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -127,7 +127,6 @@ static int stf_route_cache = 1; SYSCTL_INT(_net_link_stf, OID_AUTO, route_cache, CTLFLAG_RW, &stf_route_cache, 0, "Caching of IPv4 routes for 6to4 Output"); -#define STFNAME "stf" #define STFUNIT 0 #define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002) @@ -151,11 +150,13 @@ struct stf_softc { }; #define STF2IFP(sc) ((sc)->sc_ifp) +static const char stfname[] = "stf"; + /* * Note that mutable fields in the softc are not currently locked. * We do lock sc_ro in stf_output though. */ -static MALLOC_DEFINE(M_STF, STFNAME, "6to4 Tunnel Interface"); +static MALLOC_DEFINE(M_STF, stfname, "6to4 Tunnel Interface"); static const int ip_stf_ttl = 40; extern struct domain inetdomain; @@ -188,8 +189,7 @@ static int stf_ioctl(struct ifnet *, u_long, caddr_t); static int stf_clone_match(struct if_clone *, const char *); static int stf_clone_create(struct if_clone *, char *, size_t, caddr_t); static int stf_clone_destroy(struct if_clone *, struct ifnet *); -struct if_clone stf_cloner = IFC_CLONE_INITIALIZER(STFNAME, NULL, 0, - NULL, stf_clone_match, stf_clone_create, stf_clone_destroy); +static struct if_clone *stf_cloner; static int stf_clone_match(struct if_clone *ifc, const char *name) @@ -236,7 +236,7 @@ stf_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) * we don't conform to the default naming convention for interfaces. */ strlcpy(ifp->if_xname, name, IFNAMSIZ); - ifp->if_dname = ifc->ifc_name; + ifp->if_dname = stfname; ifp->if_dunit = IF_DUNIT_NONE; mtx_init(&(sc)->sc_ro_mtx, "stf ro", NULL, MTX_DEF); @@ -286,10 +286,11 @@ stfmodevent(mod, type, data) switch (type) { case MOD_LOAD: - if_clone_attach(&stf_cloner); + stf_cloner = if_clone_advanced(stfname, 0, stf_clone_match, + stf_clone_create, stf_clone_destroy); break; case MOD_UNLOAD: - if_clone_detach(&stf_cloner); + if_clone_detach(stf_cloner); break; default: return (EOPNOTSUPP); |