summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-03-02 13:33:54 +0100
committerGitHub <noreply@github.com>2018-03-02 13:33:54 +0100
commita478fb9229bf10e500bc69df361fed607b0732b7 (patch)
tree3bcc2ad031b72935ad4b870a18436cf7b12d0c2d
parentman: there's no point in referenceing systemd.unit(5) from itself (#8338) (diff)
parentresolved: debug log about resolv.conf lines we don't grok (diff)
downloadsystemd-a478fb9229bf10e500bc69df361fed607b0732b7.tar.xz
systemd-a478fb9229bf10e500bc69df361fed607b0732b7.zip
Merge pull request #8337 from poettering/resolve-fixes
various resolve-tool fixes
-rw-r--r--man/systemd-resolve.xml30
-rw-r--r--src/resolve/resolve-tool.c24
-rw-r--r--src/resolve/resolved-resolv-conf.c7
3 files changed, 48 insertions, 13 deletions
diff --git a/man/systemd-resolve.xml b/man/systemd-resolve.xml
index f9240905535..fd5e35954a4 100644
--- a/man/systemd-resolve.xml
+++ b/man/systemd-resolve.xml
@@ -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>
diff --git a/src/resolve/resolve-tool.c b/src/resolve/resolve-tool.c
index 2a6bf94070f..d4aac244be9 100644
--- a/src/resolve/resolve-tool.c
+++ b/src/resolve/resolve-tool.c
@@ -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.");
diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c
index bad04d6a29d..c828e9201f7 100644
--- a/src/resolve/resolved-resolv-conf.c
+++ b/src/resolve/resolved-resolv-conf.c
@@ -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);