]> git.ipfire.org Git - people/stevee/network.git/commitdiff
port: Allow destroying ports that are detached
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Aug 2017 21:23:03 +0000 (23:23 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Aug 2017 21:23:03 +0000 (23:23 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ports

index fcb92066cadca8d728a4edaaf8d30e6135fd31f1..82f9cde2e8de3bb3535870d8981399fe88eb10d9 100644 (file)
@@ -183,8 +183,10 @@ port_destroy() {
 
        local attached_zone=$(port_is_attached ${port})
        if [ -n "${attached_zone}" ]; then
-               error_log "Cannot destroy port '${port}' which is attached to zone '${attached_zone}'."
-               ok=${EXIT_ERROR}
+               if ! zone_port_detach "${attached_zone}" "${port}"; then
+                       error "Could not remove port ${port} from zone ${zone}"
+                       return ${EXIT_ERROR}
+               fi
        fi
 
        # Check if the port is linked to any other port and don't allow the user