Lines Matching refs:sc

300 	struct stf_softc	*sc = ifnet_softc(ifp);
302 sc->tap_mode = mode;
303 sc->tap_callback = callback;
311 struct stf_softc *sc;
323 sc = _MALLOC(sizeof(struct stf_softc), M_DEVBUF, M_WAITOK);
324 if (sc == 0) {
329 bzero(sc, sizeof(*sc));
332 &in_stf_protosw, sc);
335 FREE(sc, M_DEVBUF);
338 sc->encap_cookie = p;
339 lck_mtx_init(&sc->sc_ro_mtx, stf_mtx_grp, LCK_ATTR_NULL);
350 stf_init.softc = sc;
354 error = ifnet_allocate(&stf_init, &sc->sc_if);
357 encap_detach(sc->encap_cookie);
358 lck_mtx_destroy(&sc->sc_ro_mtx, stf_mtx_grp);
359 FREE(sc, M_DEVBUF);
362 ifnet_set_mtu(sc->sc_if, IPV6_MMTU);
363 ifnet_set_flags(sc->sc_if, 0, 0xffff); /* clear all flags */
366 ifnet_set_flags(sc->sc_if, IFF_LINK2, IFF_LINK2);
370 mac_ifnet_label_init(&sc->sc_if);
373 error = ifnet_attach(sc->sc_if, NULL);
376 encap_detach(sc->encap_cookie);
377 ifnet_release(sc->sc_if);
378 lck_mtx_destroy(&sc->sc_ro_mtx, stf_mtx_grp);
379 FREE(sc, M_DEVBUF);
383 bpfattach(sc->sc_if, DLT_NULL, sizeof(u_int));
397 struct stf_softc *sc;
400 sc = (struct stf_softc *)arg;
401 if (sc == NULL)
404 if ((ifnet_flags(sc->sc_if) & IFF_UP) == 0)
408 if ((ifnet_flags(sc->sc_if) & IFF_LINK0) != 0)
419 ia6 = stf_getsrcifa6(sc->sc_if);
519 struct stf_softc *sc;
530 sc = ifnet_softc(ifp);
605 lck_mtx_lock(&sc->sc_ro_mtx);
606 dst4 = (struct sockaddr_in *)(void *)&sc->sc_ro.ro_dst;
613 if (sc->sc_ro.ro_rt) {
614 rtfree(sc->sc_ro.ro_rt);
615 sc->sc_ro.ro_rt = NULL;
619 result = ip_output_list(m, 0, NULL, &sc->sc_ro, IP_OUTARGS, NULL,
621 lck_mtx_unlock(&sc->sc_ro_mtx);
644 struct stf_softc *sc,
686 if (sc && (ifnet_flags(sc->sc_if) & IFF_LINK2) == 0 && inifp) {
700 "due to ingress filter\n", if_name(sc->sc_if),
718 struct stf_softc *sc,
726 return stf_checkaddr4(sc, GET_V4(in6), inifp);
745 struct stf_softc *sc;
763 sc = (struct stf_softc *)encap_getarg(m);
765 if (sc == NULL || (ifnet_flags(sc->sc_if) & IFF_UP) == 0) {
770 ifp = sc->sc_if;
780 if (stf_checkaddr4(sc, &ip->ip_dst, NULL) < 0 ||
781 stf_checkaddr4(sc, &ip->ip_src, m->m_pkthdr.rcvif) < 0) {
793 if (stf_checkaddr6(sc, &ip6.ip6_dst, NULL) < 0 ||
794 stf_checkaddr6(sc, &ip6.ip6_src, m->m_pkthdr.rcvif) < 0) {