diff options
| author | Roy Marples <roy@marples.name> | 2016-05-02 01:55:50 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2016-05-02 01:55:50 +0000 |
| commit | 7de8947f6016216020ce25c1545c1279e0defef2 (patch) | |
| tree | 3b676d8615dffd7b58f4aa100096905f445f02e5 /if.c | |
| parent | c50bfba5ab2fc65c9a8b44c138a2603d60fdfe83 (diff) | |
| download | dhcpcd-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.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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; } |
