mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
conf: add dscp directive
The directive sets the DSCP value in transmitted NTP packets, which can be useful in local networks where switches/routers are configured to prioritise packets with specific DSCP values.
This commit is contained in:
10
ntp_io.c
10
ntp_io.c
@@ -83,7 +83,7 @@ static void read_from_socket(int sock_fd, int event, void *anything);
|
||||
static int
|
||||
open_socket(int family, int local_port, int client_only, IPSockAddr *remote_addr)
|
||||
{
|
||||
int sock_fd, sock_flags, events = SCH_FILE_INPUT;
|
||||
int sock_fd, sock_flags, dscp, events = SCH_FILE_INPUT;
|
||||
IPSockAddr local_addr;
|
||||
char *iface;
|
||||
|
||||
@@ -111,6 +111,14 @@ open_socket(int family, int local_port, int client_only, IPSockAddr *remote_addr
|
||||
return INVALID_SOCK_FD;
|
||||
}
|
||||
|
||||
dscp = CNF_GetNtpDscp();
|
||||
if (dscp > 0 && dscp < 64) {
|
||||
#ifdef IP_TOS
|
||||
if (!SCK_SetIntOption(sock_fd, IPPROTO_IP, IP_TOS, dscp << 2))
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!client_only && family == IPADDR_INET4 && local_addr.port > 0)
|
||||
bound_server_sock_fd4 = local_addr.ip_addr.addr.in4 != INADDR_ANY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user