From a9b022ab6561a599640f315e3f9f37c92c9d72ed Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 11 Feb 2020 21:58:59 +0000 Subject: [PATCH] Allow empty server spec in --rev-server, to match --server. --- CHANGELOG | 2 ++ man/dnsmasq.8 | 2 +- src/option.c | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5c3b13d..236de2b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,6 +80,8 @@ version 2.81 Add filtering by tag of --dhcp-host directives. Based on a patch by Harald Jensås. + + Allow empty server spec in --rev-server, to match --server. version 2.80 diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index 6cbff1e..d5b4c25 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -484,7 +484,7 @@ source address specified but the port may be specified directly as part of the source address. Forcing queries to an interface is not implemented on all platforms supported by dnsmasq. .TP -.B --rev-server=/,[#][@|[#]] +.B --rev-server=/[,][#][@|[#]] This is functionally the same as .B --server, but provides some syntactic sugar to make specifying address-to-name queries easier. For example diff --git a/src/option.c b/src/option.c index 07bb52a..853fd26 100644 --- a/src/option.c +++ b/src/option.c @@ -2618,9 +2618,14 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma struct in6_addr addr6; unhide_metas(arg); - if (!arg || !(comma=split(arg)) || !(string = split_chr(arg, '/')) || !atoi_check(string, &size)) + if (!arg) ret_err(gen_err); + + comma=split(arg); + if (!(string = split_chr(arg, '/')) || !atoi_check(string, &size)) + ret_err(gen_err); + if (inet_pton(AF_INET, arg, &addr4)) { serv = add_rev4(addr4, size);