]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow dhcpcd to run on loopback interfaces if specified.
authorRoy Marples <roy@marples.name>
Fri, 20 Mar 2009 15:26:46 +0000 (15:26 +0000)
committerRoy Marples <roy@marples.name>
Fri, 20 Mar 2009 15:26:46 +0000 (15:26 +0000)
if-linux.c
net.c

index ad58e2a92569284a2c094cc2f585e8bc1752bb11..d3bb88e8be33f1d4fbfabe1722896ac4baa8d1d8 100644 (file)
@@ -561,6 +561,14 @@ discover_interfaces(int argc, char * const *argv)
                                        continue;
                        }
                        if ((ifp = init_interface(p))) {
+                               /* Don't allow loopback unless explicit */
+                               if (ifp->flags & IFF_LOOPBACK &&
+                                   argc == 0 &&
+                                   ifdc == 0)
+                               {
+                                       free_interface(ifp);
+                                       continue;
+                               }
                                if (ifl)
                                        ifl->next = ifp; 
                                else
diff --git a/net.c b/net.c
index bfe1fd35fc4190ad780ec41e95c5ea0d9c87f65d..eb94db2fdca08d077e8db4387b108e5b22d4c9f8 100644 (file)
--- a/net.c
+++ b/net.c
@@ -215,16 +215,11 @@ init_interface(const char *ifname)
                iface->hwlen = INFINIBAND_ADDR_LEN;
                break;
        default:
-               /* Don't needlessly spam console on startup */
-               if (!(options & DHCPCD_MASTER &&
-                       !(options & DHCPCD_DAEMONISED) &&
-                       options & DHCPCD_QUIET))
-                       syslog(LOG_ERR, "%s: unsupported media family",
-                           iface->name);
-               goto eexit;
+               iface->hwlen = 0;
        }
-       memcpy(iface->hwaddr, ifr.ifr_hwaddr.sa_data, iface->hwlen);
        iface->family = ifr.ifr_hwaddr.sa_family;
+       if (iface->hwlen != 0)
+               memcpy(iface->hwaddr, ifr.ifr_hwaddr.sa_data, iface->hwlen);
 #endif
 
        if (ioctl(s, SIOCGIFMTU, &ifr) == -1)