UDP proxying should track and decrement TTL
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 437
Description
When UDP proxying from A-B it's really unfortunate when bad or misconfigured hardware ends up routing your packets in a loop. Decrementing TTL means you don't end up with that loop being infinite and destroying your CPU.
useful kernel options:
setsockopt(fd, IPPROTO_IP, IP_RECVTTL, &get_ttl, sizeof(get_ttl));
setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &get_ttl,
sizeof(get_ttl));
kMinCmsgSpaceForRead += CMSG_SPACE(sizeof(int)) // TTL
if ((cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TTL) ||
(cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_HOPLIMIT)) {
ttl = reinterpret_cast(CMSG_DATA(cmsg))));
}
Contributor guide
Assessment
This issue has not been assessed yet.