/* Do option processing on a datagram, possibly discarding it if bad options are encountered, or forwarding it if source-routed. Returns 1 if packet has been forwarded/freed, 0 if the packet should be processed further. Strip out IP options, at higher level protocol in the kernel. Second argument is buffer to which options will be moved, and return value is their length. (XXX) should be deleted; last arg currently ignored.  */
void ip_stripoptions(register struct mbuf *m, struct mbuf *mopt)
/* Do option processing on a datagram, possibly discarding it if bad options are encountered, or forwarding it if source-routed. Returns 1 if packet has been forwarded/freed, 0 if the packet should be processed further. Strip out IP options, at higher level protocol in the kernel. Second argument is buffer to which options will be moved, and return value is their length. (XXX) should be deleted; last arg currently ignored.  */
void ip_stripoptions(register struct mbuf *m, struct mbuf *mopt)
{
	register int i;
	struct ip *ip = mtod(m, struct ip *);
	register caddr_t opts;
	int olen;
	olen = (ip->ip_hl<<2) - sizeof (struct ip);
	opts = (caddr_t)(ip + 1);
	i = m->m_len - (sizeof (struct ip) + olen);
	memcpy(opts, opts  + olen, (unsigned)i);
	m->m_len -= olen;
	ip->ip_hl = sizeof(struct ip) >> 2;
}