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

Function in_gre_output

freebsd/netinet/ip_gre.c:528–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528int
529in_gre_output(struct mbuf *m, int af, int hlen)
530{
531 struct greip *gi;
532
533 gi = mtod(m, struct greip *);
534 switch (af) {
535 case AF_INET:
536 /*
537 * gre_transmit() has used M_PREPEND() that doesn't guarantee
538 * m_data is contiguous more than hlen bytes. Use m_copydata()
539 * here to avoid m_pullup().
540 */
541 m_copydata(m, hlen + offsetof(struct ip, ip_tos),
542 sizeof(u_char), &gi->gi_ip.ip_tos);
543 m_copydata(m, hlen + offsetof(struct ip, ip_id),
544 sizeof(u_short), (caddr_t)&gi->gi_ip.ip_id);
545 break;
546#ifdef INET6
547 case AF_INET6:
548 gi->gi_ip.ip_tos = 0; /* XXX */
549 ip_fillid(&gi->gi_ip);
550 break;
551#endif
552 }
553 gi->gi_ip.ip_ttl = V_ip_gre_ttl;
554 gi->gi_ip.ip_len = htons(m->m_pkthdr.len);
555 return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL));
556}
557
558static const struct srcaddrtab *ipv4_srcaddrtab = NULL;
559static const struct encaptab *ecookie = NULL;

Callers 1

gre_transmitFunction · 0.85

Calls 3

m_copydataFunction · 0.85
ip_fillidFunction · 0.85
ip_outputFunction · 0.85

Tested by

no test coverage detected