]>
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"
27 assert isset DEVICE_MAC
28 assert ismac DEVICE_MAC
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}
59 assert zone_exists
${zone}
60 assert port_exists
${port}
64 # Set same MTU to device that the bridge has got
65 device_set_mtu
${port} $
(device_get_mtu
${zone})
67 bridge_attach_device
${zone} ${port}
79 assert zone_exists
${zone}
80 assert port_exists
${port}
82 bridge_detach_device
${zone} ${port}
93 printf " %-10s - " "${port}"
94 if ! device_is_up
${port}; then
95 echo -ne "${COLOUR_DOWN} DOWN ${COLOUR_NORMAL}"
97 local state
=$
(stp_port_state
${zone} ${port})
98 local colour
="COLOUR_STP_${state}"
99 printf "${!colour}%10s${COLOUR_NORMAL}" ${state}
101 echo -n " - DSR
: $
(stp_port_designated_root
${zone} ${port})"
102 echo -n " - Cost
: $
(stp_port_pathcost
${zone} ${port})"