MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip_stripoptions

Function ip_stripoptions

freebsd/netinet/ip_options.c:482–497  ·  view source on GitHub ↗

* Strip out IP options, at higher level protocol in the kernel. */

Source from the content-addressed store, hash-verified

480 * Strip out IP options, at higher level protocol in the kernel.
481 */
482void
483ip_stripoptions(struct mbuf *m)
484{
485 struct ip *ip = mtod(m, struct ip *);
486 int olen;
487
488 olen = (ip->ip_hl << 2) - sizeof(struct ip);
489 m->m_len -= olen;
490 if (m->m_flags & M_PKTHDR)
491 m->m_pkthdr.len -= olen;
492 ip->ip_len = htons(ntohs(ip->ip_len) - olen);
493 ip->ip_hl = sizeof(struct ip) >> 2;
494
495 bcopy((char *)ip + sizeof(struct ip) + olen, (ip + 1),
496 (size_t )(m->m_len - sizeof(struct ip)));
497}
498
499/*
500 * Insert IP options into preformed packet. Adjust IP destination as

Callers 4

udp_inputFunction · 0.85
tcp_inputFunction · 0.85
icmp_inputFunction · 0.85
icmp_reflectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected