mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-06 15:51:41 +00:00
Compare commits
8
Commits
v2.68test2
...
v2.68rc3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
254390644a | ||
|
|
241fa9c6c8 | ||
|
|
e142a83296 | ||
|
|
f7029f5c08 | ||
|
|
c50f25a3ea | ||
|
|
f25e6c6d33 | ||
|
|
587ad4f271 | ||
|
|
4452292064 |
No files matched your search
@@ -32,6 +32,12 @@ version 2.68
|
|||||||
the prefix is deleted (rather than replaced), it doesn't
|
the prefix is deleted (rather than replaced), it doesn't
|
||||||
get advertised with zero preferred time. Thanks to Tsachi
|
get advertised with zero preferred time. Thanks to Tsachi
|
||||||
for the bug report.
|
for the bug report.
|
||||||
|
|
||||||
|
Fix segfault with some locally configured CNAMEs. Thanks
|
||||||
|
to Andrew Childs for spotting the problem.
|
||||||
|
|
||||||
|
Fix memory leak on re-reading /etc/hosts and friends,
|
||||||
|
introduced in 2.67.
|
||||||
|
|
||||||
|
|
||||||
version 2.67
|
version 2.67
|
||||||
|
|||||||
+17
-7
@@ -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.
|
||||||
@@ -509,11 +514,13 @@ record (which is always in the C_IN class). The value of the record is
|
|||||||
given by the hex data, which may be of the form 01:23:45 or 01 23 45 or
|
given by the hex data, which may be of the form 01:23:45 or 01 23 45 or
|
||||||
012345 or any mixture of these.
|
012345 or any mixture of these.
|
||||||
.TP
|
.TP
|
||||||
.B --interface-name=<name>,<interface>
|
.B --interface-name=<name>,<interface>[/4|/6]
|
||||||
Return a DNS record associating the name with the primary address on
|
Return a DNS record associating the name with the primary address on
|
||||||
the given interface. This flag specifies an A record for the given
|
the given interface. This flag specifies an A or AAAA record for the given
|
||||||
name in the same way as an /etc/hosts line, except that the address is
|
name in the same way as an /etc/hosts line, except that the address is
|
||||||
not constant, but taken from the given interface. If the interface is
|
not constant, but taken from the given interface. The interface may be
|
||||||
|
followed by "/4" or "/6" to specify that only IPv4 or IPv6 addresses
|
||||||
|
of the interface should be used. If the interface is
|
||||||
down, not configured or non-existent, an empty record is returned. The
|
down, not configured or non-existent, an empty record is returned. The
|
||||||
matching PTR record is also created, mapping the interface address to
|
matching PTR record is also created, mapping the interface address to
|
||||||
the name. More than one name may be associated with an interface
|
the name. More than one name may be associated with an interface
|
||||||
@@ -588,8 +595,10 @@ needed for a client to do validation itself.
|
|||||||
.TP
|
.TP
|
||||||
.B --auth-zone=<domain>[,<subnet>[/<prefix length>][,<subnet>[/<prefix length>].....]]
|
.B --auth-zone=<domain>[,<subnet>[/<prefix length>][,<subnet>[/<prefix length>].....]]
|
||||||
Define a DNS zone for which dnsmasq acts as authoritative server. Locally defined DNS records which are in the domain
|
Define a DNS zone for which dnsmasq acts as authoritative server. Locally defined DNS records which are in the domain
|
||||||
will be served. A and AAAA records must be in one of the
|
will be served. If subnet(s) are given, A and AAAA records must be in one of the
|
||||||
specified subnets. As alternative to directly specifying the subnets, it's possible to
|
specified subnets.
|
||||||
|
|
||||||
|
As alternative to directly specifying the subnets, it's possible to
|
||||||
give the name of an interface, in which case the subnets implied by
|
give the name of an interface, in which case the subnets implied by
|
||||||
that interface's configured addresses and netmask/prefix-length are
|
that interface's configured addresses and netmask/prefix-length are
|
||||||
used; this is useful when using constructed DHCP ranges as the actual
|
used; this is useful when using constructed DHCP ranges as the actual
|
||||||
@@ -606,7 +615,8 @@ ipv6.arpa domains which are served for reverse-DNS queries. If not
|
|||||||
specified, the prefix length defaults to 24 for IPv4 and 64 for IPv6.
|
specified, the prefix length defaults to 24 for IPv4 and 64 for IPv6.
|
||||||
For IPv4 subnets, the prefix length should be have the value 8, 16 or 24
|
For IPv4 subnets, the prefix length should be have the value 8, 16 or 24
|
||||||
unless you are familiar with RFC 2317 and have arranged the
|
unless you are familiar with RFC 2317 and have arranged the
|
||||||
in-addr.arpa delegation accordingly.
|
in-addr.arpa delegation accordingly. Note that if no subnets are
|
||||||
|
specified, then no reverse queries are answered.
|
||||||
.TP
|
.TP
|
||||||
.B --auth-soa=<serial>[,<hostmaster>[,<refresh>[,<retry>[,<expiry>]]]]
|
.B --auth-soa=<serial>[,<hostmaster>[,<refresh>[,<retry>[,<expiry>]]]]
|
||||||
Specify fields in the SOA record associated with authoritative
|
Specify fields in the SOA record associated with authoritative
|
||||||
|
|||||||
+422
-374
File diff suppressed because it is too large.
Load diff
+15
-6
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#ifdef HAVE_AUTH
|
#ifdef HAVE_AUTH
|
||||||
|
|
||||||
static struct addrlist *filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u)
|
static struct addrlist *find_subnet(struct auth_zone *zone, int flag, struct all_addr *addr_u)
|
||||||
{
|
{
|
||||||
struct addrlist *subnet;
|
struct addrlist *subnet;
|
||||||
|
|
||||||
@@ -45,6 +45,15 @@ static struct addrlist *filter_zone(struct auth_zone *zone, int flag, struct all
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u)
|
||||||
|
{
|
||||||
|
/* No zones specified, no filter */
|
||||||
|
if (!zone->subnet)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return find_subnet(zone, flag, addr_u) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int in_zone(struct auth_zone *zone, char *name, char **cut)
|
int in_zone(struct auth_zone *zone, char *name, char **cut)
|
||||||
{
|
{
|
||||||
size_t namelen = strlen(name);
|
size_t namelen = strlen(name);
|
||||||
@@ -130,7 +139,7 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
if (!local_query)
|
if (!local_query)
|
||||||
{
|
{
|
||||||
for (zone = daemon->auth_zones; zone; zone = zone->next)
|
for (zone = daemon->auth_zones; zone; zone = zone->next)
|
||||||
if ((subnet = filter_zone(zone, flag, &addr)))
|
if ((subnet = find_subnet(zone, flag, &addr)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!zone)
|
if (!zone)
|
||||||
@@ -660,16 +669,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++;
|
||||||
|
|||||||
+10
-10
@@ -320,7 +320,7 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
|
|||||||
if (is_expired(now, crecp) || is_outdated_cname_pointer(crecp))
|
if (is_expired(now, crecp) || is_outdated_cname_pointer(crecp))
|
||||||
{
|
{
|
||||||
*up = crecp->hash_next;
|
*up = crecp->hash_next;
|
||||||
if (!(crecp->flags & (F_HOSTS | F_DHCP)))
|
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
||||||
{
|
{
|
||||||
cache_unlink(crecp);
|
cache_unlink(crecp);
|
||||||
cache_free(crecp);
|
cache_free(crecp);
|
||||||
@@ -354,13 +354,13 @@ static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsign
|
|||||||
if (is_expired(now, crecp))
|
if (is_expired(now, crecp))
|
||||||
{
|
{
|
||||||
*up = crecp->hash_next;
|
*up = crecp->hash_next;
|
||||||
if (!(crecp->flags & (F_HOSTS | F_DHCP)))
|
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
||||||
{
|
{
|
||||||
cache_unlink(crecp);
|
cache_unlink(crecp);
|
||||||
cache_free(crecp);
|
cache_free(crecp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(crecp->flags & (F_HOSTS | F_DHCP)) &&
|
else if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) &&
|
||||||
(flags & crecp->flags & F_REVERSE) &&
|
(flags & crecp->flags & F_REVERSE) &&
|
||||||
(flags & crecp->flags & (F_IPV4 | F_IPV6)) &&
|
(flags & crecp->flags & (F_IPV4 | F_IPV6)) &&
|
||||||
memcmp(&crecp->addr.addr, addr, addrlen) == 0)
|
memcmp(&crecp->addr.addr, addr, addrlen) == 0)
|
||||||
@@ -558,7 +558,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
|
|||||||
(crecp->flags & prot) &&
|
(crecp->flags & prot) &&
|
||||||
hostname_isequal(cache_get_name(crecp), name))
|
hostname_isequal(cache_get_name(crecp), name))
|
||||||
{
|
{
|
||||||
if (crecp->flags & (F_HOSTS | F_DHCP))
|
if (crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG))
|
||||||
{
|
{
|
||||||
*chainp = crecp;
|
*chainp = crecp;
|
||||||
chainp = &crecp->next;
|
chainp = &crecp->next;
|
||||||
@@ -599,7 +599,7 @@ struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsi
|
|||||||
{
|
{
|
||||||
/* expired entry, free it */
|
/* expired entry, free it */
|
||||||
*up = crecp->hash_next;
|
*up = crecp->hash_next;
|
||||||
if (!(crecp->flags & (F_HOSTS | F_DHCP)))
|
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
||||||
{
|
{
|
||||||
cache_unlink(crecp);
|
cache_unlink(crecp);
|
||||||
cache_free(crecp);
|
cache_free(crecp);
|
||||||
@@ -649,7 +649,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
|
|||||||
if ((crecp->flags & prot) &&
|
if ((crecp->flags & prot) &&
|
||||||
memcmp(&crecp->addr.addr, addr, addrlen) == 0)
|
memcmp(&crecp->addr.addr, addr, addrlen) == 0)
|
||||||
{
|
{
|
||||||
if (crecp->flags & (F_HOSTS | F_DHCP))
|
if (crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG))
|
||||||
{
|
{
|
||||||
*chainp = crecp;
|
*chainp = crecp;
|
||||||
chainp = &crecp->next;
|
chainp = &crecp->next;
|
||||||
@@ -665,7 +665,7 @@ struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*up = crecp->hash_next;
|
*up = crecp->hash_next;
|
||||||
if (!(crecp->flags & (F_HOSTS | F_DHCP)))
|
if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)))
|
||||||
{
|
{
|
||||||
cache_unlink(crecp);
|
cache_unlink(crecp);
|
||||||
cache_free(crecp);
|
cache_free(crecp);
|
||||||
@@ -923,7 +923,7 @@ void cache_reload(void)
|
|||||||
for (cache = hash_table[i], up = &hash_table[i]; cache; cache = tmp)
|
for (cache = hash_table[i], up = &hash_table[i]; cache; cache = tmp)
|
||||||
{
|
{
|
||||||
tmp = cache->hash_next;
|
tmp = cache->hash_next;
|
||||||
if (cache->flags & F_HOSTS)
|
if (cache->flags & (F_HOSTS | F_CONFIG))
|
||||||
{
|
{
|
||||||
*up = cache->hash_next;
|
*up = cache->hash_next;
|
||||||
free(cache);
|
free(cache);
|
||||||
@@ -947,7 +947,7 @@ void cache_reload(void)
|
|||||||
for (intr = daemon->int_names; intr; intr = intr->next)
|
for (intr = daemon->int_names; intr; intr = intr->next)
|
||||||
if (hostname_isequal(a->target, intr->name))
|
if (hostname_isequal(a->target, intr->name))
|
||||||
{
|
{
|
||||||
struct crec *aliasc = safe_malloc(sizeof(struct crec));
|
struct crec *aliasc = whine_malloc(sizeof(struct crec));
|
||||||
aliasc->flags = F_FORWARD | F_NAMEP | F_CNAME | F_IMMORTAL | F_CONFIG;
|
aliasc->flags = F_FORWARD | F_NAMEP | F_CNAME | F_IMMORTAL | F_CONFIG;
|
||||||
aliasc->name.namep = a->alias;
|
aliasc->name.namep = a->alias;
|
||||||
aliasc->addr.cname.target.int_name = intr;
|
aliasc->addr.cname.target.int_name = intr;
|
||||||
@@ -1083,7 +1083,7 @@ void cache_add_dhcp_entry(char *host_name, int prot,
|
|||||||
while ((crec = cache_find_by_name(crec, host_name, 0, flags | F_CNAME)))
|
while ((crec = cache_find_by_name(crec, host_name, 0, flags | F_CNAME)))
|
||||||
{
|
{
|
||||||
/* check all addresses associated with name */
|
/* check all addresses associated with name */
|
||||||
if (crec->flags & F_HOSTS)
|
if (crec->flags & (F_HOSTS | F_CONFIG))
|
||||||
{
|
{
|
||||||
if (crec->flags & F_CNAME)
|
if (crec->flags & F_CNAME)
|
||||||
my_syslog(MS_DHCP | LOG_WARNING,
|
my_syslog(MS_DHCP | LOG_WARNING,
|
||||||
|
|||||||
@@ -189,10 +189,6 @@ HAVE_SOLARIS_NETWORK
|
|||||||
HAVE_GETOPT_LONG
|
HAVE_GETOPT_LONG
|
||||||
defined when GNU-style getopt_long available.
|
defined when GNU-style getopt_long available.
|
||||||
|
|
||||||
HAVE_ARC4RANDOM
|
|
||||||
defined if arc4random() available to get better security from DNS spoofs
|
|
||||||
by using really random ids (OpenBSD)
|
|
||||||
|
|
||||||
HAVE_SOCKADDR_SA_LEN
|
HAVE_SOCKADDR_SA_LEN
|
||||||
defined if struct sockaddr has sa_len field (*BSD)
|
defined if struct sockaddr has sa_len field (*BSD)
|
||||||
*/
|
*/
|
||||||
@@ -201,7 +197,6 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#if defined(__uClinux__)
|
#if defined(__uClinux__)
|
||||||
#define HAVE_LINUX_NETWORK
|
#define HAVE_LINUX_NETWORK
|
||||||
#define HAVE_GETOPT_LONG
|
#define HAVE_GETOPT_LONG
|
||||||
#undef HAVE_ARC4RANDOM
|
|
||||||
#undef HAVE_SOCKADDR_SA_LEN
|
#undef HAVE_SOCKADDR_SA_LEN
|
||||||
/* Never use fork() on uClinux. Note that this is subtly different from the
|
/* Never use fork() on uClinux. Note that this is subtly different from the
|
||||||
--keep-in-foreground option, since it also suppresses forking new
|
--keep-in-foreground option, since it also suppresses forking new
|
||||||
@@ -215,7 +210,6 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
|
((__UCLIBC_MAJOR__==0) && (__UCLIBC_MINOR__==9) && (__UCLIBC_SUBLEVEL__<21))
|
||||||
# define HAVE_GETOPT_LONG
|
# define HAVE_GETOPT_LONG
|
||||||
#endif
|
#endif
|
||||||
#undef HAVE_ARC4RANDOM
|
|
||||||
#undef HAVE_SOCKADDR_SA_LEN
|
#undef HAVE_SOCKADDR_SA_LEN
|
||||||
#if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
|
#if !defined(__ARCH_HAS_MMU__) && !defined(__UCLIBC_HAS_MMU__)
|
||||||
# define NO_FORK
|
# define NO_FORK
|
||||||
@@ -230,7 +224,6 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#define HAVE_LINUX_NETWORK
|
#define HAVE_LINUX_NETWORK
|
||||||
#define HAVE_GETOPT_LONG
|
#define HAVE_GETOPT_LONG
|
||||||
#undef HAVE_ARC4RANDOM
|
|
||||||
#undef HAVE_SOCKADDR_SA_LEN
|
#undef HAVE_SOCKADDR_SA_LEN
|
||||||
|
|
||||||
#elif defined(__FreeBSD__) || \
|
#elif defined(__FreeBSD__) || \
|
||||||
@@ -242,15 +235,11 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#if defined(optional_argument) && defined(required_argument)
|
#if defined(optional_argument) && defined(required_argument)
|
||||||
# define HAVE_GETOPT_LONG
|
# define HAVE_GETOPT_LONG
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__FreeBSD_kernel__)
|
|
||||||
# define HAVE_ARC4RANDOM
|
|
||||||
#endif
|
|
||||||
#define HAVE_SOCKADDR_SA_LEN
|
#define HAVE_SOCKADDR_SA_LEN
|
||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#define HAVE_BSD_NETWORK
|
#define HAVE_BSD_NETWORK
|
||||||
#define HAVE_GETOPT_LONG
|
#define HAVE_GETOPT_LONG
|
||||||
#define HAVE_ARC4RANDOM
|
|
||||||
#define HAVE_SOCKADDR_SA_LEN
|
#define HAVE_SOCKADDR_SA_LEN
|
||||||
/* Define before sys/socket.h is included so we get socklen_t */
|
/* Define before sys/socket.h is included so we get socklen_t */
|
||||||
#define _BSD_SOCKLEN_T_
|
#define _BSD_SOCKLEN_T_
|
||||||
@@ -261,13 +250,11 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#define HAVE_BSD_NETWORK
|
#define HAVE_BSD_NETWORK
|
||||||
#define HAVE_GETOPT_LONG
|
#define HAVE_GETOPT_LONG
|
||||||
#undef HAVE_ARC4RANDOM
|
|
||||||
#define HAVE_SOCKADDR_SA_LEN
|
#define HAVE_SOCKADDR_SA_LEN
|
||||||
|
|
||||||
#elif defined(__sun) || defined(__sun__)
|
#elif defined(__sun) || defined(__sun__)
|
||||||
#define HAVE_SOLARIS_NETWORK
|
#define HAVE_SOLARIS_NETWORK
|
||||||
#define HAVE_GETOPT_LONG
|
#define HAVE_GETOPT_LONG
|
||||||
#undef HAVE_ARC4RANDOM
|
|
||||||
#undef HAVE_SOCKADDR_SA_LEN
|
#undef HAVE_SOCKADDR_SA_LEN
|
||||||
#define ETHER_ADDR_LEN 6
|
#define ETHER_ADDR_LEN 6
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -636,7 +636,10 @@ int main (int argc, char **argv)
|
|||||||
if (bind_fallback)
|
if (bind_fallback)
|
||||||
my_syslog(LOG_WARNING, _("setting --bind-interfaces option because of OS limitations"));
|
my_syslog(LOG_WARNING, _("setting --bind-interfaces option because of OS limitations"));
|
||||||
|
|
||||||
warn_bound_listeners();
|
if (option_bool(OPT_NOWILD))
|
||||||
|
warn_bound_listeners();
|
||||||
|
|
||||||
|
warn_int_names();
|
||||||
|
|
||||||
if (!option_bool(OPT_NOWILD))
|
if (!option_bool(OPT_NOWILD))
|
||||||
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
|
for (if_tmp = daemon->if_names; if_tmp; if_tmp = if_tmp->next)
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ struct host_record {
|
|||||||
struct interface_name {
|
struct interface_name {
|
||||||
char *name; /* domain name */
|
char *name; /* domain name */
|
||||||
char *intr; /* interface name */
|
char *intr; /* interface name */
|
||||||
|
int family; /* AF_INET, AF_INET6 or zero for both */
|
||||||
struct addrlist *addr;
|
struct addrlist *addr;
|
||||||
struct interface_name *next;
|
struct interface_name *next;
|
||||||
};
|
};
|
||||||
@@ -1076,6 +1077,7 @@ int enumerate_interfaces(int reset);
|
|||||||
void create_wildcard_listeners(void);
|
void create_wildcard_listeners(void);
|
||||||
void create_bound_listeners(int die);
|
void create_bound_listeners(int die);
|
||||||
void warn_bound_listeners(void);
|
void warn_bound_listeners(void);
|
||||||
|
void warn_int_names(void);
|
||||||
int is_dad_listeners(void);
|
int is_dad_listeners(void);
|
||||||
int iface_check(int family, struct all_addr *addr, char *name, int *auth_dns);
|
int iface_check(int family, struct all_addr *addr, char *name, int *auth_dns);
|
||||||
int loopback_exception(int fd, int family, struct all_addr *addr, char *name);
|
int loopback_exception(int fd, int family, struct all_addr *addr, char *name);
|
||||||
|
|||||||
+16
-5
@@ -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 &&
|
||||||
@@ -329,7 +330,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
|
|||||||
/* Update addresses from interface_names. These are a set independent
|
/* Update addresses from interface_names. These are a set independent
|
||||||
of the set we're listening on. */
|
of the set we're listening on. */
|
||||||
for (int_name = daemon->int_names; int_name; int_name = int_name->next)
|
for (int_name = daemon->int_names; int_name; int_name = int_name->next)
|
||||||
if (strncmp(label, int_name->intr, IF_NAMESIZE) == 0)
|
if (strncmp(label, int_name->intr, IF_NAMESIZE) == 0 &&
|
||||||
|
(addr->sa.sa_family == int_name->family || int_name->family == 0))
|
||||||
{
|
{
|
||||||
if (param->spare)
|
if (param->spare)
|
||||||
{
|
{
|
||||||
@@ -914,7 +916,7 @@ void warn_bound_listeners(void)
|
|||||||
int advice = 0;
|
int advice = 0;
|
||||||
|
|
||||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||||
if (option_bool(OPT_NOWILD) && !iface->dns_auth)
|
if (!iface->dns_auth)
|
||||||
{
|
{
|
||||||
int warn = 0;
|
int warn = 0;
|
||||||
if (iface->addr.sa.sa_family == AF_INET)
|
if (iface->addr.sa.sa_family == AF_INET)
|
||||||
@@ -942,15 +944,24 @@ void warn_bound_listeners(void)
|
|||||||
{
|
{
|
||||||
iface->warned = advice = 1;
|
iface->warned = advice = 1;
|
||||||
my_syslog(LOG_WARNING,
|
my_syslog(LOG_WARNING,
|
||||||
_("LOUD WARNING: listening on %s may accept requests via interfaces other than %s. "),
|
_("LOUD WARNING: listening on %s may accept requests via interfaces other than %s"),
|
||||||
daemon->addrbuff, iface->name);
|
daemon->addrbuff, iface->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (advice)
|
if (advice)
|
||||||
my_syslog(LOG_WARNING, _("LOUD WARNING: use --bind-dynamic rather than --bind-interfaces to avoid DNS amplification attacks via these interface(s)."));
|
my_syslog(LOG_WARNING, _("LOUD WARNING: use --bind-dynamic rather than --bind-interfaces to avoid DNS amplification attacks via these interface(s)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void warn_int_names(void)
|
||||||
|
{
|
||||||
|
struct interface_name *intname;
|
||||||
|
|
||||||
|
for (intname = daemon->int_names; intname; intname = intname->next)
|
||||||
|
if (!intname->addr)
|
||||||
|
my_syslog(LOG_WARNING, _("warning: no addresses found for interface %s"), intname->intr);
|
||||||
|
}
|
||||||
|
|
||||||
int is_dad_listeners(void)
|
int is_dad_listeners(void)
|
||||||
{
|
{
|
||||||
struct irec *iface;
|
struct irec *iface;
|
||||||
|
|||||||
+29
-2
@@ -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;
|
||||||
|
|
||||||
@@ -3362,6 +3376,19 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
for (up = &daemon->int_names; *up; up = &((*up)->next));
|
for (up = &daemon->int_names; *up; up = &((*up)->next));
|
||||||
*up = new;
|
*up = new;
|
||||||
new->name = domain;
|
new->name = domain;
|
||||||
|
new->family = 0;
|
||||||
|
arg = split_chr(comma, '/');
|
||||||
|
if (arg)
|
||||||
|
{
|
||||||
|
if (strcmp(arg, "4") == 0)
|
||||||
|
new->family = AF_INET;
|
||||||
|
#ifdef HAVE_IPV6
|
||||||
|
else if (strcmp(arg, "6") == 0)
|
||||||
|
new->family = AF_INET6;
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
ret_err(gen_err);
|
||||||
|
}
|
||||||
new->intr = opt_string_alloc(comma);
|
new->intr = opt_string_alloc(comma);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-5
@@ -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,9 +300,14 @@ 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. */
|
||||||
return;
|
if (old_prefix && !parm.found_context)
|
||||||
|
ra->lifetime = htons(0);
|
||||||
|
|
||||||
|
/* No prefixes to advertise. */
|
||||||
|
if (!old_prefix && !parm.found_context)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_NETWORK
|
#ifdef HAVE_LINUX_NETWORK
|
||||||
/* Note that IPv6 MTU is not necessarilly the same as the IPv4 MTU
|
/* Note that IPv6 MTU is not necessarilly the same as the IPv4 MTU
|
||||||
available from SIOCGIFMTU */
|
available from SIOCGIFMTU */
|
||||||
|
|||||||
-24
@@ -28,28 +28,6 @@
|
|||||||
#include <idna.h>
|
#include <idna.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ARC4RANDOM
|
|
||||||
void rand_init(void)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned short rand16(void)
|
|
||||||
{
|
|
||||||
return (unsigned short) (arc4random() >> 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 rand64(void)
|
|
||||||
{
|
|
||||||
u64 ret;
|
|
||||||
|
|
||||||
arc4random_buf(&ret, sizeof(ret));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* SURF random number generator */
|
/* SURF random number generator */
|
||||||
|
|
||||||
static u32 seed[32];
|
static u32 seed[32];
|
||||||
@@ -119,8 +97,6 @@ u64 rand64(void)
|
|||||||
return (u64)out[outleft+1] + (((u64)out[outleft]) << 32);
|
return (u64)out[outleft+1] + (((u64)out[outleft]) << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int check_name(char *in)
|
static int check_name(char *in)
|
||||||
{
|
{
|
||||||
/* remove trailing .
|
/* remove trailing .
|
||||||
|
|||||||
Reference in new issue
Block a user