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>
avl_for_each_element(&rctx->avl, hint, avl) {
avl_for_each_element(&hint->ip6addrs, addr, avl) {
if (!memcmp(&addr->addr.in6, &in6, sizeof(in6))) {
- free(hint->hostname);
- hint->hostname = strdup(blobmsg_get_string(cur));
+ if (!hint->hostname)
+ hint->hostname = strdup(blobmsg_get_string(cur));
+
break;
}
}