* Strip out IP options, at higher level protocol in the kernel. */
| 480 | * Strip out IP options, at higher level protocol in the kernel. |
| 481 | */ |
| 482 | void |
| 483 | ip_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 |
no outgoing calls
no test coverage detected