| 530 | #endif |
| 531 | |
| 532 | void |
| 533 | ip6_input(struct mbuf *m) |
| 534 | { |
| 535 | struct in6_addr odst; |
| 536 | struct ip6_hdr *ip6; |
| 537 | struct in6_ifaddr *ia; |
| 538 | struct ifnet *rcvif; |
| 539 | u_int32_t plen; |
| 540 | u_int32_t rtalert = ~0; |
| 541 | int off = sizeof(struct ip6_hdr), nest; |
| 542 | int nxt, ours = 0; |
| 543 | int srcrt = 0; |
| 544 | |
| 545 | /* |
| 546 | * Drop the packet if IPv6 operation is disabled on the interface. |
| 547 | */ |
| 548 | rcvif = m->m_pkthdr.rcvif; |
| 549 | if ((ND_IFINFO(rcvif)->flags & ND6_IFF_IFDISABLED)) |
| 550 | goto bad; |
| 551 | |
| 552 | #if defined(IPSEC) || defined(IPSEC_SUPPORT) |
| 553 | /* |
| 554 | * should the inner packet be considered authentic? |
| 555 | * see comment in ah4_input(). |
| 556 | * NB: m cannot be NULL when passed to the input routine |
| 557 | */ |
| 558 | |
| 559 | m->m_flags &= ~M_AUTHIPHDR; |
| 560 | m->m_flags &= ~M_AUTHIPDGM; |
| 561 | |
| 562 | #endif /* IPSEC */ |
| 563 | |
| 564 | if (m->m_flags & M_FASTFWD_OURS) { |
| 565 | /* |
| 566 | * Firewall changed destination to local. |
| 567 | */ |
| 568 | ip6 = mtod(m, struct ip6_hdr *); |
| 569 | goto passin; |
| 570 | } |
| 571 | |
| 572 | /* |
| 573 | * mbuf statistics |
| 574 | */ |
| 575 | if (m->m_flags & M_EXT) { |
| 576 | if (m->m_next) |
| 577 | IP6STAT_INC(ip6s_mext2m); |
| 578 | else |
| 579 | IP6STAT_INC(ip6s_mext1); |
| 580 | } else { |
| 581 | if (m->m_next) { |
| 582 | if (m->m_flags & M_LOOP) { |
| 583 | IP6STAT_INC(ip6s_m2m[V_loif->if_index]); |
| 584 | } else if (rcvif->if_index < IP6S_M2MMAX) |
| 585 | IP6STAT_INC(ip6s_m2m[rcvif->if_index]); |
| 586 | else |
| 587 | IP6STAT_INC(ip6s_m2m[0]); |
| 588 | } else |
| 589 | IP6STAT_INC(ip6s_m1); |
no test coverage detected