Skip to content

Commit

Permalink
lib: correctly handle v6 in addresses directives
Browse files Browse the repository at this point in the history
previously, if you tried to add an IPv6 address using one of the
directives Dir Address, FD Address or SD Address, it would listen on
0.0.0.0. This patch sees if the string looks like an IPv6 address and
adds it correctly leading to a less surprising behaviour.
  • Loading branch information
arogge authored and alaaeddineelamri committed Sep 23, 2021
1 parent 962f4e0 commit 081b879
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/lib/res.cc
Expand Up @@ -1318,7 +1318,8 @@ void ConfigurationParser::StoreAddressesAddress(LEX* lc,

if (pass == 1
&& !AddAddress(GetItemVariablePointer<dlist<IPADDR>**>(*item),
IPADDR::R_SINGLE_ADDR, htons(port), AF_INET, lc->str, 0,
IPADDR::R_SINGLE_ADDR, htons(port),
strchr(lc->str, ':') ? AF_INET6 : AF_INET, lc->str, 0,
errmsg, sizeof(errmsg))) {
scan_err2(lc, _("can't add port (%s) to (%s)"), lc->str, errmsg);
}
Expand Down

0 comments on commit 081b879

Please sign in to comment.