[chrony-dev] [PATCH v2] Set DSCP for IPv6. |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-dev] [PATCH v2] Set DSCP for IPv6.
- From: Mike Ryan <msr@xxxxxxxxxx>
- Date: Wed, 16 Nov 2022 09:13:09 -0500
- Cc: Mike Ryan <msr@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hsilop.net; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K8VykpT0wn+8rSRKRrGiZcuYXGMVoDQgE/A5TQBDx+o=; b=Ez421TStYtyUMwY2hXbvic9Pdl6IMs9GOAwsVeLw+bGuyYUwgWOErwDscrkqKuzGiS sHjBD1Ow6gQWwY3hBCydqibitrX2joeyqofGl7JeoKwMztzaNL7gKKi8bj1lpsb40a28 /5n9mw8BWRUVYNQqeAPIh8s29HYfsoGPlzdRfzWUJGzoymXTpv2lJvALCkBbam/jbFwi 9U2Gyhioh7bkabo3Dl6D0hyJYftnRH7Yt9XRypMT0i/evr1EZYGzrzn01d/CdSReHhSK Sau8g11YhZH06Lygsy9cB66ZRkT+dqjxYOCx+9Sn9yAWsfN64c6P+6fjuNJqgsGJNMiN +9fg==
Chrony's dscp setting currently applies to IPv4 only. This patch sets
the necessary option for IPv6 as well.
---
ntp_io.c | 10 ++++++++--
sys_linux.c | 3 +++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ntp_io.c b/ntp_io.c
index 86e3f26..ade3a0e 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 f2baab1..8e647e3 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 },
--
2.38.1
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.