From: Roy Marples Date: Fri, 16 Dec 2011 12:20:04 +0000 (+0000) Subject: Fix hook for non RA's. X-Git-Tag: v5.5.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f36522c53f7b9299114e8a403368d8837193e273;p=thirdparty%2Fdhcpcd.git Fix hook for non RA's. Remove RA's before the DHCP lease. Correctly send 3 RA solicitations. --- diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index 8c1871e8..52a1e18c 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -12,10 +12,12 @@ state_dir=/var/run/dhcpcd if_up=false if_down=false case "$reason" in -BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC|ROUTERADVERT) if_up=true;; -PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) if_down=true;; +BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) if_up=true;; +PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) if_down=true;; esac +[ "$reason" = ROUTERADVERT -a "$ra_count" != 0 ] && if_up=true + # Ensure that all arguments are unique uniqify() { diff --git a/dhcpcd.c b/dhcpcd.c index 15cf2ad0..31ca94a9 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -244,14 +244,14 @@ stop_interface(struct interface *iface) struct interface *ifp, *ifl = NULL; syslog(LOG_INFO, "%s: removing interface", iface->name); - if (strcmp(iface->state->reason, "RELEASE") != 0) - drop_dhcp(iface, "STOP"); if (iface->ras) { ipv6rs_free(iface); iface->ras = NULL; iface->state->reason = "ROUTERADVERT"; run_script(iface); } + if (strcmp(iface->state->reason, "RELEASE") != 0) + drop_dhcp(iface, "STOP"); close_sockets(iface); delete_timeout(NULL, iface); for (ifp = ifaces; ifp; ifp = ifp->next) { diff --git a/ipv6rs.c b/ipv6rs.c index 02490ed5..1caf9122 100644 --- a/ipv6rs.c +++ b/ipv6rs.c @@ -207,7 +207,7 @@ ipv6rs_sendprobe(void *arg) if (sendmsg(sock, &sndhdr, 0) == -1) syslog(LOG_ERR, "%s: sendmsg: %m", ifp->name); - if (++ifp->rsprobes < MAX_RTR_SOLICITATIONS) + if (ifp->rsprobes++ < MAX_RTR_SOLICITATIONS) add_timeout_sec(RTR_SOLICITATION_INTERVAL, ipv6rs_sendprobe, ifp); else @@ -519,6 +519,7 @@ ipv6rs_handledata(_unused void *arg) if (options & DHCPCD_TEST) exit(EXIT_SUCCESS); + delete_q_timeout(0, handle_exit_timeout, NULL); delete_timeouts(ifp, NULL); ipv6rs_expire(ifp); daemonise();