FreeBSD/sys/netinet6/ip6_input.c
/*
 * get offset for the last header in the chain.  m will be kept untainted.
 */
get offset for the last header in the chain.  m will be kept untainted.
get offset for the last header in the chain . m will be kept untainted .
int
ip6_lasthdr(const struct mbuf *m, int off, int proto, int *nxtp)
{
	int newoff;
	int nxt;
	if (!nxtp) {
		nxt = -1;
		nxtp = &nxt;
	}
	while (1) {
		newoff = ip6_nexthdr(m, off, proto, nxtp);
		if (newoff < 0)
			return off;
		else if (newoff < off)
			return -1;	
		else if (newoff == off)
			return newoff;
		off = newoff;
		proto = *nxtp;
	}
}
int ip6_lasthdr ( const struct mbuf * m , int off , int proto , int * nxtp ) { int newoff ; int nxt ; if ( ! nxtp ) { nxt = -1 ; nxtp = & nxt ; } while ( 1 ) { newoff = ip6_nexthdr ( m , off , proto , nxtp ) ; if ( newoff < 0 ) return off ; else if ( newoff < off ) return -1 ; else if ( newoff == off ) return newoff ; off = newoff ; proto = * nxtp ; } }
get offset for the last header in the chain.
get offset for the last header in the chain .
/* invalid */