MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_stf_input

Function in_stf_input

freebsd/net/if_stf.c:610–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610static int
611in_stf_input(struct mbuf *m, int off, int proto, void *arg)
612{
613 struct stf_softc *sc = arg;
614 struct ip *ip;
615 struct ip6_hdr *ip6;
616 u_int8_t otos, itos;
617 struct ifnet *ifp;
618
619 NET_EPOCH_ASSERT();
620
621 if (proto != IPPROTO_IPV6) {
622 m_freem(m);
623 return (IPPROTO_DONE);
624 }
625
626 ip = mtod(m, struct ip *);
627 if (sc == NULL || (STF2IFP(sc)->if_flags & IFF_UP) == 0) {
628 m_freem(m);
629 return (IPPROTO_DONE);
630 }
631
632 ifp = STF2IFP(sc);
633
634#ifdef MAC
635 mac_ifnet_create_mbuf(ifp, m);
636#endif
637
638 /*
639 * perform sanity check against outer src/dst.
640 * for source, perform ingress filter as well.
641 */
642 if (stf_checkaddr4(sc, &ip->ip_dst, NULL) < 0 ||
643 stf_checkaddr4(sc, &ip->ip_src, m->m_pkthdr.rcvif) < 0) {
644 m_freem(m);
645 return (IPPROTO_DONE);
646 }
647
648 otos = ip->ip_tos;
649 m_adj(m, off);
650
651 if (m->m_len < sizeof(*ip6)) {
652 m = m_pullup(m, sizeof(*ip6));
653 if (!m)
654 return (IPPROTO_DONE);
655 }
656 ip6 = mtod(m, struct ip6_hdr *);
657
658 /*
659 * perform sanity check against inner src/dst.
660 * for source, perform ingress filter as well.
661 */
662 if (stf_checkaddr6(sc, &ip6->ip6_dst, NULL) < 0 ||
663 stf_checkaddr6(sc, &ip6->ip6_src, m->m_pkthdr.rcvif) < 0) {
664 m_freem(m);
665 return (IPPROTO_DONE);
666 }
667

Callers

nothing calls this directly

Calls 11

mac_ifnet_create_mbufFunction · 0.85
stf_checkaddr4Function · 0.85
m_adjFunction · 0.85
m_pullupFunction · 0.85
stf_checkaddr6Function · 0.85
ip_ecn_egressFunction · 0.85
bpf_mtap2Function · 0.85
if_inc_counterFunction · 0.85
netisr_dispatchFunction · 0.85
bpf_peers_presentFunction · 0.70
m_freemFunction · 0.50

Tested by

no test coverage detected