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 PHY MAC MTU SSID KEY ENCRYPTION"
40 if [ -n "${ENCRYPTION}" ]; then
45 function _parse_cmdline
() {
46 while [ $# -gt 0 ]; do
58 warning
"Ignoring unknown option '${1}'"
65 PHY
=$
(phy_get_address
${PHY})
74 zone_config_read
${zone}
76 wireless_create
${zone} ${PHY} managed ${MAC}
78 [ -n "${MAC}" ] && device_set_address ${zone} ${MAC}
79 [ -n "${MTU}" ] && device_set_mtu ${zone} ${MTU}
81 # Create WPA supplicant configuration.
82 wpa_supplicant_start
${zone} --ssid=${SSID} \
83 --encryption=${ENCRYPTION} --key=${KEY}
85 #device_set_up ${zone}
87 zone_configs_up
${zone}
89 event_interface_up
${zone}
98 if ! device_is_up
${zone}; then
99 warning
"Zone '${zone}' is not up"
103 event_interface_down
${zone}
105 zone_configs_down
${zone}
107 wpa_supplicant_stop
${zone}
109 #device_set_down ${zone}
111 wireless_remove
${zone}
120 cli_device_headline
${zone}
122 # Exit if zone is down
123 if ! zone_is_up
${zone}; then
128 # XXX Add bridge stp priority here
129 # brctl does not give any information about that
131 cli_headline
" Spanning Tree Protocol information:"
132 printf "${DEVICE_PRINT_LINE1}" "ID:" $
(stp_bridge_get_id
${zone})
133 printf "${DEVICE_PRINT_LINE1}" "Priority:" $
(stp_bridge_get_priority
${zone})
135 if stp_bridge_is_root
${zone}; then
136 echo -e " ${COLOUR_BOLD}This bridge is root.${COLOUR_NORMAL}"
138 printf "${DEVICE_PRINT_LINE1}" "Designated root:" $
(stp_bridge_get_designated_root
${zone})
139 printf "${DEVICE_PRINT_LINE1}" "Root path cost:" $
(stp_bridge_get_root_path_cost
${zone})
143 # Topology information
144 printf "${DEVICE_PRINT_LINE1}" "Topology changing:" $
(stp_bridge_get_topology_change_detected
${zone})
145 printf "${DEVICE_PRINT_LINE1}" "Topology change time:" $
(beautify_time $
(stp_bridge_get_topology_change_timer
${zone}))
146 printf "${DEVICE_PRINT_LINE1}" "Topology change count:" $
(stp_bridge_get_topology_change_count
${zone})
148 cli_headline
" Ports:"
149 zone_ports_status
${zone}
151 cli_headline
" Configurations:"
152 zone_configs_cmd status
${zone}