Merge branch 'master' into dnssec

This commit is contained in:
Simon Kelley
2013-11-17 12:34:04 +00:00
5 changed files with 38 additions and 13 deletions

View File

@@ -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.

View File

@@ -660,16 +660,16 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
*cut = 0; *cut = 0;
for (addrlist = intr->addr; addrlist; addrlist = addrlist->next) for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
if (!(subnet->flags & ADDRLIST_IPV6) && if (!(addrlist->flags & ADDRLIST_IPV6) &&
(local_query || filter_zone(zone, F_IPV4, &addrlist->addr)) && (local_query || filter_zone(zone, F_IPV4, &addrlist->addr)) &&
add_resource_record(header, limit, &trunc, -axfroffset, &ansp, add_resource_record(header, limit, &trunc, -axfroffset, &ansp,
daemon->auth_ttl, NULL, T_A, C_IN, "4", cut ? intr->name : NULL, &addrlist->addr)) daemon->auth_ttl, NULL, T_A, C_IN, "4", cut ? intr->name : NULL, &addrlist->addr))
anscount++; anscount++;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
for (addrlist = intr->addr; addrlist; addrlist = addrlist->next) for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
if ((subnet->flags & ADDRLIST_IPV6) && if ((addrlist->flags & ADDRLIST_IPV6) &&
(local_query || filter_zone(zone, F_IPV6, &addrlist->addr)) && (local_query || filter_zone(zone, F_IPV6, &addrlist->addr)) &&
add_resource_record(header, limit, &trunc, -axfroffset, &ansp, add_resource_record(header, limit, &trunc, -axfroffset, &ansp,
daemon->auth_ttl, NULL, T_AAAA, C_IN, "6", cut ? intr->name : NULL, &addrlist->addr)) daemon->auth_ttl, NULL, T_AAAA, C_IN, "6", cut ? intr->name : NULL, &addrlist->addr))
anscount++; anscount++;

View File

@@ -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 &&

View File

@@ -1620,8 +1620,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;

View File

@@ -205,7 +205,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
struct dhcp_netid iface_id; struct dhcp_netid iface_id;
struct dhcp_opt *opt_cfg; struct dhcp_opt *opt_cfg;
struct ra_interface *ra_param = find_iface_param(iface_name); struct ra_interface *ra_param = find_iface_param(iface_name);
int done_dns = 0; int done_dns = 0, old_prefix = 0;
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
FILE *f; FILE *f;
#endif #endif
@@ -267,7 +267,7 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
struct in6_addr local = context->start6; struct in6_addr local = context->start6;
int do_slaac = 0; int do_slaac = 0;
parm.found_context = 1; old_prefix = 1;
/* zero net part of address */ /* zero net part of address */
setaddr6part(&local, addr6part(&local) & ~((context->prefix == 64) ? (u64)-1LL : (1LLU << (128 - context->prefix)) - 1LLU)); setaddr6part(&local, addr6part(&local) & ~((context->prefix == 64) ? (u64)-1LL : (1LLU << (128 - context->prefix)) - 1LLU));
@@ -300,7 +300,12 @@ static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *de
up = &context->next; up = &context->next;
} }
if (!parm.found_context) /* If we're advertising only old prefixes, set router lifetime to zero. */
if (old_prefix && !parm.found_context)
ra->lifetime = htons(0);
/* No prefixes to advertise. */
if (!old_prefix && !parm.found_context)
return; return;
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK