diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index eb7f76f..d4b4322 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -199,7 +199,12 @@ or .B --listen-address configuration, indeed .B --auth-server -will overide these and provide a different DNS service on the specified interface. The is the "glue record". It should resolve in the global DNS to a A and/or AAAA record which points to the address dnsmasq is listening on. +will overide these and provide a different DNS service on the +specified interface. The is the "glue record". It should +resolve in the global DNS to a A and/or AAAA record which points to +the address dnsmasq is listening on. When an interface is specified, +it may be qualified with "/4" or "/6" to specify only the IPv4 or IPv6 +addresses associated with the interface. .TP .B \-2, --no-dhcp-interface= Do not provide DHCP or TFTP on the specified interface, but do provide DNS service. diff --git a/src/network.c b/src/network.c index 3515a52..51d9d53 100644 --- a/src/network.c +++ b/src/network.c @@ -159,7 +159,8 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth) for (tmp = daemon->authinterface; tmp; tmp = tmp->next) if (tmp->name) { - if (strcmp(tmp->name, name) == 0) + if (strcmp(tmp->name, name) == 0 && + (tmp->addr.sa.sa_family == 0 || tmp->addr.sa.sa_family == family)) break; } else if (addr && tmp->addr.sa.sa_family == AF_INET && family == AF_INET && diff --git a/src/option.c b/src/option.c index ae5fad5..6ccf4b1 100644 --- a/src/option.c +++ b/src/option.c @@ -1615,8 +1615,22 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma new->addr.sa.sa_family = AF_INET6; #endif else - new->name = opt_string_alloc(arg); - + { + char *fam = split_chr(arg, '/'); + new->name = opt_string_alloc(arg); + new->addr.sa.sa_family = 0; + if (fam) + { + if (strcmp(fam, "4") == 0) + new->addr.sa.sa_family = AF_INET; +#ifdef HAVE_IPV6 + else if (strcmp(fam, "6") == 0) + new->addr.sa.sa_family = AF_INET6; +#endif + else + ret_err(gen_err); + } + } new->next = daemon->authinterface; daemon->authinterface = new;