]> git.ipfire.org Git - people/stevee/network.git/blame - src/hooks/zones/teredo
Remove executable permissions from source files.
[people/stevee/network.git] / src / hooks / zones / teredo
CommitLineData
28f0b4ab
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
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. /usr/lib/network/header-zone
23
24HOOK_SETTINGS="HOOK SERVER"
25
26SERVER=""
27
2181765d 28function hook_check() {
28f0b4ab
MT
29 assert isset SERVER
30}
31
2181765d 32function hook_parse_cmdline() {
28f0b4ab
MT
33 local value
34
35 while [ $# -gt 0 ]; do
36 case "${1}" in
37 --server=*)
38 SERVER=$(cli_get_val ${1})
39 ;;
40 *)
41 echo "Unknown option: ${1}" >&2
42 exit ${EXIT_ERROR}
43 ;;
44 esac
45 shift
46 done
47}
48
2181765d 49function hook_up() {
28f0b4ab
MT
50 local zone=${1}
51 assert isset zone
52
53 teredo_start ${zone}
54
55 exit ${EXIT_OK}
56}
57
2181765d 58function hook_down() {
28f0b4ab
MT
59 local zone=${1}
60 assert isset zone
61
62 teredo_stop ${zone}
63
64 exit ${EXIT_OK}
65}
66
2181765d 67function hook_status() {
28f0b4ab 68 local zone=${1}
28f0b4ab
MT
69 assert isset zone
70
3cb2fc42
MT
71 # Print a nice header.
72 cli_device_headline ${zone}
28f0b4ab
MT
73
74 zone_config_read ${zone}
75
3cb2fc42
MT
76 cli_headline 2 "Configuration"
77 cli_print_fmt1 2 "Server" "${SERVER}"
28f0b4ab
MT
78
79 # Exit if zone is down
80 if ! zone_is_up ${zone}; then
3cb2fc42 81 cli_space
28f0b4ab
MT
82 exit ${EXIT_ERROR}
83 fi
84
3cb2fc42
MT
85 cli_headline 2 "Protocol information"
86 cli_print_fmt1 2 "MTU" "$(device_get_mtu ${zone})"
87 cli_space
28f0b4ab
MT
88
89 exit ${EXIT_OK}
90}