diff options
author | brooks <brooks@FreeBSD.org> | 2004-04-19 05:06:27 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2004-04-19 05:06:27 +0000 |
commit | 3d1134df291d4530fc47d0a28f88d951986e6a4c (patch) | |
tree | f6b1f9ed53b801c708dd6a4769996147770d5ec1 /sys/net/if_stf.c | |
parent | f08c4f4965b58215497b91ce676edf455e098e4e (diff) | |
download | FreeBSD-src-3d1134df291d4530fc47d0a28f88d951986e6a4c.zip FreeBSD-src-3d1134df291d4530fc47d0a28f88d951986e6a4c.tar.gz |
Use an tempory struct ifnet *ifp instead of sc->sc_if to access the
ifnet in stf_clone_create. Also use if_printf() instead of printf().
Diffstat (limited to 'sys/net/if_stf.c')
-rw-r--r-- | sys/net/if_stf.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index fb6d6fe..d3f590f 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -185,25 +185,27 @@ stf_clone_create(ifc, unit) int unit; { struct stf_softc *sc; + struct ifnet *ifp; sc = malloc(sizeof(struct stf_softc), M_STF, M_WAITOK | M_ZERO); - if_initname(&sc->sc_if, ifc->ifc_name, unit); + ifp = &sc->sc_if; + if_initname(ifp, ifc->ifc_name, unit); sc->encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV6, stf_encapcheck, &in_stf_protosw, sc); if (sc->encap_cookie == NULL) { - printf("%s: attach failed\n", if_name(&sc->sc_if)); + if_printf(ifp, "attach failed\n"); free(sc, M_STF); return (ENOMEM); } - sc->sc_if.if_mtu = IPV6_MMTU; - sc->sc_if.if_ioctl = stf_ioctl; - sc->sc_if.if_output = stf_output; - sc->sc_if.if_type = IFT_STF; - sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN; - if_attach(&sc->sc_if); - bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int)); + ifp->if_mtu = IPV6_MMTU; + ifp->if_ioctl = stf_ioctl; + ifp->if_output = stf_output; + ifp->if_type = IFT_STF; + ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + if_attach(ifp); + bpfattach(ifp, DLT_NULL, sizeof(u_int)); mtx_lock(&stf_mtx); LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list); mtx_unlock(&stf_mtx); |