mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 19:25:07 -05:00
Add dns command to configure DNS resolving in chronyc
This commit is contained in:
25
client.c
25
client.c
@@ -2238,6 +2238,28 @@ process_cmd_activity(const char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int
|
||||
process_cmd_dns(const char *line)
|
||||
{
|
||||
if (!strncmp(line, "-46", 3)) {
|
||||
DNS_SetAddressFamily(IPADDR_UNSPEC);
|
||||
} else if (!strncmp(line, "-4", 2)) {
|
||||
DNS_SetAddressFamily(IPADDR_INET4);
|
||||
} else if (!strncmp(line, "-6", 2)) {
|
||||
DNS_SetAddressFamily(IPADDR_INET6);
|
||||
} else if (!strncmp(line, "-n", 2)) {
|
||||
no_dns = 1;
|
||||
} else if (!strncmp(line, "+n", 2)) {
|
||||
no_dns = 0;
|
||||
} else {
|
||||
fprintf(stderr, "Unrecognized dns command\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int
|
||||
process_line(char *line, int *quit)
|
||||
{
|
||||
@@ -2351,6 +2373,9 @@ process_line(char *line, int *quit)
|
||||
} else if (!strncmp(p, "activity", 8)) {
|
||||
ret = process_cmd_activity(p+8);
|
||||
do_normal_submit = 0;
|
||||
} else if (!strncmp(p, "dns ", 4)) {
|
||||
ret = process_cmd_dns(p+4);
|
||||
do_normal_submit = 0;
|
||||
} else if (!strncmp(p, "help", 4)) {
|
||||
do_normal_submit = 0;
|
||||
give_help();
|
||||
|
||||
Reference in New Issue
Block a user