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

Function save_rte

freebsd/netinet/ip_options.c:398–418  ·  view source on GitHub ↗

* Save incoming source route for use in replies, to be picked up later by * ip_srcroute if the receiver is interested. */

Source from the content-addressed store, hash-verified

396 * ip_srcroute if the receiver is interested.
397 */
398static void
399save_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

Callers 1

ip_dooptionsFunction · 0.85

Calls 3

m_tag_getFunction · 0.50
m_tag_freeFunction · 0.50
m_tag_prependFunction · 0.50

Tested by

no test coverage detected