Lines Matching defs:sc

301 	struct stf_softc	*sc = ifnet_softc(ifp);
303 sc->tap_mode = mode;
304 sc->tap_callback = callback;
312 struct stf_softc *sc;
324 sc = _MALLOC(sizeof(struct stf_softc), M_DEVBUF, M_WAITOK);
325 if (sc == 0) {
330 bzero(sc, sizeof(*sc));
333 &in_stf_protosw, sc);
336 FREE(sc, M_DEVBUF);
339 sc->encap_cookie = p;
340 lck_mtx_init(&sc->sc_ro_mtx, stf_mtx_grp, LCK_ATTR_NULL);
351 stf_init.softc = sc;
355 error = ifnet_allocate(&stf_init, &sc->sc_if);
358 encap_detach(sc->encap_cookie);
359 lck_mtx_destroy(&sc->sc_ro_mtx, stf_mtx_grp);
360 FREE(sc, M_DEVBUF);
363 ifnet_set_mtu(sc->sc_if, IPV6_MMTU);
364 ifnet_set_flags(sc->sc_if, 0, 0xffff); /* clear all flags */
367 ifnet_set_flags(sc->sc_if, IFF_LINK2, IFF_LINK2);
371 mac_ifnet_label_init(&sc->sc_if);
374 error = ifnet_attach(sc->sc_if, NULL);
377 encap_detach(sc->encap_cookie);
378 ifnet_release(sc->sc_if);
379 lck_mtx_destroy(&sc->sc_ro_mtx, stf_mtx_grp);
380 FREE(sc, M_DEVBUF);
384 bpfattach(sc->sc_if, DLT_NULL, sizeof(u_int));
398 struct stf_softc *sc;
401 sc = (struct stf_softc *)arg;
402 if (sc == NULL)
405 if ((ifnet_flags(sc->sc_if) & IFF_UP) == 0)
409 if ((ifnet_flags(sc->sc_if) & IFF_LINK0) != 0)
420 ia6 = stf_getsrcifa6(sc->sc_if);
520 struct stf_softc *sc;
532 sc = ifnet_softc(ifp);
607 lck_mtx_lock(&sc->sc_ro_mtx);
608 dst4 = (struct sockaddr_in *)(void *)&sc->sc_ro.ro_dst;
609 if (ROUTE_UNUSABLE(&sc->sc_ro) || dst4->sin_family != AF_INET ||
611 ROUTE_RELEASE(&sc->sc_ro);
618 result = ip_output(m, NULL, &sc->sc_ro, IP_OUTARGS, NULL, &ipoa);
619 lck_mtx_unlock(&sc->sc_ro_mtx);
642 struct stf_softc *sc,
684 if (sc && (ifnet_flags(sc->sc_if) & IFF_LINK2) == 0 && inifp) {
698 "due to ingress filter\n", if_name(sc->sc_if),
716 struct stf_softc *sc,
724 return stf_checkaddr4(sc, GET_V4(in6), inifp);
743 struct stf_softc *sc;
761 sc = (struct stf_softc *)encap_getarg(m);
763 if (sc == NULL || (ifnet_flags(sc->sc_if) & IFF_UP) == 0) {
768 ifp = sc->sc_if;
778 if (stf_checkaddr4(sc, &ip->ip_dst, NULL) < 0 ||
779 stf_checkaddr4(sc, &ip->ip_src, m->m_pkthdr.rcvif) < 0) {
791 if (stf_checkaddr6(sc, &ip6.ip6_dst, NULL) < 0 ||
792 stf_checkaddr6(sc, &ip6.ip6_src, m->m_pkthdr.rcvif) < 0) {