]>
git.ipfire.org Git - people/stevee/network.git/blob - zone
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2009 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 ###############################################################################
23 .
/lib
/network
/functions
25 while [ "$#" -gt "0" ]; do
38 if [ -z "${zone}" ] ||
[ -z "${action}" ]; then
39 log_failure_msg
"Wrong number of arguments."
43 if ! zone_exists
${zone}; then
44 echo "Zone ${zone} does not exist."
50 message
="Bringing up zone ${zone}..."
52 hooks_run_all pre-up
${CONFIG_ZONES}/${zone} --zone=${zone}
54 if ! zone_is_up
${zone}; then
55 # Create and bring up the zone
56 brctl addbr
${zone} || failed
=1
57 brctl stp
${zone} on || failed
=1
58 brctl setfd
${zone} 0 || failed
=1
59 ip link
set ${zone} up || failed
=1
61 evaluate_retval standard
64 # First bring up the ports to be able to start something like
65 # a dhcp client that needs a running interface.
66 hooks_run_ports post-up
${CONFIG_ZONES}/${zone} --zone=${zone}
67 hooks_run_zones post-up
${CONFIG_ZONES}/${zone} --zone=${zone}
71 message
="Bringing down zone ${zone}..."
73 if zone_is_up
${zone}; then
74 hooks_run_zones pre-down
${CONFIG_ZONES}/${zone} --zone=${zone}
75 hooks_run_ports pre-down
${CONFIG_ZONES}/${zone} --zone=${zone}
77 # Bring down the zone and delete it
78 ip link
set ${zone} down || failed
=1
79 brctl delbr
${zone} || failed
=1
81 evaluate_retval standard
83 hooks_run_all post-down
${CONFIG_ZONES}/${zone} --zone=${zone}
85 log_warning_msg
${message}
86 log_warning_msg
"Zone ${zone} does not exist."