]> git.ipfire.org Git - people/stevee/network.git/blobdiff - hooks/zones/bridge.ports/virtual
network: Magnificent changes on code.
[people/stevee/network.git] / hooks / zones / bridge.ports / virtual
deleted file mode 100755 (executable)
index 0e350bbb8379a9e496dffddfccd6190c3e330a23..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,149 +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="HOOK DEVICE DEVICE_MAC DEVICE_VID"
-
-DEVICE_MAC=$(mac_generate)
-
-function _check() {
-       assert ismac DEVICE
-       assert ismac DEVICE_MAC
-
-       assert isinteger DEVICE_VID
-
-       if [ ${DEVICE_VID} -gt 4096 ]; then
-               error "DEVICE_VID is greater than 4096."
-               exit ${EXIT_ERROR}
-       fi
-
-       local reserved
-       for reserved in 0 4095; do
-               if [ "${DEVICE_VID}" = "${reserved}" ]; then
-                       error "DEVICE_VID=${reserved} is reserved."
-                       exit ${EXIT_ERROR}
-               fi
-       done
-}
-
-function _create() {
-       local zone=${1}
-       local device=${2}
-       shift 2
-
-       while [ $# -gt 0 ]; do
-               case "${1}" in
-                       --mac=*)
-                               DEVICE_MAC=${1#--mac=}
-                               ;;
-                       --id=*)
-                               DEVICE_VID=${1#--id=}
-                               ;;
-                       *)
-                               warning "Unknown argument '${1}'"
-                               ;;                      
-               esac
-               shift
-       done
-
-       DEVICE=$(macify ${device})
-
-       _check
-
-       config_write $(zone_dir ${zone})/port.${HOOK}.$(device_hash ${device}).${DEVICE_VID} ${HOOK_SETTINGS}
-
-       exit ${EXIT_OK} 
-}
-
-function _edit() {
-       local zone=${1}
-
-       error "TODO - edit mac addres"
-
-       exit ${EXIT_ERROR}
-}
-
-function _up() {
-       local zone=${1}
-       local port=${2}
-
-       config_read $(zone_dir ${zone})/${port}
-
-       if ! device_exists $(devicify ${DEVICE_MAC}); then
-               device_virtual_create ${DEVICE} ${DEVICE_VID} ${DEVICE_MAC}
-       fi
-
-       local device=$(devicify ${DEVICE_MAC})
-
-       # Set same MTU to device that the bridge has got
-       device_set_mtu ${device} $(device_get_mtu ${zone})
-
-       bridge_attach_device ${zone} ${device}
-
-       exit ${EXIT_OK}
-}
-
-function _down() {
-       local zone=${1}
-       local port=${2}
-
-       config_read $(zone_dir ${zone})/${port}
-
-       local device=$(devicify ${DEVICE_MAC})
-
-       if ! device_exists ${device}; then
-               error "Device '${DEVICE_MAC}' does not exist."
-               exit ${EXIT_ERROR}
-       fi
-
-       bridge_detach_device ${zone} ${device}
-
-       device_virtual_remove ${device}
-
-       exit ${EXIT_OK}
-}
-
-function _status() {
-       local zone=${1}
-       local port=${2}
-
-       config_read $(zone_dir ${zone})/${port}
-
-       local device=$(devicify ${DEVICE_MAC})
-
-       printf "        %-10s - " "${device}"
-       if ! device_is_up ${device}; then
-               echo -ne "${COLOUR_DOWN}   DOWN   ${COLOUR_NORMAL}"
-       else
-               local state=$(stp_port_state ${zone} ${device})
-               local colour="COLOUR_STP_${state}"
-               printf "${!colour}%10s${COLOUR_NORMAL}" ${state}
-       fi
-
-       echo -n " - DSR: $(stp_port_designated_root ${zone} ${device})"
-       echo -n " - Cost: $(stp_port_pathcost ${zone} ${device})"
-       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