Mercurial > hg > dhcpcd
changeset 1877:165cf2b7ff24 draft
Fix rebooting.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 26 Mar 2013 10:42:30 +0000 |
| parents | 3269612e7eaf |
| children | dd875f55ecbe |
| files | dhcp.c dhcp.h dhcpcd.c |
| diffstat | 3 files changed, 22 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/dhcp.c Tue Mar 26 10:39:46 2013 +0000 +++ b/dhcp.c Tue Mar 26 10:42:30 2013 +0000 @@ -1935,7 +1935,25 @@ } void -dhcp_reboot(struct interface *ifp, int oldopts) +dhcp_reboot_newopts(struct interface *ifp, int oldopts) +{ + struct if_options *ifo = ifp->options; + struct dhcp_state *state = D_STATE(ifp); + + if (state == NULL) + return; + ifo = ifp->options; + if ((ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC) && + state->addr.s_addr != ifo->req_addr.s_addr) || + (oldopts & (DHCPCD_INFORM | DHCPCD_STATIC) && + !(ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC)))) + { + dhcp_drop(ifp, "EXPIRE"); + } +} + +static void +dhcp_reboot(struct interface *ifp) { struct if_options *ifo = ifp->options; struct dhcp_state *state = D_STATE(ifp); @@ -1944,16 +1962,6 @@ return; ifo = ifp->options; state->interval = 0; - if ((ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC) && - state->addr.s_addr != ifo->req_addr.s_addr) || - (oldopts & (DHCPCD_INFORM | DHCPCD_STATIC) && - !(ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC)))) - { - dhcp_drop(ifp, "EXPIRE"); - } else { - free(state->offer); - state->offer = NULL; - } if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_DOWN) { syslog(LOG_INFO, "%s: waiting for carrier", ifp->name); @@ -2670,6 +2678,6 @@ ifp->options->options & DHCPCD_IPV4LL) ipv4ll_start(ifp); else - dhcp_reboot(ifp, ifp->options->options); + dhcp_reboot(ifp); }
--- a/dhcp.h Tue Mar 26 10:39:46 2013 +0000 +++ b/dhcp.h Tue Mar 26 10:42:30 2013 +0000 @@ -266,7 +266,7 @@ void dhcp_inform(struct interface *); void dhcp_release(struct interface *); void dhcp_bind(void *); -void dhcp_reboot(struct interface *, int); +void dhcp_reboot_newopts(struct interface *, int); void dhcp_close(struct interface *); void dhcp_free(struct interface *); int dhcp_dump(const char *);
--- a/dhcpcd.c Tue Mar 26 10:39:46 2013 +0000 +++ b/dhcpcd.c Tue Mar 26 10:42:30 2013 +0000 @@ -604,7 +604,7 @@ oldopts = ifp->options->options; configure_interface(ifp, argc, argv); - dhcp_reboot(ifp, oldopts); + dhcp_reboot_newopts(ifp, oldopts); start_interface(ifp); } @@ -692,9 +692,6 @@ break; case SIGALRM: syslog(LOG_INFO, "received SIGALRM, rebinding"); - /* We shouldn't modify any variables in the signal - * handler, so simply add reboot function to the queue - * for an immediate callout. */ eloop_timeout_add_now(sig_reboot, NULL); return; case SIGHUP:
