]>
Commit | Line | Data |
---|---|---|
30812a00 MT |
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 | ||
6c95a49a MT |
22 | # Change LOG_FACILITY that we will find our messages in syslog. |
23 | LOG_FACILITY=$(basename ${0}) | |
24 | ||
4cf2e1dd MT |
25 | . /usr/lib/network/functions |
26 | ||
6c95a49a MT |
27 | zone=${1} |
28 | action=${2} | |
29 | ||
30 | assert isset zone | |
31 | assert isset action | |
32 | ||
33 | # Exit immediately, if zone configuration does not exist. | |
34 | # This is for manually created bridges. | |
35 | if ! zone_exists ${zone}; then | |
01c87327 | 36 | exit 1 |
6c95a49a MT |
37 | fi |
38 | ||
39 | # Check if mstpd is running. If not, try to start it. | |
40 | if ! service_is_active mstpd; then | |
41 | service_start mstpd | |
42 | ||
43 | if ! service_is_active mstpd; then | |
44 | log ERROR "mstpd is not running. STP might not work." | |
01c87327 | 45 | exit 1 |
6c95a49a MT |
46 | fi |
47 | fi | |
48 | ||
49 | # Tell mstpd that STP has to be enabled/disabled. | |
50 | case "${action}" in | |
51 | start) | |
52 | log DEBUG "Enabling STP for zone '${zone}'." | |
4cf2e1dd | 53 | exec mstpctl addbridge ${zone} |
6c95a49a MT |
54 | ;; |
55 | stop) | |
56 | log DEBUG "Disabling STP for zone '${zone}'." | |
4cf2e1dd | 57 | exec mstpctl delbridge ${zone} |
6c95a49a MT |
58 | ;; |
59 | *) | |
60 | log ERROR "Unknown action given: ${action}." | |
01c87327 | 61 | exit 1 |
6c95a49a MT |
62 | ;; |
63 | esac |