diff options
author | Tom Gundersen <teg@jklm.no> | 2015-08-25 10:18:16 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-08-25 10:18:16 +0200 |
commit | dd42560795996c723d4631570b74ac644934ebd3 (patch) | |
tree | 3ec9674302692280b766ede94895a5344247667e /src/resolve-host | |
parent | 53496ca9adc383bd8aa28e8f75f1b21c2cc82b05 (diff) | |
parent | 9318cdd37467c3275fe72328a7a45986f57e6a7d (diff) |
Merge pull request #1023 from poettering/resolved-fixes
A variety of resolved fixes
Diffstat (limited to 'src/resolve-host')
-rw-r--r-- | src/resolve-host/resolve-host.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c index 4a7d1e3173..9847effb53 100644 --- a/src/resolve-host/resolve-host.c +++ b/src/resolve-host/resolve-host.c @@ -490,7 +490,7 @@ static int parse_argv(int argc, char *argv[]) { { "version", no_argument, NULL, ARG_VERSION }, { "type", required_argument, NULL, 't' }, { "class", required_argument, NULL, 'c' }, - { "legend", optional_argument, NULL, ARG_LEGEND }, + { "legend", optional_argument, NULL, ARG_LEGEND }, { "protocol", required_argument, NULL, 'p' }, {} }; @@ -520,11 +520,21 @@ static int parse_argv(int argc, char *argv[]) { arg_family = AF_INET6; break; - case 'i': - arg_ifindex = if_nametoindex(optarg); - if (arg_ifindex <= 0) - return log_error_errno(errno, "Unknown interfaces %s: %m", optarg); + case 'i': { + int ifi; + + if (safe_atoi(optarg, &ifi) >= 0 && ifi > 0) + arg_ifindex = ifi; + else { + ifi = if_nametoindex(optarg); + if (ifi <= 0) + return log_error_errno(errno, "Unknown interface %s: %m", optarg); + + arg_ifindex = ifi; + } + break; + } case 't': if (streq(optarg, "help")) { |