]>
git.ipfire.org Git - people/arne_f/network.git/blob - hooks/zones/bridge.ports/ethernet
f7dd5064a9c78385af4cfbecd563a83d95b9e718
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
="COST PRIORITY"
28 for i
in COST PRIORITY
; do
43 if ! port_exists
${port}; then
44 error
"Port '${port}' does not exist."
48 config_read $
(zone_dir
${zone})/ports
/${port}
50 while [ $# -gt 0 ]; do
53 PRIORITY
=${1#--priority=}
62 config_write $
(zone_dir
${zone})/ports/${port} ${HOOK_SETTINGS}
78 assert zone_exists
${zone}
80 if ! listmatch
${port} $
(zone_get_ports
${zone}); then
81 error
"Port '${port}' does not belong to '${zone}'."
82 error
"Won't remove anything."
86 if port_exists
${port}; then
87 ( _down
${zone} ${port} )
90 rm -f $
(zone_dir
${zone})/ports
/${port}
102 assert zone_exists
${zone}
103 assert port_exists
${port}
107 # Set same MTU to device that the bridge has got
108 device_set_mtu
${port} $
(device_get_mtu
${zone})
110 bridge_attach_device
${zone} ${port}
112 # XXX must set cost and prio here
124 assert zone_exists
${zone}
125 assert port_exists
${port}
127 bridge_detach_device
${zone} ${port}
138 printf " %-10s - " "${port}"
139 if ! device_is_up
${port}; then
140 echo -ne "${COLOUR_DOWN} DOWN ${COLOUR_NORMAL}"
142 local state
=$
(stp_port_state
${zone} ${port})
143 local colour
="COLOUR_STP_${state}"
144 printf "${!colour}%10s${COLOUR_NORMAL}" ${state}
146 echo -n " - DSR
: $
(stp_port_designated_root
${zone} ${port})"
147 echo -n " - Cost
: $
(stp_port_pathcost
${zone} ${port})"