summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-03-20 15:26:46 +0000
committerRoy Marples <roy@marples.name>2009-03-20 15:26:46 +0000
commitd7d07e5ae7dd3e5ec8868e19bc188cbe4a70b837 (patch)
tree7dede906a22fc7882721035a1351ff754b0ad766
parentda7e6aef0b0d5186738b9430201e783373efe7c8 (diff)
downloaddhcpcd-d7d07e5ae7dd3e5ec8868e19bc188cbe4a70b837.tar.xz
Allow dhcpcd to run on loopback interfaces if specified.
-rw-r--r--if-linux.c8
-rw-r--r--net.c11
2 files changed, 11 insertions, 8 deletions
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)