From email:
Yes, but it have issues:
1) After log ERROR script should return failure (!=0) - after all, user-space
stp was not setup correctly and kernel should know it. So "exit 1" should be
inserted in two places:
after log ERROR "mstpd is not running. STP might not work."
and
after log ERROR "Unknown action given: ${action}."
2) If zone does not exist script also should return failure (!=0). Kernel
should know that user-space stp was not started.
3) I assume your "assert " function returns failure(non-zero) too ;)
4) mstpctl MUST be run through exec call.
5) thanks to above "assert" in the start case can be omitted - execution flow
will never go that far.
6) The final "exit 0" is superfluous.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Exit immediately, if zone configuration does not exist.
# This is for manually created bridges.
if ! zone_exists ${zone}; then
# Exit immediately, if zone configuration does not exist.
# This is for manually created bridges.
if ! zone_exists ${zone}; then
fi
# Check if mstpd is running. If not, try to start it.
fi
# Check if mstpd is running. If not, try to start it.
if ! service_is_active mstpd; then
log ERROR "mstpd is not running. STP might not work."
if ! service_is_active mstpd; then
log ERROR "mstpd is not running. STP might not work."
case "${action}" in
start)
log DEBUG "Enabling STP for zone '${zone}'."
case "${action}" in
start)
log DEBUG "Enabling STP for zone '${zone}'."
- mstpctl notify-daemon-that-stp-is-on ${zone}
- assert [ $? -eq 0 ]
+ exec mstpctl notify-daemon-that-stp-is-on ${zone}
;;
stop)
log DEBUG "Disabling STP for zone '${zone}'."
;;
stop)
log DEBUG "Disabling STP for zone '${zone}'."
- mstpctl notify-daemon-that-stp-is-off ${zone}
+ exec mstpctl notify-daemon-that-stp-is-off ${zone}
;;
*)
log ERROR "Unknown action given: ${action}."
;;
*)
log ERROR "Unknown action given: ${action}."