]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If STOPPED, set if_down = true when releasing, otherwise false.
authorRoy Marples <roy@marples.name>
Fri, 28 Nov 2014 15:18:09 +0000 (15:18 +0000)
committerRoy Marples <roy@marples.name>
Fri, 28 Nov 2014 15:18:09 +0000 (15:18 +0000)
Let dhcpcd-run-hooks process STOPPED.

dhcpcd-run-hooks.in
script.c

index f1f77a866df2c0c87270853af5f13ee2fe9f2d15..fd001d4a9efe7f7a2315f07e2f9227bf658d873e 100644 (file)
@@ -7,8 +7,6 @@ case "$reason" in
                ifsuffix=":ra";;
        INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6)
                ifsuffix=":dhcp6";;
-       STOPPED) # This reason should never be processed
-               exit 0;;
        *)
                ifsuffix=;;
 esac
index 31e80fabd52a7a81baa41e930d83efaf97d42d18..9f25d166e425415dc1acdff212c5df423322c114 100644 (file)
--- a/script.c
+++ b/script.c
@@ -335,7 +335,13 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
                }
        }
        *--p = '\0';
-       if (strcmp(reason, "TEST") == 0 ||
+       if (strcmp(reason, "STOPPED") == 0) {
+               env[9] = strdup("if_up=false");
+               if (ifo->options & DHCPCD_RELEASE)
+                       env[9] = strdup("if_down=true");
+               else
+                       env[9] = strdup("if_down=false");
+       } else if (strcmp(reason, "TEST") == 0 ||
            strcmp(reason, "PREINIT") == 0 ||
            strcmp(reason, "CARRIER") == 0 ||
            strcmp(reason, "UNKNOWN") == 0)