rpcd-mod-luci: let IPv4 hostnames take precedence over IPv6 ones
Do not overwrite IPv4-resolved hostnames with IPv6 ones in case both are available or resolvable. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
e120ff41d4
commit
93bd93e220
1 changed files with 3 additions and 2 deletions
|
@ -1672,8 +1672,9 @@ rpc_luci_get_host_hints_rrdns_cb(struct ubus_request *req, int type,
|
||||||
avl_for_each_element(&rctx->avl, hint, avl) {
|
avl_for_each_element(&rctx->avl, hint, avl) {
|
||||||
avl_for_each_element(&hint->ip6addrs, addr, avl) {
|
avl_for_each_element(&hint->ip6addrs, addr, avl) {
|
||||||
if (!memcmp(&addr->addr.in6, &in6, sizeof(in6))) {
|
if (!memcmp(&addr->addr.in6, &in6, sizeof(in6))) {
|
||||||
free(hint->hostname);
|
if (!hint->hostname)
|
||||||
hint->hostname = strdup(blobmsg_get_string(cur));
|
hint->hostname = strdup(blobmsg_get_string(cur));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue