]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Inform the hooks if we're running with debug or not.
authorRoy Marples <roy@marples.name>
Wed, 26 Nov 2014 14:54:14 +0000 (14:54 +0000)
committerRoy Marples <roy@marples.name>
Wed, 26 Nov 2014 14:54:14 +0000 (14:54 +0000)
dhcpcd-run-hooks.in
script.c

index 660435ee7bf18c18a4d65ad2ce9beff091bd93b5..f1f77a866df2c0c87270853af5f13ee2fe9f2d15 100644 (file)
@@ -24,6 +24,7 @@ _detected_init=false
 
 : ${if_up:=false}
 : ${if_down:=false}
+: ${syslog_debug:=false}
 
 # Ensure that all arguments are unique
 uniqify()
@@ -189,6 +190,9 @@ syslog()
 {
        local lvl="$1"
 
+       if [ "$lvl" = debug ]; then
+               ${syslog_debug} || return 0
+       fi
        [ -n "$lvl" ] && shift
        if [ -n "$*" ]; then
                if type logger >/dev/null 2>&1; then
index 21c994c4889d57231f3992fbc60a202d02970f70..0f6b360e7f708f03488988650702726dd89114ca 100644 (file)
--- a/script.c
+++ b/script.c
@@ -372,6 +372,11 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
                env[12] = strdup("if_ipwaited=false");
        if (env[12] == NULL)
                goto eexit;
+       if (ifo->options & DHCPCD_DEBUG) {
+               e = strlen("syslog_debug=true") + 1;
+               EMALLOC(elen, e);
+               snprintf(env[elen++], e, "syslog_debug=true");
+       }
        if (*ifp->profile) {
                e = strlen("profile=") + strlen(ifp->profile) + 2;
                EMALLOC(elen, e);