]> git.ipfire.org Git - network.git/blob - src/helpers/bridge-stp
Remove support for Rapid Spanning Tree Protocol
[network.git] / src / helpers / bridge-stp
1 #!/bin/sh
2 ###############################################################################
3 # #
4 # IPFire - An Open Source Firewall Solution #
5 # Copyright (C) 2011 IPFire development team #
6 # #
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. #
11 # #
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. #
16 # #
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/>. #
19 # #
20 ###############################################################################
21
22 # Change LOG_FACILITY that we will find our messages in syslog.
23 LOG_FACILITY=$(basename ${0})
24
25 . /usr/lib/network/functions
26
27 # Read network settings
28 network_settings_read
29
30 zone=${1}
31 assert isset zone
32
33 action=${2}
34 assert isset action
35
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}
40 fi
41
42 # Read zone settings
43 zone_settings_read "${zone}" --ignore-superfluous-settings STP
44
45 # Make sure STP is enabled for this zone.
46 if ! enabled STP; then
47 log ERROR "The kernel tried to enable STP for zone ${zone}"
48 log ERROR "but our configuration disagrees"
49 exit ${EXIT_STP_ERROR}
50 fi
51
52 case "${action}" in
53 start)
54 log INFO "STP activated for ${zone}"
55 exit ${EXIT_STP_KERNEL}
56 ;;
57 stop)
58 log INFO "STP deactivated for ${zone}"
59 exit ${EXIT_OK}
60 ;;
61 *)
62 log ERROR "Unknown action: ${action}"
63 exit ${EXIT_STP_ERROR}
64 esac