summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--src/nss-myhostname/addresses.c (renamed from src/nss-myhostname/netlink.c)4
-rw-r--r--src/nss-myhostname/addresses.h (renamed from src/nss-myhostname/ifconf.h)5
-rw-r--r--src/nss-myhostname/nss-myhostname.c8
4 files changed, 10 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am
index 5050820d5b..425a5e16a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4398,8 +4398,8 @@ endif
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) \
diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/addresses.c
index e9518e3213..d75e850494 100644
--- a/src/nss-myhostname/netlink.c
+++ b/src/nss-myhostname/addresses.c
@@ -23,7 +23,7 @@
#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;
@@ -48,7 +48,7 @@ static int address_compare(const void *_a, const void *_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;
diff --git a/src/nss-myhostname/ifconf.h b/src/nss-myhostname/addresses.h
index 92f03b261a..1bfb3579da 100644
--- a/src/nss-myhostname/ifconf.h
+++ b/src/nss-myhostname/addresses.h
@@ -29,9 +29,8 @@
#include "socket-util.h"
struct address {
- unsigned char family;
+ unsigned char family, scope;
union in_addr_union address;
- unsigned char scope;
int ifindex;
};
@@ -41,4 +40,4 @@ static inline size_t PROTO_ADDRESS_SIZE(int proto) {
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);
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index 9320e69ebd..6551ac9f32 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -30,7 +30,7 @@
#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
@@ -137,7 +137,7 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
}
/* 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;
@@ -389,7 +389,7 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
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;
@@ -492,7 +492,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
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)