]> git.ipfire.org Git - people/ms/network.git/blame - src/helpers/pppd-angel
dns: Always enable EDNS0
[people/ms/network.git] / src / helpers / pppd-angel
CommitLineData
943e3f7e
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
ea5f6354 5# Copyright (C) 2013 IPFire Network Development Team #
943e3f7e
MT
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
97cb552e 22. /usr/lib/network/functions
943e3f7e 23
e9df08ad
MT
24# Read network settings
25network_settings_read
26
1c6a4e30 27main() {
ea5f6354
MT
28 local zone="${1}"
29 assert isset zone
943e3f7e 30
ea5f6354
MT
31 if ! zone_exists "${zone}"; then
32 log ERROR "Must pass valid zone: ${zone}"
33 return ${EXIT_ERROR}
34 fi
943e3f7e 35
ea5f6354
MT
36 # Find the hook of the zone, we got.
37 local hook="$(zone_get_hook "${zone}")"
38 assert isset hook
943e3f7e 39
ea5f6354
MT
40 # Write pppd configuration file.
41 local config_file="${RUN_DIR}/ppp/${zone}/pppd.conf"
42 hook_exec zone "${hook}" "ppp_write_config" "${zone}" "${config_file}"
943e3f7e 43
ea5f6354
MT
44 # Create trap function
45 function cleanup() {
46 rm -f "${config_file}"
47 }
48 trap "cleanup" EXIT TERM KILL
943e3f7e 49
ea5f6354 50 # Start the angel process.
c4906e27
MT
51 pppd_angel "${zone}" "${config_file}" \
52 --holdoff-time="10"
ea5f6354 53}
943e3f7e 54
ea5f6354 55main "$@" || exit $?
943e3f7e 56
97cb552e 57exit ${EXIT_OK}