]>
git.ipfire.org Git - people/stevee/network.git/blob - hooks/zones/bridge.ports/ethernet
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 .
/lib
/network
/header-port
24 HOOK_SETTINGS
="HOOK DEVICE"
36 if [ -z "${device}" ]; then
37 error
"No device given."
41 if ! device_exists
${device}; then
42 warning
"Device does not exist."
45 DEVICE
=$
(macify
${device})
47 config_write $
(zone_dir
${zone})/port.${HOOK}.$(device_hash ${device}) ${HOOK_SETTINGS}
56 config_read $
(zone_dir
${zone})/${port}
58 local device
=$
(devicify
${DEVICE})
60 if ! device_exists
${device}; then
61 warning
"Device '${DEVICE}' does not exist."
65 # Set same MTU to device that the bridge has got
66 device_set_mtu
${device} $
(device_get_mtu
${zone})
68 device_set_up
${device}
70 bridge_attach_device
${zone} ${device}
79 config_read $
(zone_dir
${zone})/${port}
81 local device
=$
(devicify
${DEVICE})
83 if ! device_exists
${device}; then
84 warning
"Device '${DEVICE}' does not exist."
88 bridge_detach_device
${zone} ${device}
90 device_set_down
${device}
99 config_read $
(zone_dir
${zone})/${port}
101 local device
=$
(devicify
${DEVICE})
103 printf " %-10s - " "${device}"
104 if ! device_is_up
${device}; then
105 echo -ne "${COLOUR_DOWN} DOWN ${COLOUR_NORMAL}"
107 local state
=$
(stp_port_state
${zone} ${device})
108 local colour
="COLOUR_STP_${state}"
109 printf "${!colour}%10s${COLOUR_NORMAL}" ${state}
112 echo -n " - DSR
: $
(stp_port_designated_root
${zone} ${device})"
113 echo -n " - Cost
: $
(stp_port_pathcost
${zone} ${device})"