mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-20 19:52:10 +00:00
Compare commits
4
Commits
v2.88test3
...
v2.88rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f227a83f2 | ||
|
|
9ed3ee67ec | ||
|
|
1f9215f5f9 | ||
|
|
f52cfdd8c3 |
No files matched your search
@@ -44,8 +44,13 @@ version 2.88
|
|||||||
cases where is can be useful. Thanks to Dominik Derigs for
|
cases where is can be useful. Thanks to Dominik Derigs for
|
||||||
the patch.
|
the patch.
|
||||||
|
|
||||||
|
Handle DS records for unsupported crypto algorithms correctly.
|
||||||
|
Such a DS, as long as it is validated, should allow answers
|
||||||
|
in the domain is attests to be returned as unvalidated, and not
|
||||||
|
as a validation error.
|
||||||
|
|
||||||
(version 2.87
|
|
||||||
|
version 2.87
|
||||||
Allow arbitrary prefix lengths in --rev-server and
|
Allow arbitrary prefix lengths in --rev-server and
|
||||||
--domain=....,local
|
--domain=....,local
|
||||||
|
|
||||||
|
|||||||
+20
-7
@@ -309,14 +309,14 @@ static int dnsmasq_gostdsa_verify(struct blockdata *key_data, unsigned int key_l
|
|||||||
mpz_init(y);
|
mpz_init(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpz_import(x, 32 , 1, 1, 0, 0, p);
|
mpz_import(x, 32, -1, 1, 0, 0, p);
|
||||||
mpz_import(y, 32 , 1, 1, 0, 0, p + 32);
|
mpz_import(y, 32, -1, 1, 0, 0, p + 32);
|
||||||
|
|
||||||
if (!ecc_point_set(gost_key, x, y))
|
if (!ecc_point_set(gost_key, x, y))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mpz_import(sig_struct->r, 32, 1, 1, 0, 0, sig);
|
mpz_import(sig_struct->s, 32, 1, 1, 0, 0, sig);
|
||||||
mpz_import(sig_struct->s, 32, 1, 1, 0, 0, sig + 32);
|
mpz_import(sig_struct->r, 32, 1, 1, 0, 0, sig + 32);
|
||||||
|
|
||||||
return nettle_gostdsa_verify(gost_key, digest_len, digest, sig_struct);
|
return nettle_gostdsa_verify(gost_key, digest_len, digest, sig_struct);
|
||||||
}
|
}
|
||||||
@@ -390,7 +390,12 @@ static int (*verify_func(int algo))(struct blockdata *key_data, unsigned int key
|
|||||||
return dnsmasq_ecdsa_verify;
|
return dnsmasq_ecdsa_verify;
|
||||||
|
|
||||||
#if MIN_VERSION(3, 1)
|
#if MIN_VERSION(3, 1)
|
||||||
case 15: case 16:
|
case 15:
|
||||||
|
return dnsmasq_eddsa_verify;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MIN_VERSION(3, 6)
|
||||||
|
case 16:
|
||||||
return dnsmasq_eddsa_verify;
|
return dnsmasq_eddsa_verify;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -425,7 +430,9 @@ char *ds_digest_name(int digest)
|
|||||||
{
|
{
|
||||||
case 1: return "sha1";
|
case 1: return "sha1";
|
||||||
case 2: return "sha256";
|
case 2: return "sha256";
|
||||||
case 3: return "gosthash94";
|
#if MIN_VERSION(3, 6)
|
||||||
|
case 3: return "gosthash94cp";
|
||||||
|
#endif
|
||||||
case 4: return "sha384";
|
case 4: return "sha384";
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
@@ -444,11 +451,17 @@ char *algo_digest_name(int algo)
|
|||||||
case 7: return "sha1"; /* RSASHA1-NSEC3-SHA1 */
|
case 7: return "sha1"; /* RSASHA1-NSEC3-SHA1 */
|
||||||
case 8: return "sha256"; /* RSA/SHA-256 */
|
case 8: return "sha256"; /* RSA/SHA-256 */
|
||||||
case 10: return "sha512"; /* RSA/SHA-512 */
|
case 10: return "sha512"; /* RSA/SHA-512 */
|
||||||
case 12: return "gosthash94"; /* ECC-GOST */
|
#if MIN_VERSION(3, 6)
|
||||||
|
case 12: return "gosthash94cp"; /* ECC-GOST */
|
||||||
|
#endif
|
||||||
case 13: return "sha256"; /* ECDSAP256SHA256 */
|
case 13: return "sha256"; /* ECDSAP256SHA256 */
|
||||||
case 14: return "sha384"; /* ECDSAP384SHA384 */
|
case 14: return "sha384"; /* ECDSAP384SHA384 */
|
||||||
|
#if MIN_VERSION(3, 1)
|
||||||
case 15: return "null_hash"; /* ED25519 */
|
case 15: return "null_hash"; /* ED25519 */
|
||||||
|
# if MIN_VERSION(3, 6)
|
||||||
case 16: return "null_hash"; /* ED448 */
|
case 16: return "null_hash"; /* ED448 */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -461,8 +461,8 @@ static DBusMessage* dbus_read_servers_ex(DBusMessage *message, int strings)
|
|||||||
} while (dbus_message_iter_get_arg_type(&string_iter) == DBUS_TYPE_STRING);
|
} while (dbus_message_iter_get_arg_type(&string_iter) == DBUS_TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdetails.resolved)
|
if (sdetails.orig_hostinfo)
|
||||||
freeaddrinfo(sdetails.hostinfo);
|
freeaddrinfo(sdetails.orig_hostinfo);
|
||||||
|
|
||||||
/* jump to next element in outer array */
|
/* jump to next element in outer array */
|
||||||
dbus_message_iter_next(&array_iter);
|
dbus_message_iter_next(&array_iter);
|
||||||
|
|||||||
+2
-2
@@ -1295,9 +1295,9 @@ extern struct daemon {
|
|||||||
|
|
||||||
struct server_details {
|
struct server_details {
|
||||||
union mysockaddr *addr, *source_addr;
|
union mysockaddr *addr, *source_addr;
|
||||||
struct addrinfo *hostinfo;
|
struct addrinfo *hostinfo, *orig_hostinfo;
|
||||||
char *interface, *source, *scope_id, *interface_opt;
|
char *interface, *source, *scope_id, *interface_opt;
|
||||||
int serv_port, source_port, addr_type, scope_index, valid, resolved;
|
int serv_port, source_port, addr_type, scope_index, valid;
|
||||||
u16 *flags;
|
u16 *flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+26
-11
@@ -979,10 +979,13 @@ int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The DNS packet is expected to contain the answer to a DS query
|
/* The DNS packet is expected to contain the answer to a DS query
|
||||||
Put all DSs in the answer which are valid into the cache.
|
Put all DSs in the answer which are valid and have hash and signature algos
|
||||||
|
we support into the cache.
|
||||||
Also handles replies which prove that there's no DS at this location,
|
Also handles replies which prove that there's no DS at this location,
|
||||||
either because the zone is unsigned or this isn't a zone cut. These are
|
either because the zone is unsigned or this isn't a zone cut. These are
|
||||||
cached too.
|
cached too.
|
||||||
|
If none of the DS's are for supported algos, treat the answer as if
|
||||||
|
it's a proof of no DS at this location. RFC4035 para 5.2.
|
||||||
return codes:
|
return codes:
|
||||||
STAT_OK At least one valid DS found and in cache.
|
STAT_OK At least one valid DS found and in cache.
|
||||||
STAT_BOGUS no DS in reply or not signed, fails validation, bad packet.
|
STAT_BOGUS no DS in reply or not signed, fails validation, bad packet.
|
||||||
@@ -993,8 +996,8 @@ int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, ch
|
|||||||
int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class)
|
int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class)
|
||||||
{
|
{
|
||||||
unsigned char *p = (unsigned char *)(header+1);
|
unsigned char *p = (unsigned char *)(header+1);
|
||||||
int qtype, qclass, rc, i, neganswer, nons, neg_ttl = 0;
|
int qtype, qclass, rc, i, neganswer, nons, neg_ttl = 0, found_supported = 0;
|
||||||
int aclass, atype, rdlen;
|
int aclass, atype, rdlen, flags;
|
||||||
unsigned long ttl;
|
unsigned long ttl;
|
||||||
union all_addr a;
|
union all_addr a;
|
||||||
|
|
||||||
@@ -1065,7 +1068,15 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
algo = *p++;
|
algo = *p++;
|
||||||
digest = *p++;
|
digest = *p++;
|
||||||
|
|
||||||
if ((key = blockdata_alloc((char*)p, rdlen - 4)))
|
if (!ds_digest_name(digest) || !ds_digest_name(digest))
|
||||||
|
{
|
||||||
|
a.log.keytag = keytag;
|
||||||
|
a.log.algo = algo;
|
||||||
|
a.log.digest = digest;
|
||||||
|
log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DS keytag %hu, algo %hu, digest %hu (not supported)", 0);
|
||||||
|
neg_ttl = ttl;
|
||||||
|
}
|
||||||
|
else if ((key = blockdata_alloc((char*)p, rdlen - 4)))
|
||||||
{
|
{
|
||||||
a.ds.digest = digest;
|
a.ds.digest = digest;
|
||||||
a.ds.keydata = key;
|
a.ds.keydata = key;
|
||||||
@@ -1083,26 +1094,29 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
a.log.keytag = keytag;
|
a.log.keytag = keytag;
|
||||||
a.log.algo = algo;
|
a.log.algo = algo;
|
||||||
a.log.digest = digest;
|
a.log.digest = digest;
|
||||||
if (ds_digest_name(digest) && algo_digest_name(algo))
|
|
||||||
log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DS keytag %hu, algo %hu, digest %hu", 0);
|
log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DS keytag %hu, algo %hu, digest %hu", 0);
|
||||||
else
|
found_supported = 1;
|
||||||
log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DS keytag %hu, algo %hu, digest %hu (not supported)", 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = psave;
|
p = psave;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ADD_RDLEN(header, p, plen, rdlen))
|
if (!ADD_RDLEN(header, p, plen, rdlen))
|
||||||
return STAT_BOGUS; /* bad packet */
|
return STAT_BOGUS; /* bad packet */
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_end_insert();
|
cache_end_insert();
|
||||||
|
|
||||||
|
/* Fall through if no supported algo DS found. */
|
||||||
|
if (found_supported)
|
||||||
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
int flags = F_FORWARD | F_DS | F_NEG | F_DNSSECOK;
|
|
||||||
|
|
||||||
|
flags = F_FORWARD | F_DS | F_NEG | F_DNSSECOK;
|
||||||
|
|
||||||
|
if (neganswer)
|
||||||
|
{
|
||||||
if (RCODE(header) == NXDOMAIN)
|
if (RCODE(header) == NXDOMAIN)
|
||||||
flags |= F_NXDOMAIN;
|
flags |= F_NXDOMAIN;
|
||||||
|
|
||||||
@@ -1110,6 +1124,7 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
to store presence/absence of NS. */
|
to store presence/absence of NS. */
|
||||||
if (nons)
|
if (nons)
|
||||||
flags &= ~F_DNSSECOK;
|
flags &= ~F_DNSSECOK;
|
||||||
|
}
|
||||||
|
|
||||||
cache_start_insert();
|
cache_start_insert();
|
||||||
|
|
||||||
@@ -1119,8 +1134,8 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
|
|
||||||
cache_end_insert();
|
cache_end_insert();
|
||||||
|
|
||||||
|
if (neganswer)
|
||||||
log_query(F_NOEXTRA | F_UPSTREAM, name, NULL, nons ? "no DS/cut" : "no DS", 0);
|
log_query(F_NOEXTRA | F_UPSTREAM, name, NULL, nons ? "no DS/cut" : "no DS", 0);
|
||||||
}
|
|
||||||
|
|
||||||
return STAT_OK;
|
return STAT_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-15
@@ -860,10 +860,15 @@ char *parse_server(char *arg, struct server_details *sdetails)
|
|||||||
sdetails->serv_port = NAMESERVER_PORT;
|
sdetails->serv_port = NAMESERVER_PORT;
|
||||||
char *portno;
|
char *portno;
|
||||||
int ecode = 0;
|
int ecode = 0;
|
||||||
struct addrinfo hints = { 0 };
|
struct addrinfo hints;
|
||||||
|
|
||||||
|
memset(&hints, 0, sizeof(struct addrinfo));
|
||||||
|
|
||||||
*sdetails->interface = 0;
|
*sdetails->interface = 0;
|
||||||
sdetails->addr_type = AF_UNSPEC;
|
sdetails->addr_type = AF_UNSPEC;
|
||||||
|
sdetails->valid = 0;
|
||||||
|
sdetails->hostinfo = sdetails->orig_hostinfo = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (strcmp(arg, "#") == 0)
|
if (strcmp(arg, "#") == 0)
|
||||||
{
|
{
|
||||||
@@ -943,7 +948,7 @@ char *parse_server(char *arg, struct server_details *sdetails)
|
|||||||
above, and returns a pointer to the start of the list in <hostinfo>.
|
above, and returns a pointer to the start of the list in <hostinfo>.
|
||||||
The items in the linked list are linked by the <ai_next> field. */
|
The items in the linked list are linked by the <ai_next> field. */
|
||||||
sdetails->valid = 1;
|
sdetails->valid = 1;
|
||||||
sdetails->resolved = 1;
|
sdetails->orig_hostinfo = sdetails->hostinfo;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -967,7 +972,7 @@ char *parse_server_addr(struct server_details *sdetails)
|
|||||||
sdetails->addr->in.sin_port = htons(sdetails->serv_port);
|
sdetails->addr->in.sin_port = htons(sdetails->serv_port);
|
||||||
sdetails->addr->sa.sa_family = sdetails->source_addr->sa.sa_family = AF_INET;
|
sdetails->addr->sa.sa_family = sdetails->source_addr->sa.sa_family = AF_INET;
|
||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
source_addr->in.sin_len = addr->in.sin_len = sizeof(struct sockaddr_in);
|
sdetails->source_addr->in.sin_len = sdetails->addr->in.sin_len = sizeof(struct sockaddr_in);
|
||||||
#endif
|
#endif
|
||||||
sdetails->source_addr->in.sin_addr.s_addr = INADDR_ANY;
|
sdetails->source_addr->in.sin_addr.s_addr = INADDR_ANY;
|
||||||
sdetails->source_addr->in.sin_port = htons(daemon->query_port);
|
sdetails->source_addr->in.sin_port = htons(daemon->query_port);
|
||||||
@@ -985,7 +990,7 @@ char *parse_server_addr(struct server_details *sdetails)
|
|||||||
/* When resolving a server IP by hostname, we can simply skip mismatching
|
/* When resolving a server IP by hostname, we can simply skip mismatching
|
||||||
server / source IP pairs. Otherwise, when an IP address is given directly,
|
server / source IP pairs. Otherwise, when an IP address is given directly,
|
||||||
this is a fatal error. */
|
this is a fatal error. */
|
||||||
if (!sdetails->resolved)
|
if (!sdetails->orig_hostinfo)
|
||||||
return _("cannot use IPv4 server address with IPv6 source address");
|
return _("cannot use IPv4 server address with IPv6 source address");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1016,7 +1021,7 @@ char *parse_server_addr(struct server_details *sdetails)
|
|||||||
sdetails->addr->sa.sa_family = sdetails->source_addr->sa.sa_family = AF_INET6;
|
sdetails->addr->sa.sa_family = sdetails->source_addr->sa.sa_family = AF_INET6;
|
||||||
sdetails->addr->in6.sin6_flowinfo = sdetails->source_addr->in6.sin6_flowinfo = 0;
|
sdetails->addr->in6.sin6_flowinfo = sdetails->source_addr->in6.sin6_flowinfo = 0;
|
||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
sdetails->addr->in6.sin6_len = sdetails->source_addr->in6.sin6_len = sizeof(addr->in6);
|
sdetails->addr->in6.sin6_len = sdetails->source_addr->in6.sin6_len = sizeof(sdetails->addr->in6);
|
||||||
#endif
|
#endif
|
||||||
if (sdetails->source)
|
if (sdetails->source)
|
||||||
{
|
{
|
||||||
@@ -1031,7 +1036,7 @@ char *parse_server_addr(struct server_details *sdetails)
|
|||||||
/* When resolving a server IP by hostname, we can simply skip mismatching
|
/* When resolving a server IP by hostname, we can simply skip mismatching
|
||||||
server / source IP pairs. Otherwise, when an IP address is given directly,
|
server / source IP pairs. Otherwise, when an IP address is given directly,
|
||||||
this is a fatal error. */
|
this is a fatal error. */
|
||||||
if(!sdetails->resolved)
|
if(!sdetails->orig_hostinfo)
|
||||||
return _("cannot use IPv6 server address with IPv4 source address");
|
return _("cannot use IPv6 server address with IPv4 source address");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1098,7 +1103,7 @@ static char *domain_rev4(int from_file, char *server, struct in_addr *addr4, int
|
|||||||
union mysockaddr serv_addr, source_addr;
|
union mysockaddr serv_addr, source_addr;
|
||||||
char interface[IF_NAMESIZE+1];
|
char interface[IF_NAMESIZE+1];
|
||||||
int count = 1, rem, addrbytes, addrbits;
|
int count = 1, rem, addrbytes, addrbits;
|
||||||
struct server_details sdetails = { 0 };
|
struct server_details sdetails;
|
||||||
sdetails.addr = &serv_addr;
|
sdetails.addr = &serv_addr;
|
||||||
sdetails.source_addr = &source_addr;
|
sdetails.source_addr = &source_addr;
|
||||||
sdetails.interface = interface;
|
sdetails.interface = interface;
|
||||||
@@ -1161,8 +1166,8 @@ static char *domain_rev4(int from_file, char *server, struct in_addr *addr4, int
|
|||||||
return _("error");
|
return _("error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdetails.resolved)
|
if (sdetails.orig_hostinfo)
|
||||||
freeaddrinfo(sdetails.hostinfo);
|
freeaddrinfo(sdetails.orig_hostinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,7 +1184,7 @@ static char *domain_rev6(int from_file, char *server, struct in6_addr *addr6, in
|
|||||||
union mysockaddr serv_addr, source_addr;
|
union mysockaddr serv_addr, source_addr;
|
||||||
char interface[IF_NAMESIZE+1];
|
char interface[IF_NAMESIZE+1];
|
||||||
int count = 1, rem, addrbytes, addrbits;
|
int count = 1, rem, addrbytes, addrbits;
|
||||||
struct server_details sdetails = { 0 };
|
struct server_details sdetails;
|
||||||
sdetails.addr = &serv_addr;
|
sdetails.addr = &serv_addr;
|
||||||
sdetails.source_addr = &source_addr;
|
sdetails.source_addr = &source_addr;
|
||||||
sdetails.interface = interface;
|
sdetails.interface = interface;
|
||||||
@@ -1244,8 +1249,8 @@ static char *domain_rev6(int from_file, char *server, struct in6_addr *addr6, in
|
|||||||
return _("error");
|
return _("error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdetails.resolved)
|
if (sdetails.orig_hostinfo)
|
||||||
freeaddrinfo(sdetails.hostinfo);
|
freeaddrinfo(sdetails.orig_hostinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2966,7 +2971,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
union mysockaddr serv_addr, source_addr;
|
union mysockaddr serv_addr, source_addr;
|
||||||
char interface[IF_NAMESIZE+1];
|
char interface[IF_NAMESIZE+1];
|
||||||
|
|
||||||
struct server_details sdetails = { 0 };
|
struct server_details sdetails;
|
||||||
sdetails.addr = &serv_addr;
|
sdetails.addr = &serv_addr;
|
||||||
sdetails.source_addr = &source_addr;
|
sdetails.source_addr = &source_addr;
|
||||||
sdetails.interface = interface;
|
sdetails.interface = interface;
|
||||||
@@ -3051,8 +3056,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdetails.resolved)
|
if (sdetails.orig_hostinfo)
|
||||||
freeaddrinfo(sdetails.hostinfo);
|
freeaddrinfo(sdetails.orig_hostinfo);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user