]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Show renew and rebind times when debugging is enabled.
authorRoy Marples <roy@marples.name>
Sat, 27 Oct 2012 11:38:17 +0000 (11:38 +0000)
committerRoy Marples <roy@marples.name>
Sat, 27 Oct 2012 11:38:17 +0000 (11:38 +0000)
Trying to help #259.

bind.c
dhcpcd.c

diff --git a/bind.c b/bind.c
index 889d99e8cf8ecd7e54264f8fafc146ea5542dafe..30e639acb46170e61cc0f86c893e66fc2341c4f8 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -223,6 +223,9 @@ bind_interface(void *arg)
                add_timeout_sec(lease->renewaltime, start_renew, iface);
                add_timeout_sec(lease->rebindtime, start_rebind, iface);
                add_timeout_sec(lease->leasetime, start_expire, iface);
+               syslog(LOG_DEBUG,
+                   "%s: renew in %u seconds, rebind in %u seconds",
+                   iface->name, lease->renewaltime, lease->rebindtime);
        }
        ifo->options &= ~ DHCPCD_CSR_WARNED;
        configure(iface);
index cb47396213333386fe6de5cf0124c2f873cd6ecd..8fd3fdc99ac45ccccba6643cdbcc1dd2ce5c768a 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1016,9 +1016,12 @@ void
 start_renew(void *arg)
 {
        struct interface *iface = arg;
+       struct dhcp_lease *lease = &iface->state->lease;
 
        syslog(LOG_INFO, "%s: renewing lease of %s",
-           iface->name, inet_ntoa(iface->state->lease.addr));
+           iface->name, inet_ntoa(lease->addr));
+       syslog(LOG_DEBUG, "%s: rebind in %u seconds",
+          iface->name, lease->rebindtime - lease->renewaltime);
        iface->state->state = DHS_RENEW;
        iface->state->xid = dhcp_xid(iface);
        send_renew(iface);
@@ -1028,9 +1031,12 @@ void
 start_rebind(void *arg)
 {
        struct interface *iface = arg;
+       struct dhcp_lease *lease = &iface->state->lease;
 
        syslog(LOG_ERR, "%s: failed to renew, attempting to rebind",
            iface->name);
+       syslog(LOG_DEBUG, "%s: expre in %u seconds",
+          iface->name, lease->leasetime - lease->rebindtime);
        iface->state->state = DHS_REBIND;
        delete_timeout(send_renew, iface);
        iface->state->lease.server.s_addr = 0;