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}
96 if ! device_is_up
${zone}; then
97 warning
"Zone '${zone}' is not up"
101 zone_configs_down
${zone}
103 wpa_supplicant_stop
${zone}
105 #device_set_down ${zone}
107 wireless_remove
${zone}
116 cli_device_headline
${zone}
118 # Exit if zone is down
119 if ! zone_is_up
${zone}; then
124 # XXX Add bridge stp priority here
125 # brctl does not give any information about that
127 cli_headline
" Spanning Tree Protocol information:"
128 printf "${DEVICE_PRINT_LINE1}" "ID:" $
(stp_bridge_get_id
${zone})
129 printf "${DEVICE_PRINT_LINE1}" "Priority:" $
(stp_bridge_get_priority
${zone})
131 if stp_bridge_is_root
${zone}; then
132 echo -e " ${CLR_BLACK_B}This bridge is root.${CLR_RESET}"
134 printf "${DEVICE_PRINT_LINE1}" "Designated root:" $
(stp_bridge_get_designated_root
${zone})
135 printf "${DEVICE_PRINT_LINE1}" "Root path cost:" $
(stp_bridge_get_root_path_cost
${zone})
139 # Topology information
140 printf "${DEVICE_PRINT_LINE1}" "Topology changing:" $
(stp_bridge_get_topology_change_detected
${zone})
141 printf "${DEVICE_PRINT_LINE1}" "Topology change time:" $
(beautify_time $
(stp_bridge_get_topology_change_timer
${zone}))
142 printf "${DEVICE_PRINT_LINE1}" "Topology change count:" $
(stp_bridge_get_topology_change_count
${zone})
144 cli_headline
" Ports:"
145 zone_ports_status
${zone}
147 cli_headline
" Configurations:"
148 zone_configs_cmd status
${zone}