]> git.ipfire.org Git - network.git/commitdiff
ppp: Make up/down scripts usable for other things.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 23 Jun 2012 10:29:07 +0000 (10:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 23 Jun 2012 10:29:07 +0000 (10:29 +0000)
If there is no such zone, we don't do anything.

ppp/ip-updown

index 7871681c1688273e8519be4de06d8ebd59a430e3..3d2cfc5b060dfa34ac4f819274502461fe8d07cc 100755 (executable)
@@ -31,19 +31,28 @@ done
 
 # Zone equals IFNAME
 ZONE=${PPP_IFNAME}
-
 assert isset ZONE
-assert zone_exists ${ZONE}
 
-HOOK=$(zone_get_hook ${ZONE})
+# If the given device is a known zone, we will call the required
+# hook methods. If we don't know about any zone with name ${ZONE},
+# we do nothing.
+
+if zone_exists ${ZONE}; then
+       HOOK=$(zone_get_hook ${ZONE})
+
+       assert isset HOOK
+       assert hook_zone_exists ${HOOK}
+
+       PROGNAME=$(basename ${0})
+       assert isset PROGNAME
 
-assert isset HOOK
-assert hook_zone_exists ${HOOK}
+       log DEBUG "${PROGNAME} was called with the following parameters:"
+       log DEBUG "  $@"
 
-PROGNAME=$(basename ${0})
-assert isset PROGNAME
+       hook_zone_exec ${HOOK} ppp-${PROGNAME} ${ZONE}
+       local ret=$?
 
-log DEBUG "${PROGNAME} was called with the following parameters:"
-log DEBUG "  $@"
+       exit ${ret}
+fi
 
-hook_zone_exec ${HOOK} ppp-${PROGNAME} ${ZONE}
+exit ${EXIT_OK}