Commit f25e6c6d authored by Simon Kelley's avatar Simon Kelley

Support /4 and /6 suffixes in interface names in --auth-server

parent 587ad4f2
...@@ -199,7 +199,12 @@ or ...@@ -199,7 +199,12 @@ or
.B --listen-address .B --listen-address
configuration, indeed configuration, indeed
.B --auth-server .B --auth-server
will overide these and provide a different DNS service on the specified interface. The <domain> 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 <domain> 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 .TP
.B \-2, --no-dhcp-interface=<interface name> .B \-2, --no-dhcp-interface=<interface name>
Do not provide DHCP or TFTP on the specified interface, but do provide DNS service. Do not provide DHCP or TFTP on the specified interface, but do provide DNS service.
......
...@@ -159,7 +159,8 @@ int iface_check(int family, struct all_addr *addr, char *name, int *auth) ...@@ -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) for (tmp = daemon->authinterface; tmp; tmp = tmp->next)
if (tmp->name) 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; break;
} }
else if (addr && tmp->addr.sa.sa_family == AF_INET && family == AF_INET && else if (addr && tmp->addr.sa.sa_family == AF_INET && family == AF_INET &&
......
...@@ -1615,8 +1615,22 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -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; new->addr.sa.sa_family = AF_INET6;
#endif #endif
else 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; new->next = daemon->authinterface;
daemon->authinterface = new; daemon->authinterface = new;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment