FreeBSD/sys/netinet6/ip6_input.c
/*
 * IPv6 direct input routine.
 *
 * This is called when reinjecting completed fragments where
 * all of the previous checking and book-keeping has been done.
 */
IPv6 direct input routine.
This is called when reinjecting completed fragments where
all of the previous checking and book-keeping has been done.
IPv6 direct input routine . This is called when reinjecting completed fragments where all of the previous checking and book - keeping has been done .
void
ip6_direct_input(struct mbuf *m)
{
	int off, nxt;
	int nest;
	struct m_tag *mtag;
	struct ip6_direct_ctx *ip6dc;
	mtag = m_tag_locate(m, MTAG_ABI_IPV6, IPV6_TAG_DIRECT, NULL);
	KASSERT(mtag != NULL, ("Reinjected packet w/o direct ctx tag!"));
	ip6dc = (struct ip6_direct_ctx *)(mtag + 1);
	nxt = ip6dc->ip6dc_nxt;
	off = ip6dc->ip6dc_off;
	nest = 0;
	m_tag_delete(m, mtag);
	while (nxt != IPPROTO_DONE) {
		if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) {
			IP6STAT_INC(ip6s_toomanyhdr);
			goto bad;
		}
		if (m->m_pkthdr.len < off) {
			IP6STAT_INC(ip6s_tooshort);
			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);
			goto bad;
		}
#ifdef IPSEC
		if (ip6_ipsec_input(m, nxt))
			goto bad;
#endif 
		nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt);
	}
	return;
bad:
	m_freem(m);
}
void ip6_direct_input ( struct mbuf * m ) { int off , nxt ; int nest ; struct m_tag * mtag ; struct ip6_direct_ctx * ip6dc ; mtag = m_tag_locate ( m , MTAG_ABI_IPV6 , IPV6_TAG_DIRECT , NULL ) ; KASSERT ( mtag != NULL , ( " " ) ) ; ip6dc = ( struct ip6_direct_ctx * ) ( mtag + 1 ) ; nxt = ip6dc -> ip6dc_nxt ; off = ip6dc -> ip6dc_off ; nest = 0 ; m_tag_delete ( m , mtag ) ; while ( nxt != IPPROTO_DONE ) { if ( V_ip6_hdrnestlimit && ( ++ nest > V_ip6_hdrnestlimit ) ) { IP6STAT_INC ( ip6s_toomanyhdr ) ; goto bad ; } if ( m -> m_pkthdr . len < off ) { IP6STAT_INC ( ip6s_tooshort ) ; in6_ifstat_inc ( m -> m_pkthdr . rcvif , ifs6_in_truncated ) ; goto bad ; } #ifdef IPSEC if ( ip6_ipsec_input ( m , nxt ) ) goto bad ; #endif nxt = ( * inet6sw [ ip6_protox [ nxt ] ] . pr_input ) ( & m , & off , nxt ) ; } return ; bad : m_freem ( m ) ; }
IPv6 direct input routine.
IPv6 direct input routine .
/*
		 * protection against faulty packet - there should be
		 * more sanity checks in header chain processing.
		 */ /*
		 * enforce IPsec policy checking if we are seeing last header.
		 * note that we do not visit this with protocols with pcb layer
		 * code - like udp/tcp/raw ip.
		 */ /* IPSEC */