Skip to content

Commit

Permalink
UDP: Set the "Don't Fragment" (DF) bit at IP layer for QUIC. (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
brbzull0 authored Dec 14, 2023
1 parent f600c16 commit d7dc8cb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/iocore/net/UnixUDPNet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,12 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr const *addr, int fd, int s
Dbg(dbg_ctl_udpnet, "setsockeopt for pktinfo failed");
goto Lerror;
}
#ifdef IP_MTU_DISCOVER
int probe = IP_PMTUDISC_PROBE; // Set DF but ignore Path MTU
if (safe_setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, &probe, sizeof(probe)) == -1) {
Dbg(dbg_ctl_udpnet, "setsockeopt for IP_MTU_DISCOVER failed");
}
#endif
} else if (addr->sa_family == AF_INET6) {
bool succeeded = false;
#ifdef IPV6_PKTINFO
Expand All @@ -1189,14 +1195,18 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr const *addr, int fd, int s
Dbg(dbg_ctl_udpnet, "setsockeopt for pktinfo failed");
goto Lerror;
}
#ifdef IPV6_MTU_DISCOVER
int probe = IPV6_PMTUDISC_PROBE; // Set DF but ignore Path MTU
if (safe_setsockopt(fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &probe, sizeof(probe)) == -1) {
Dbg(dbg_ctl_udpnet, "setsockeopt for IPV6_MTU_DISCOVER failed");
}
#endif
}

#ifdef SOL_UDP
if (G_udp_config.enable_gro) {
int gro = 1;
if (safe_setsockopt(fd, IPPROTO_UDP, UDP_GRO, (char *)&gro, sizeof(gro)) == 0) {
Dbg(dbg_ctl_udpnet, "setsockopt UDP_GRO ok");
} else {
if (safe_setsockopt(fd, IPPROTO_UDP, UDP_GRO, (char *)&gro, sizeof(gro)) == -1) {
Dbg(dbg_ctl_udpnet, "setsockopt UDP_GRO. errno=%d", errno);
}
}
Expand Down

0 comments on commit d7dc8cb

Please sign in to comment.