From d9880239717208a8d401a3cd77044e4e93a19800 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 3 Apr 2020 16:58:18 -0700 Subject: [PATCH] Use EF instead of CS7 for DSCP Some security guidelines recommend dropping CS7 tagged packets at the edge, since CS7 is reserved for network control. EF seems to be the standard for telephony applications and is fairly well preserved across the Internet per https://www.sciencedirect.com/science/article/pii/S0166531619300203 --- unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix.c b/unix.c index 4694149..183d6ae 100644 --- a/unix.c +++ b/unix.c @@ -327,17 +327,17 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) #else #ifdef IP_TOS // UNIX - IPv4 - value = 0xE0; // DSCP: CS7 + value = value ? 46 << 2 : 0; // DSCP: Expedited Forwarding result = setsockopt (socket, IPPROTO_IP, IP_TOS, (char *) & value, sizeof (int)); #endif #ifdef IPV6_TCLASS // UNIX - IPv6 - value = 0xE0; // DSCP: CS7 + value = value ? 46 << 2: 0; // DSCP: Expedited Forwarding result = setsockopt (socket, IPPROTO_IPV6, IPV6_TCLASS, (char *) & value, sizeof (int)); #endif #ifdef SO_PRIORITY // Linux - value = 6; // Max priority without NET_CAP_ADMIN + value = value ? 6 : 0; // Max priority without NET_CAP_ADMIN result = setsockopt (socket, SOL_SOCKET, SO_PRIORITY, (char *) & value, sizeof (int)); #endif #endif /* SO_NET_SERVICE_TYPE */