* Save incoming source route for use in replies, to be picked up later by * ip_srcroute if the receiver is interested. */
| 396 | * ip_srcroute if the receiver is interested. |
| 397 | */ |
| 398 | static void |
| 399 | save_rte(struct mbuf *m, u_char *option, struct in_addr dst) |
| 400 | { |
| 401 | unsigned olen; |
| 402 | struct ipopt_tag *opts; |
| 403 | |
| 404 | opts = (struct ipopt_tag *)m_tag_get(PACKET_TAG_IPOPTIONS, |
| 405 | sizeof(struct ipopt_tag), M_NOWAIT); |
| 406 | if (opts == NULL) |
| 407 | return; |
| 408 | |
| 409 | olen = option[IPOPT_OLEN]; |
| 410 | if (olen > sizeof(opts->ip_srcrt) - (1 + sizeof(dst))) { |
| 411 | m_tag_free((struct m_tag *)opts); |
| 412 | return; |
| 413 | } |
| 414 | bcopy(option, opts->ip_srcrt.srcopt, olen); |
| 415 | opts->ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); |
| 416 | opts->ip_srcrt.dst = dst; |
| 417 | m_tag_prepend(m, (struct m_tag *)opts); |
| 418 | } |
| 419 | |
| 420 | /* |
| 421 | * Retrieve incoming source route for use in replies, in the same form used |
no test coverage detected