]>
git.ipfire.org Git - people/ms/network.git/blob - hooks/zones/switch
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 .
/usr
/lib
/network
/header-zone
24 HOOK_SETTINGS
="HOOK MAC MTU"
30 function hook_check
() {
35 function hook_parse_cmdline
() {
36 while [ $# -gt 0 ]; do
45 warning
"Ignoring unknown option '${1}'"
56 zone_config_read
${zone}
58 # Create the interface.
59 log INFO
"Creating virtual switch '${zone}'."
62 [ -n "${MAC}" ] && device_set_address ${zone} ${MAC}
63 [ -n "${MTU}" ] && device_set_mtu ${zone} ${MTU}
70 zone_configs_up
${zone}
75 function hook_down
() {
79 zone_configs_down
${zone}
80 zone_ports_down
${zone}
83 device_set_down
${zone}
85 # Remove the virtual switch.
86 log INFO
"Removing virtual switch '${zone}'."
92 function hook_status
() {
96 # Print the default header.
97 cli_device_headline
${zone}
99 # Exit if zone is down
100 if ! zone_is_up
${zone}; then
105 cli_headline
2 "Spanning Tree Protocol information"
106 if switch_stp_is_enabled
${zone}; then
107 # local proto=$(stp_bridge_get_protocol ${zone})
109 # cli_print_fmt1 2 "Version" "$(stp_get_name ${proto})"
110 # cli_print_fmt1 2 "ID" "$(stp_bridge_get_id ${zone})"
111 # cli_print_fmt1 2 "Priority" "$(switch_stp_get_priority ${zone})"
113 # if stp_bridge_is_root ${zone}; then
114 # cli_print 2 "This bridge is root."
116 # cli_print_fmt1 2 "Designated root" \
117 # "$(stp_bridge_get_designated_root ${zone})"
118 # cli_print_fmt1 2 "Root path cost" \
119 # "$(stp_bridge_get_root_path_cost ${zone})"
123 # # Topology information
124 # cli_print_fmt1 2 "Topology changing" \
125 # "$(stp_bridge_get_topology_change_detected ${zone})"
126 # cli_print_fmt1 2 "Topology change time" \
127 # "$(beautify_time $(stp_bridge_get_topology_change_timer ${zone}))"
128 # cli_print_fmt1 2 "Topology change count" \
129 # "$(stp_bridge_get_topology_change_count ${zone})"
133 cli_print
2 "Disabled"
137 #cli_headline 2 "Ports"
138 #zone_ports_status ${zone}
141 #cli_headline 2 "Configurations"
142 #zone_configs_cmd status ${zone}