+ n_addresses = local_addresses(NULL, 0, &addresses);
+ if (n_addresses > 0) {
+ for (a = addresses, n = 0; (int) n < n_addresses; n++, a++) {
+ if (af != a->family)
+ continue;
+
+ if (memcmp(addr, &a->address, FAMILY_ADDRESS_SIZE(af)) == 0) {
+
+ hn = gethostname_malloc();
+ if (!hn) {
+ *errnop = ENOMEM;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ canonical = hn;
+ goto found;
+ }
+ }
+ }
+
+ free(addresses);
+ addresses = NULL;