Allow listen adresses to be non-numeric (using domains)

This commit is contained in:
Erik Ekman 2021-06-04 18:39:28 +02:00
parent 8041e0368c
commit a6d82b1a44
2 changed files with 5 additions and 3 deletions

View File

@ -271,10 +271,12 @@ automatically fragmented when needed.
.B -l listen_ip4
Make the server listen only on 'listen_ip4' for incoming IPv4 requests.
By default, incoming requests are accepted from all interfaces (0.0.0.0).
A domain name can be used as argument - use one with only one A record.
.TP
.B -L listen_ip6
Make the server listen only on 'listen_ip6' for incoming IPv6 requests.
By default, incoming requests are accepted from all interfaces (::)
By default, incoming requests are accepted from all interfaces (::).
A domain name can be used as argument - use one with only one AAAA record.
.TP
.B -p port
Make the server listen on 'port' instead of 53 for traffic.

View File

@ -2578,14 +2578,14 @@ main(int argc, char **argv)
foreground = 1;
}
if (addrfamily == AF_UNSPEC || addrfamily == AF_INET) {
dns4addr_len = get_addr(listen_ip4, port, AF_INET, AI_PASSIVE | AI_NUMERICHOST, &dns4addr);
dns4addr_len = get_addr(listen_ip4, port, AF_INET, AI_PASSIVE, &dns4addr);
if (dns4addr_len < 0) {
warnx("Bad IPv4 address to listen on.");
usage();
}
}
if (addrfamily == AF_UNSPEC || addrfamily == AF_INET6) {
dns6addr_len = get_addr(listen_ip6, port, AF_INET6, AI_PASSIVE | AI_NUMERICHOST, &dns6addr);
dns6addr_len = get_addr(listen_ip6, port, AF_INET6, AI_PASSIVE, &dns6addr);
if (dns6addr_len < 0) {
warnx("Bad IPv6 address to listen on.");
usage();