-#ifdef HAVE_IFADDRS_H
-/*
- * Using the NL_ADDR(lp), reset (if needed) the hostname
- * that will be put in the SM_NOTIFY to the hostname
- * that is associated with the network interface
- * that was monitored
- */
-static void
-reset_my_name(notify_list *lp)
-{
- struct ifaddrs *ifa = NULL, *ifap;
- struct in_addr netaddr, tmp;
- struct sockaddr_in *sin, *nsin;
- struct hostent *hp;
-
- netaddr.s_addr = inet_netof(NL_ADDR(lp));
- if (getifaddrs(&ifa) >= 0) {
- for (ifap = ifa; ifap != NULL; ifap = ifap->ifa_next) {
- if (!(ifap->ifa_flags & IFF_UP))
- continue;
-
- note(N_DEBUG, "ifa_name %s\n", ifap->ifa_name);
- if (ifap->ifa_addr == NULL)
- continue;
- if (ifap->ifa_addr->sa_family != AF_INET)
- continue;
-
- sin = (struct sockaddr_in *)ifap->ifa_addr;
- nsin = (struct sockaddr_in *)ifap->ifa_netmask;
- tmp.s_addr = sin->sin_addr.s_addr & nsin->sin_addr.s_addr;
- if (memcmp(&tmp.s_addr, &netaddr.s_addr, sizeof(netaddr.s_addr)))
- continue;
- hp = gethostbyaddr((char *)&sin->sin_addr,
- sizeof(sin->sin_addr), AF_INET);
- if (hp == NULL)
- continue;
- if (strcmp(NL_MY_NAME(lp), hp->h_name)) {
- free(NL_MY_NAME(lp));
- NL_MY_NAME(lp)= strdup(hp->h_name);
- note(N_DEBUG, "NL_MY_NAME %s\n", NL_MY_NAME(lp));
- }