]>
git.ipfire.org Git - network.git/blob - bridge-stp
2 ###############################################################################
4 # IPFire - An Open Source Firewall Solution #
5 # Copyright (C) 2011 IPFire development team #
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 ###############################################################################
25 # Change LOG_FACILITY that we will find our messages in syslog.
26 LOG_FACILITY
=$
(basename ${0})
28 .
/usr
/lib
/network
/functions
36 # Exit immediately, if zone configuration does not exist.
37 # This is for manually created bridges.
38 if ! zone_exists
${zone}; then
39 exit ${EXIT_KERNEL_STP}
42 # Read zone configuration.
43 zone_config_read
${zone}
45 # Make sure STP is enabled for this zone.
48 log DEBUG
"Configured STP mode is '${STP_MODE}'"
52 # Check if mstpd is running. If not, try to start it.
53 if ! service_is_active mstpd
; then
54 service_start
"mstpd.service"
56 if ! service_is_active
"mstpd.service"; then
57 log ERROR
"mstpd is not running. STP might not work."
62 # Tell mstpd that STP has to be enabled/disabled.
65 log DEBUG
"Enabling userspace STP for zone '${zone}'"
66 exec mstpctl addbridge
${zone}
69 log DEBUG
"Disabling userspace STP for zone '${zone}'"
70 exec mstpctl delbridge
${zone}
74 log ERROR
"Could not properly exec mstpctl."
79 log DEBUG
"Enabling kernel STP for zone '${zone}'"
80 exit ${EXIT_KERNEL_STP}
83 log DEBUG
"Disabling kernel STP for zone '${zone}'"
90 # Fall back to kernel STP.
91 exit ${EXIT_KERNEL_STP}