]> git.ipfire.org Git - people/stevee/network.git/commitdiff
bridge: Reorder functions into the common order
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Sep 2018 21:17:30 +0000 (23:17 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Sep 2018 21:37:32 +0000 (23:37 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/zones/bridge

index d610814a908ec8335caaf140887854340430c16b..fb81673c90a3255f65fb9963cd086d4de16ace63 100644 (file)
@@ -172,53 +172,6 @@ hook_up() {
        exit ${EXIT_OK}
 }
 
-hook_hotplug() {
-       local zone="${1}"
-       assert isset zone
-
-       case "$(hotplug_action)" in
-               add)
-                       # Attach all ports when zone is coming up
-                       if hotplug_event_interface_is_zone "${zone}"; then
-                               # Bring up all ports
-                               local port
-                               for port in $(zone_get_ports "${zone}"); do
-                                       log DEBUG "Trying to attach port ${port} to ${zone}"
-
-                                       hook_port_up "${zone}" "${port}"
-                               done
-
-                       # Handle ports of this zone that have just been added
-                       elif hotplug_event_interface_is_port_of_zone "${zone}"; then
-                               # Attach the device if the parent bridge is up
-                               if zone_is_active "${zone}"; then
-                                       hook_port_up "${zone}" "${INTERFACE}"
-                               fi
-                       fi
-                       ;;
-               remove)
-                       if hotplug_event_interface_is_zone "${zone}"; then
-                               # Bring down/destroy all ports
-                               local port
-                               for port in $(zone_get_ports "${zone}"); do
-                                       log DEBUG "Trying to detach port ${port} from ${zone}"
-
-                                       hook_port_down "${zone}" "${port}"
-                               done
-
-                       # Handle ports of this zone that have just been removed
-                       elif hotplug_event_interface_is_port_of_zone "${zone}"; then
-                               hook_port_down "${zone}" "${INTERFACE}"
-                       fi
-                       ;;
-               *)
-                       exit ${EXIT_NOT_HANDLED}
-                       ;;
-       esac
-
-       exit ${EXIT_OK}
-}
-
 hook_down() {
        local zone="${1}"
        assert isset zone
@@ -294,6 +247,55 @@ hook_status() {
        exit ${EXIT_OK}
 }
 
+hook_hotplug() {
+       local zone="${1}"
+       assert isset zone
+
+       case "$(hotplug_action)" in
+               add)
+                       # Attach all ports when zone is coming up
+                       if hotplug_event_interface_is_zone "${zone}"; then
+                               # Bring up all ports
+                               local port
+                               for port in $(zone_get_ports "${zone}"); do
+                                       log DEBUG "Trying to attach port ${port} to ${zone}"
+
+                                       hook_port_up "${zone}" "${port}"
+                               done
+
+                       # Handle ports of this zone that have just been added
+                       elif hotplug_event_interface_is_port_of_zone "${zone}"; then
+                               # Attach the device if the parent bridge is up
+                               if zone_is_active "${zone}"; then
+                                       hook_port_up "${zone}" "${INTERFACE}"
+                               fi
+                       fi
+                       ;;
+
+               remove)
+                       if hotplug_event_interface_is_zone "${zone}"; then
+                               # Bring down/destroy all ports
+                               local port
+                               for port in $(zone_get_ports "${zone}"); do
+                                       log DEBUG "Trying to detach port ${port} from ${zone}"
+
+                                       hook_port_down "${zone}" "${port}"
+                               done
+
+                       # Handle ports of this zone that have just been removed
+                       elif hotplug_event_interface_is_port_of_zone "${zone}"; then
+                               hook_port_down "${zone}" "${INTERFACE}"
+                       fi
+                       ;;
+
+               *)
+                       exit ${EXIT_NOT_HANDLED}
+                       ;;
+       esac
+
+       exit ${EXIT_OK}
+}
+
 hook_check_port_settings() {
        if isset COST; then
                assert isinteger COST