From: Michael Tremer Date: Sat, 23 Jun 2012 10:29:07 +0000 (+0000) Subject: ppp: Make up/down scripts usable for other things. X-Git-Tag: 004~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e814246d9b3b9c9af511b4837da579a2059a0fe3;p=network.git ppp: Make up/down scripts usable for other things. If there is no such zone, we don't do anything. --- diff --git a/ppp/ip-updown b/ppp/ip-updown index 7871681c..3d2cfc5b 100755 --- a/ppp/ip-updown +++ b/ppp/ip-updown @@ -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}