]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
network: Some code cleanup.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 Jul 2010 12:59:05 +0000 (14:59 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 Jul 2010 12:59:05 +0000 (14:59 +0200)
functions.constants
functions.device
functions.ethernet
functions.events
functions.logging
functions.ports
functions.wireless
hooks/zones/bridge.ports/wireless-ap [changed from file to symlink]

index 75ad577952a7c800badbac160ff5ffb5bf698d47..4dd919831a3eaaf5be6d3f295cfb6d6398ef027b 100644 (file)
@@ -43,7 +43,7 @@ DB_CONNECTION_FILE="${LOG_DIR}/connections.db"
 EXIT_OK=0
 EXIT_ERROR=1
 EXIT_CONF_ERROR=2
-EXIT_ERROR_ASSERT=3 # XXX needs check 
+EXIT_ERROR_ASSERT=3
 
 STATUS_UP=0
 STATUS_DOWN=1
index d0ab0ce36085c60146637ee40c92a678c03edeb4..40e8eb4415c0d0e0892aba6d90001fd18c193ad3 100644 (file)
@@ -292,25 +292,6 @@ function device_is_used() {
        return ${EXIT_ERROR}
 }
 
-# XXX to be removed I think
-function device_get_free() {
-       local destination=${1}
-
-       # Replace + by a valid number
-       if grep -q "+$" <<<${destination}; then
-               local number=0
-               destination=$(sed -e "s/+//" <<<$destination)
-               while [ "${number}" -le "100" ]; do
-                       if ! device_exists "${destination}${number}"; then
-                               destination="${destination}${number}"
-                               break
-                       fi
-                       number=$(($number + 1))
-               done
-       fi
-       echo "${destination}"
-}
-
 function device_hash() {
        local device=${1}
 
@@ -324,7 +305,7 @@ function device_hash() {
 # Give the device a new name
 function device_set_name() {
        local source=$1
-       local destination=$(device_get_free ${2})
+       local destination=${2}
 
        # Check if devices exists
        if ! device_exists ${source} || device_exists ${destination}; then
index 189950fe6a979619511229929e5ae2d4f8f72681..71cd5ad06454986951771beaf4cc67f9511307d3 100644 (file)
@@ -1,2 +1,20 @@
 #!/bin/bash
-# XXX header missing
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
index 7ba44e89df402b0628b1696236d765e6340bd0c5..895f801007a282ac657610417d046dca2cc96b7b 100644 (file)
@@ -1,4 +1,23 @@
 #!/bin/bash
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 function event_emit() {
        local event=${1}
index db5c8efa201fa966f54ccf6a8806b2098beff306..e909a74e5a712c3240072b1e1e7a4c0fa68027c6 100644 (file)
@@ -1,4 +1,23 @@
 #!/bin/bash
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 LOG_FACILITY="network"
 LOG_LEVEL="DEBUG"
index 74be61df6910eba8e440e2f226fdc4451f162ebb..feecaa241b02e33c8790ed6c6f64305530d64d78 100644 (file)
@@ -1,5 +1,23 @@
 #!/bin/bash
-# XXX header missing
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 function port_dir() {
        echo "${CONFIG_DIR}/ports"
index 7cfd7f13fb2f6207b2170e7a9f0bcc4b3af3aacb..07a2ee099885522c6af1c3f47637208dbad73727 100644 (file)
@@ -1,5 +1,23 @@
 #!/bin/bash
-# XXX header missing
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 PHY_DIR="/sys/class/ieee80211"
 
deleted file mode 100755 (executable)
index f7dd5064a9c78385af4cfbecd563a83d95b9e718..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/bin/bash
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2010  Michael Tremer & Christian Schmidt                      #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-. /lib/network/header-port
-
-HOOK_SETTINGS="COST PRIORITY"
-
-function _check() {
-       local i
-       for i in COST PRIORITY; do
-               if isset ${i}; then
-                       assert isinteger ${i}
-               fi
-       done
-}
-
-function _add() {
-       local zone=${1}
-       local port=${2}
-       shift 2
-
-       assert isset zone
-       assert isset port
-
-       if ! port_exists ${port}; then
-               error "Port '${port}' does not exist."
-               exit ${EXIT_ERROR}
-       fi
-
-       config_read $(zone_dir ${zone})/ports/${port}
-
-       while [ $# -gt 0 ]; do
-               case "${1}" in
-                       --priority=*)
-                               PRIORITY=${1#--priority=}
-                               ;;
-                       --cost=*)
-                               COST=${1#--cost=}
-                               ;;
-               esac
-               shift
-       done
-
-       config_write $(zone_dir ${zone})/ports/${port} ${HOOK_SETTINGS}
-
-       exit ${EXIT_OK}
-}
-
-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}
-
-       assert isset zone
-       assert isset port
-
-       assert zone_exists ${zone}
-       assert port_exists ${port}
-
-       port_up ${port}
-
-       # Set same MTU to device that the bridge has got
-       device_set_mtu ${port} $(device_get_mtu ${zone})
-
-       bridge_attach_device ${zone} ${port}
-
-       # XXX must set cost and prio here
-
-       exit ${EXIT_OK}
-}
-
-function _down() {
-       local zone=${1}
-       local port=${2}
-
-       assert isset zone
-       assert isset port
-
-       assert zone_exists ${zone}
-       assert port_exists ${port}
-
-       bridge_detach_device ${zone} ${port}
-
-       port_down ${port}
-
-       exit ${EXIT_OK}
-}
-
-function _status() {
-       local zone=${1}
-       local port=${2}
-
-       printf "        %-10s - " "${port}"
-       if ! device_is_up ${port}; then
-               echo -ne "${COLOUR_DOWN}   DOWN   ${COLOUR_NORMAL}"
-       else
-               local state=$(stp_port_state ${zone} ${port})
-               local colour="COLOUR_STP_${state}"
-               printf "${!colour}%10s${COLOUR_NORMAL}" ${state}
-
-               echo -n " - DSR: $(stp_port_designated_root ${zone} ${port})"
-               echo -n " - Cost: $(stp_port_pathcost ${zone} ${port})"
-       fi
-
-       echo
-
-       exit ${EXIT_OK}
-}
-
-run $@
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..3857774abcff9e4c36abf3b1d399afd4f65ea037
--- /dev/null
@@ -0,0 +1 @@
+ethernet
\ No newline at end of file