]> git.ipfire.org Git - people/stevee/network.git/blob - functions.teredo
hostapd: Enable WMM by default.
[people/stevee/network.git] / functions.teredo
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Network 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 function teredo_start() {
23 local zone=${1}
24 assert isset zone
25
26 service_start "miredo-client@${zone}.service"
27 }
28
29 function teredo_stop() {
30 local zone=${1}
31 assert isset zone
32
33 # Just stop the miredo daemon for this device.
34 service_stop "miredo-client@${zone}.service"
35 }
36
37 function teredo_write_config() {
38 local zone=${1}
39 local file=${2}
40 shift 2
41
42 assert isset zone
43 assert isset file
44
45 local server
46
47 while [ $# -gt 0 ]; do
48 case "${1}" in
49 --server=*)
50 server=$(cli_get_val ${1})
51 ;;
52 esac
53 shift
54 done
55
56 # Check if all required parameters are correctly set.
57 assert isset server
58
59 # Create the file's directory if necessary and
60 # make sure there is nothing in the file, yet.
61 mkdir -p $(dirname ${file}) 2>/dev/null
62 : > ${file}
63
64 # Print the header.
65 ( echo "#"
66 echo "# This is a miredo client configuration file for ${interface}."
67 echo "# THIS FILE IS AUTOMATICALLY GENERATED AND WILL OVERWRITE"
68 echo "# ANY CUSTOM CHANGES!"
69 echo "#"
70 echo "# $(date -u)"
71 echo "#"
72 echo
73 ) >>${file}
74
75 # All teredo connections we have are in client mode.
76 echo "RelayType client" >> ${file}
77
78 # The interface equals the name of the zone.
79 echo "InterfaceName ${zone}" >> ${file}
80
81 # Add the server information.
82 echo "ServerAddress ${server}" >> ${file}
83
84 exit ${EXIT_OK}
85 }