]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
network: Add possibility to remove ports from zone of type bridge.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 Jul 2010 17:56:44 +0000 (19:56 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 Jul 2010 17:56:44 +0000 (19:56 +0200)
hooks/zones/bridge.ports/ethernet

index 1bef35901cbfa6b9be94ae3e544bbc0bc70c109b..f7dd5064a9c78385af4cfbecd563a83d95b9e718 100755 (executable)
@@ -68,6 +68,30 @@ function _edit() {
        _add $@
 }
 
+function _rem() {
+       local zone=${1}
+       local port=${2}
+
+       assert isset zone
+       assert isset port
+
+       assert zone_exists ${zone}
+
+       if ! listmatch ${port} $(zone_get_ports ${zone}); then
+               error "Port '${port}' does not belong to '${zone}'."
+               error "Won't remove anything."
+               exit ${EXIT_ERROR}
+       fi
+
+       if port_exists ${port}; then
+               ( _down ${zone} ${port} )
+       fi
+
+       rm -f $(zone_dir ${zone})/ports/${port}
+
+       exit ${EXIT_OK}
+}
+
 function _up() {
        local zone=${1}
        local port=${2}