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
This commit is contained in:
Cameron Gutman
2020-04-03 16:58:18 -07:00
parent 637cd52e96
commit d988023971
+3 -3
View File
@@ -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 */