]>
Commit | Line | Data |
---|---|---|
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 | |
ea5f6354 MT |
24 | function main() { |
25 | local zone="${1}" | |
26 | assert isset zone | |
943e3f7e | 27 | |
ea5f6354 MT |
28 | if ! zone_exists "${zone}"; then |
29 | log ERROR "Must pass valid zone: ${zone}" | |
30 | return ${EXIT_ERROR} | |
31 | fi | |
943e3f7e | 32 | |
ea5f6354 MT |
33 | # Find the hook of the zone, we got. |
34 | local hook="$(zone_get_hook "${zone}")" | |
35 | assert isset hook | |
943e3f7e | 36 | |
ea5f6354 MT |
37 | # Write pppd configuration file. |
38 | local config_file="${RUN_DIR}/ppp/${zone}/pppd.conf" | |
39 | hook_exec zone "${hook}" "ppp_write_config" "${zone}" "${config_file}" | |
943e3f7e | 40 | |
ea5f6354 MT |
41 | # Create trap function |
42 | function cleanup() { | |
43 | rm -f "${config_file}" | |
44 | } | |
45 | trap "cleanup" EXIT TERM KILL | |
943e3f7e | 46 | |
ea5f6354 | 47 | # Start the angel process. |
c4906e27 MT |
48 | pppd_angel "${zone}" "${config_file}" \ |
49 | --holdoff-time="10" | |
ea5f6354 | 50 | } |
943e3f7e | 51 | |
ea5f6354 | 52 | main "$@" || exit $? |
943e3f7e | 53 | |
97cb552e | 54 | exit ${EXIT_OK} |