| 608 | } |
| 609 | |
| 610 | static int |
| 611 | in_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 |
nothing calls this directly
no test coverage detected