summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dyndhcpd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/dyndhcpd.c b/dyndhcpd.c
index 68a0a4e..e7b7bf9 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -135,11 +135,20 @@ int main(int argc, char ** argv) {
continue;
if (ifa->ifa_addr == NULL)
continue;
- if (!(ifa->ifa_flags & IFF_UP))
- continue;
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
+ /* check if the device is up */
+ if (!(ifa->ifa_flags & IFF_UP)) {
+ fprintf(stderr, "Interface %s is down.\n", interface);
+ goto out;
+ }
+
+ /* check if the device is connected / cable is plugged in
+ * do warn here, but do not fail */
+ if (!(ifa->ifa_flags & IFF_RUNNING))
+ fprintf(stderr, "Warning: Interface %s is not connected.\n", interface);
+
s4 = (struct sockaddr_in *)ifa->ifa_addr;
v_host = &s4->sin_addr;