mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
Merge pull request #8337 from poettering/resolve-fixes
various resolve-tool fixes
This commit is contained in:
commit
a478fb9229
@ -104,6 +104,36 @@
|
||||
<command> --reset-statistics</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>systemd-resolve</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<command> --flush-caches</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>systemd-resolve</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<command> --reset-server-features</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>systemd-resolve</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<command> --status</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>systemd-resolve</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<command> --set-dns=<replaceable>SERVER</replaceable></command> <command> --set-domain=<replaceable>DOMAIN</replaceable> --set-llmnr=<replaceable>MODE</replaceable> --set-mdns=<replaceable>MODE</replaceable> --set-dnssec=<replaceable>MODE</replaceable> --set-nta=<replaceable>DOMAIN</replaceable></command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>systemd-resolve</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<command> --revert</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
|
@ -88,7 +88,7 @@ static char *arg_set_dnssec = NULL;
|
||||
static char **arg_set_nta = NULL;
|
||||
|
||||
static ServiceFamily service_family_from_string(const char *s) {
|
||||
if (s == NULL || streq(s, "tcp"))
|
||||
if (!s || streq(s, "tcp"))
|
||||
return SERVICE_FAMILY_TCP;
|
||||
if (streq(s, "udp"))
|
||||
return SERVICE_FAMILY_UDP;
|
||||
@ -1940,12 +1940,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
arg_family = AF_INET6;
|
||||
break;
|
||||
|
||||
case 'i': {
|
||||
int ifi;
|
||||
case 'i':
|
||||
if (parse_ifindex(optarg, &arg_ifindex) < 0) {
|
||||
int ifi;
|
||||
|
||||
if (parse_ifindex(optarg, &ifi) >= 0)
|
||||
arg_ifindex = ifi;
|
||||
else {
|
||||
ifi = if_nametoindex(optarg);
|
||||
if (ifi <= 0)
|
||||
return log_error_errno(errno, "Unknown interface %s: %m", optarg);
|
||||
@ -1954,7 +1952,6 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 't':
|
||||
if (streq(optarg, "help")) {
|
||||
@ -2134,8 +2131,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
r = dns_name_is_valid(p);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to validate specified domain %s: %m", p);
|
||||
if (r == 0)
|
||||
return log_error_errno(r, "Domain not valid: %s", p);
|
||||
if (r == 0) {
|
||||
log_error("Domain not valid: %s", p);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = strv_extend(&arg_set_domain, optarg);
|
||||
if (r < 0)
|
||||
@ -2173,8 +2172,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
r = dns_name_is_valid(optarg);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to validate specified domain %s: %m", optarg);
|
||||
if (r == 0)
|
||||
return log_error_errno(r, "Domain not valid: %s", optarg);
|
||||
if (r == 0) {
|
||||
log_error("Domain not valid: %s", optarg);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = strv_extend(&arg_set_nta, optarg);
|
||||
if (r < 0)
|
||||
@ -2415,7 +2416,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case MODE_SET_LINK:
|
||||
if (argc > optind) {
|
||||
log_error("Too many arguments.");
|
||||
|
@ -68,6 +68,7 @@ int manager_read_resolv_conf(Manager *m) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
struct stat st;
|
||||
char line[LINE_MAX];
|
||||
unsigned n = 0;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
@ -118,8 +119,10 @@ int manager_read_resolv_conf(Manager *m) {
|
||||
const char *a;
|
||||
char *l;
|
||||
|
||||
n++;
|
||||
|
||||
l = strstrip(line);
|
||||
if (IN_SET(*l, '#', ';'))
|
||||
if (IN_SET(*l, '#', ';', 0))
|
||||
continue;
|
||||
|
||||
a = first_word(l, "nameserver");
|
||||
@ -139,6 +142,8 @@ int manager_read_resolv_conf(Manager *m) {
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse search domain string '%s', ignoring.", a);
|
||||
}
|
||||
|
||||
log_syntax(NULL, LOG_DEBUG, "/etc/resolv.conf", n, 0, "Ignoring resolv.conf line: %s", l);
|
||||
}
|
||||
|
||||
m->resolv_conf_mtime = timespec_load(&st.st_mtim);
|
||||
|
Loading…
x
Reference in New Issue
Block a user