if HAVE_MYHOSTNAME
libnss_myhostname_la_SOURCES = \
src/nss-myhostname/nss-myhostname.c \
- src/nss-myhostname/ifconf.h \
- src/nss-myhostname/netlink.c
+ src/nss-myhostname/addresses.h \
+ src/nss-myhostname/addresses.c
libnss_myhostname_la_LDFLAGS = \
$(AM_LDFLAGS) \
#include "sd-rtnl.h"
#include "rtnl-util.h"
#include "macro.h"
-#include "ifconf.h"
+#include "addresses.h"
static int address_compare(const void *_a, const void *_b) {
const struct address *a = _a, *b = _b;
return 0;
}
-int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {
+int acquire_addresses(struct address **_list, unsigned *_n_list) {
_cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
_cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
_cleanup_free_ struct address *list = NULL;
#include "socket-util.h"
struct address {
- unsigned char family;
+ unsigned char family, scope;
union in_addr_union address;
- unsigned char scope;
int ifindex;
};
return proto == AF_INET6 ? 16 : 4;
}
-int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list);
+int acquire_addresses(struct address **_list, unsigned *_n_list);
#include <stdlib.h>
#include <arpa/inet.h>
-#include "ifconf.h"
+#include "addresses.h"
#include "macro.h"
/* Ensure that glibc's assert is used. We cannot use assert from macro.h, as
}
/* If this fails, n_addresses is 0. Which is fine */
- ifconf_acquire_addresses(&addresses, &n_addresses);
+ acquire_addresses(&addresses, &n_addresses);
canonical = hn;
local_address_ipv4 = LOCALADDRESS_IPV4;
return NSS_STATUS_NOTFOUND;
}
- ifconf_acquire_addresses(&addresses, &n_addresses);
+ acquire_addresses(&addresses, &n_addresses);
canonical = hn;
additional = n_addresses <= 0 && af == AF_INET6 ? "localhost" : NULL;
return NSS_STATUS_UNAVAIL;
}
- ifconf_acquire_addresses(&addresses, &n_addresses);
+ acquire_addresses(&addresses, &n_addresses);
for (a = addresses, n = 0; n < n_addresses; n++, a++) {
if (af != a->family)