summaryrefslogtreecommitdiffstats
path: root/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-05-02 01:55:50 +0000
committerRoy Marples <roy@marples.name>2016-05-02 01:55:50 +0000
commit7de8947f6016216020ce25c1545c1279e0defef2 (patch)
tree3b676d8615dffd7b58f4aa100096905f445f02e5 /if.c
parentc50bfba5ab2fc65c9a8b44c138a2603d60fdfe83 (diff)
downloaddhcpcd-7de8947f6016216020ce25c1545c1279e0defef2.tar.xz
Solaris does not return AF_LINK addresses in getifaddrs(3), so
link to dlpi, walk the interfaces and obtain the physical address of each interface.
Diffstat (limited to 'if.c')
-rw-r--r--if.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/if.c b/if.c
index b51b2d28..7fe4132b 100644
--- a/if.c
+++ b/if.c
@@ -271,8 +271,13 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
const struct sockaddr_ll *sll;
#endif
+#ifdef GETIFADDRS_AFLINK
if (getifaddrs(&ifaddrs) == -1)
return NULL;
+#else
+ if (if_getifaddrs(&ifaddrs) == -1)
+ return NULL;
+#endif
ifs = malloc(sizeof(*ifs));
if (ifs == NULL)
return NULL;
@@ -549,8 +554,15 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
TAILQ_INSERT_TAIL(ifs, ifp, next);
}
- if_learnaddrs(ctx, ifs, ifaddrs);
+#ifdef GETIFADDRS_AFLINK
+ {
+#else
freeifaddrs(ifaddrs);
+ if (getifaddrs(&ifaddrs) != -1) {
+#endif
+ if_learnaddrs(ctx, ifs, ifaddrs);
+ freeifaddrs(ifaddrs);
+ }
return ifs;
}