]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
On Linux, PPP interfaces do not have a hardware address, so
authorRoy Marples <roy@marples.name>
Thu, 30 May 2013 21:01:48 +0000 (21:01 +0000)
committerRoy Marples <roy@marples.name>
Thu, 30 May 2013 21:01:48 +0000 (21:01 +0000)
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.

net.c
platform-linux.c

diff --git a/net.c b/net.c
index 231482bf9e4c6558613e36b9606f47c457f6910d..04b29743c61b32aa5151e439d99690863f8c08aa 100644 (file)
--- 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) &&
index a8a6195f87529ce1a5dd8a4c8a0ff43f683498cf..da0774666101d99c6e36d21322404c115da2e23d 100644 (file)
@@ -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
                }