From: Roy Marples Date: Thu, 30 May 2013 21:01:48 +0000 (+0000) Subject: On Linux, PPP interfaces do not have a hardware address, so X-Git-Tag: v5.99.7~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5369feb4e774dfda521ccf39831209ed04103af6;p=thirdparty%2Fdhcpcd.git On Linux, PPP interfaces do not have a hardware address, so get the ifindex via if_nametoindex(3). Also, don't record an error restoring kernel RA settings for a removed interface. Thanks to Sergey Fionov. --- diff --git a/net.c b/net.c index 231482bf..04b29743 100644 --- a/net.c +++ b/net.c @@ -386,6 +386,11 @@ discover_interfaces(int argc, char * const *argv) memcpy(ifp->hwaddr, sll->sll_addr, ifp->hwlen); #endif } +#ifdef __linux__ + /* PPP addresses on Linux don't have hardware addresses */ + else + ifp->index = if_nametoindex(ifp->name); +#endif /* We only work on ethernet by default */ if (!(ifp->flags & IFF_POINTOPOINT) && diff --git a/platform-linux.c b/platform-linux.c index a8a6195f..da077466 100644 --- a/platform-linux.c +++ b/platform-linux.c @@ -160,7 +160,7 @@ restore_kernel_ra(void) restore[nrestore]); snprintf(path, sizeof(path), "%s/%s/accept_ra", prefix, restore[nrestore]); - if (write_path(path, "1") == -1) + if (write_path(path, "1") == -1 && errno != ENOENT) syslog(LOG_ERR, "write_path: %s: %m", path); #ifdef DEBUG_MEMORY }