From: Roy Marples Date: Fri, 20 Mar 2009 15:26:46 +0000 (+0000) Subject: Allow dhcpcd to run on loopback interfaces if specified. X-Git-Tag: v5.0.0~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7d07e5ae7dd3e5ec8868e19bc188cbe4a70b837;p=thirdparty%2Fdhcpcd.git Allow dhcpcd to run on loopback interfaces if specified. --- diff --git a/if-linux.c b/if-linux.c index ad58e2a9..d3bb88e8 100644 --- a/if-linux.c +++ b/if-linux.c @@ -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 bfe1fd35..eb94db2f 100644 --- 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)