changeset 2550:957a57a4ff17 draft

Add debugging messages for interface arrival/departure. Only init state and run preinit for new interfaces.
author Roy Marples <roy@marples.name>
date Mon, 30 Jun 2014 11:28:14 +0000
parents 0e059c32919d
children 65869393ad06
files dhcpcd.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Mon Jun 30 11:08:19 2014 +0000
+++ b/dhcpcd.c	Mon Jun 30 11:28:14 2014 +0000
@@ -743,6 +743,7 @@
 			errno = ESRCH;
 			return -1;
 		}
+		syslog(LOG_DEBUG, "%s: interface departed", ifp->name);
 		ifp->options->options |= DHCPCD_DEPARTED;
 		stop_interface(ifp);
 		return 0;
@@ -766,20 +767,21 @@
 		/* Check if we already have the interface */
 		ifl = if_find(ctx, ifp->name);
 		if (ifl) {
+			syslog(LOG_DEBUG, "%s: interface updated", ifl->name);
 			/* The flags and hwaddr could have changed */
 			ifl->flags = ifp->flags;
 			ifl->hwlen = ifp->hwlen;
 			if (ifp->hwlen != 0)
 				memcpy(ifl->hwaddr, ifp->hwaddr, ifl->hwlen);
 		} else {
+			syslog(LOG_DEBUG, "%s: interface added", ifp->name);
 			TAILQ_REMOVE(ifs, ifp, next);
 			TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
-		}
-		if (action > 0) {
 			init_state(ifp, ctx->argc, ctx->argv);
 			run_preinit(ifp);
+		}
+		if (action > 0)
 			dhcpcd_startinterface(ifp);
-		}
 	}
 
 	/* Free our discovered list */