From: Roy Marples Date: Sat, 20 Apr 2019 21:11:05 +0000 (+0300) Subject: sun: Continue walking dlpi links when dlpi_open returns no link X-Git-Tag: v7.2.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0250e1dc921ff45c600f93b99aa7efe42bc8b50a;p=thirdparty%2Fdhcpcd.git sun: Continue walking dlpi links when dlpi_open returns no link The link could have just vanished, or it's in a zone. As such, continue. --- diff --git a/src/if-sun.c b/src/if-sun.c index a4e1ae80..177bc34f 100644 --- a/src/if-sun.c +++ b/src/if-sun.c @@ -268,6 +268,7 @@ static boolean_t if_newaddr(const char *ifname, void *arg) { struct linkwalk *lw = arg; + int error; struct ifaddrs *ifa; dlpi_handle_t dh; dlpi_info_t dlinfo; @@ -276,7 +277,10 @@ if_newaddr(const char *ifname, void *arg) struct sockaddr_dl *sdl; ifa = NULL; - if (dlpi_open(ifname, &dh, 0) != DLPI_SUCCESS) + error = dlpi_open(ifname, &dh, 0); + if (error == DLPI_ENOLINK) /* Just vanished or in global zone */ + return B_FALSE; + if (error != DLPI_SUCCESS) goto failed1; if (dlpi_info(dh, &dlinfo, 0) != DLPI_SUCCESS) goto failed; @@ -317,7 +321,7 @@ if_newaddr(const char *ifname, void *arg) ifa->ifa_next = lw->lw_ifa; lw->lw_ifa = ifa; dlpi_close(dh); - return (B_FALSE); + return B_FALSE; failed: dlpi_close(dh); @@ -328,7 +332,7 @@ failed: } failed1: lw->lw_error = errno; - return (B_TRUE); + return B_TRUE; } /* Creates an empty sockaddr_dl for lo0. */