| 526 | } |
| 527 | |
| 528 | int |
| 529 | in_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 | |
| 558 | static const struct srcaddrtab *ipv4_srcaddrtab = NULL; |
| 559 | static const struct encaptab *ecookie = NULL; |
no test coverage detected