Mercurial > hg > dhcpcd
changeset 4466:bbc28f477a10 draft
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.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sun, 21 Apr 2019 00:11:05 +0300 |
| parents | 84ee61f7988b |
| children | 4e3feb48fffb |
| files | src/if-sun.c |
| diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if-sun.c Sat Apr 20 21:07:16 2019 +0100 +++ b/src/if-sun.c Sun Apr 21 00:11:05 2019 +0300 @@ -268,6 +268,7 @@ 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 @@ 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 @@ 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 @@ } failed1: lw->lw_error = errno; - return (B_TRUE); + return B_TRUE; } /* Creates an empty sockaddr_dl for lo0. */
