#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2012 IPFire Network Development Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### function teredo_start() { local zone=${1} assert isset zone service_start "miredo-client@${zone}.service" } function teredo_stop() { local zone=${1} assert isset zone # Just stop the miredo daemon for this device. service_stop "miredo-client@${zone}.service" } function teredo_write_config() { local zone=${1} local file=${2} shift 2 assert isset zone assert isset file local server while [ $# -gt 0 ]; do case "${1}" in --server=*) server=$(cli_get_val ${1}) ;; esac shift done # Check if all required parameters are correctly set. assert isset server # Create the file's directory if necessary and # make sure there is nothing in the file, yet. mkdir -p $(dirname ${file}) 2>/dev/null : > ${file} # Print the header. ( echo "#" echo "# This is a miredo client configuration file for ${interface}." echo "# THIS FILE IS AUTOMATICALLY GENERATED AND WILL OVERWRITE" echo "# ANY CUSTOM CHANGES!" echo "#" echo "# $(date -u)" echo "#" echo ) >>${file} # All teredo connections we have are in client mode. echo "RelayType client" >> ${file} # The interface equals the name of the zone. echo "InterfaceName ${zone}" >> ${file} # Add the server information. echo "ServerAddress ${server}" >> ${file} exit ${EXIT_OK} }