]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix hook for non RA's.
authorRoy Marples <roy@marples.name>
Fri, 16 Dec 2011 12:20:04 +0000 (12:20 +0000)
committerRoy Marples <roy@marples.name>
Fri, 16 Dec 2011 12:20:04 +0000 (12:20 +0000)
Remove RA's before the DHCP lease.
Correctly send 3 RA solicitations.

dhcpcd-run-hooks.in
dhcpcd.c
ipv6rs.c

index 8c1871e87c8f7278d77c79d516fdd39bd758d084..52a1e18c7ac391141ee6cc7db40d347f788db9c1 100644 (file)
@@ -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()
 {
index 15cf2ad055e4fdc63b4d2d564c95172bf54e9cb9..31ca94a971a9d5d240696ee7c0daac365e924b0a 100644 (file)
--- 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) {
index 02490ed5dd6a15aa3987f30cae7cac4954e0e3d6..1caf91229d95c39e856f20a169b62f0aba35902b 100644 (file)
--- 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();