mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:45:07 -05:00
ntp: set DSCP for IPv6
Chrony's dscp setting currently applies to IPv4 only. This patch sets the necessary option for IPv6 as well.
This commit is contained in:
committed by
Miroslav Lichvar
parent
e789b0817f
commit
8901293be8
6
ntp_io.c
6
ntp_io.c
@@ -126,8 +126,14 @@ open_socket(int family, int local_port, int client_only, IPSockAddr *remote_addr
|
|||||||
dscp = CNF_GetNtpDscp();
|
dscp = CNF_GetNtpDscp();
|
||||||
if (dscp > 0 && dscp < 64) {
|
if (dscp > 0 && dscp < 64) {
|
||||||
#ifdef IP_TOS
|
#ifdef IP_TOS
|
||||||
|
if (family == IPADDR_INET4)
|
||||||
if (!SCK_SetIntOption(sock_fd, IPPROTO_IP, IP_TOS, dscp << 2))
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -633,6 +633,9 @@ SYS_Linux_EnableSystemCallFilter(int level, SYS_ProcessContext context)
|
|||||||
{ SOL_IP, IP_PKTINFO }, { SOL_IP, IP_FREEBIND }, { SOL_IP, IP_TOS },
|
{ SOL_IP, IP_PKTINFO }, { SOL_IP, IP_FREEBIND }, { SOL_IP, IP_TOS },
|
||||||
#ifdef FEAT_IPV6
|
#ifdef FEAT_IPV6
|
||||||
{ SOL_IPV6, IPV6_V6ONLY }, { SOL_IPV6, IPV6_RECVPKTINFO },
|
{ SOL_IPV6, IPV6_V6ONLY }, { SOL_IPV6, IPV6_RECVPKTINFO },
|
||||||
|
#ifdef IPV6_TCLASS
|
||||||
|
{ SOL_IPV6, IPV6_TCLASS },
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef SO_BINDTODEVICE
|
#ifdef SO_BINDTODEVICE
|
||||||
{ SOL_SOCKET, SO_BINDTODEVICE },
|
{ SOL_SOCKET, SO_BINDTODEVICE },
|
||||||
|
|||||||
Reference in New Issue
Block a user