From: Mike Ryan Date: Wed, 16 Nov 2022 14:13:09 +0000 (-0500) Subject: ntp: set DSCP for IPv6 X-Git-Tag: 4.4-pre1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8901293be8b682227ccc180cab939a652e79e0f0;p=thirdparty%2Fchrony.git ntp: set DSCP for IPv6 Chrony's dscp setting currently applies to IPv4 only. This patch sets the necessary option for IPv6 as well. --- diff --git a/ntp_io.c b/ntp_io.c index 86e3f26c..ade3a0ef 100644 --- a/ntp_io.c +++ b/ntp_io.c @@ -126,8 +126,14 @@ open_socket(int family, int local_port, int client_only, IPSockAddr *remote_addr dscp = CNF_GetNtpDscp(); if (dscp > 0 && dscp < 64) { #ifdef IP_TOS - if (!SCK_SetIntOption(sock_fd, IPPROTO_IP, IP_TOS, dscp << 2)) - ; + if (family == IPADDR_INET4) + if (!SCK_SetIntOption(sock_fd, IPPROTO_IP, IP_TOS, dscp << 2)) + ; +#endif +#if defined(FEAT_IPV6) && defined(IPV6_TCLASS) + if (family == IPADDR_INET6) + if (!SCK_SetIntOption(sock_fd, IPPROTO_IPV6, IPV6_TCLASS, dscp << 2)) + ; #endif } diff --git a/sys_linux.c b/sys_linux.c index f2baab1f..8e647e33 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -633,6 +633,9 @@ SYS_Linux_EnableSystemCallFilter(int level, SYS_ProcessContext context) { SOL_IP, IP_PKTINFO }, { SOL_IP, IP_FREEBIND }, { SOL_IP, IP_TOS }, #ifdef FEAT_IPV6 { SOL_IPV6, IPV6_V6ONLY }, { SOL_IPV6, IPV6_RECVPKTINFO }, +#ifdef IPV6_TCLASS + { SOL_IPV6, IPV6_TCLASS }, +#endif #endif #ifdef SO_BINDTODEVICE { SOL_SOCKET, SO_BINDTODEVICE },