]>
Commit | Line | Data |
---|---|---|
711ffac1 | 1 | #!/bin/bash |
5b20e43a MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
1848564d | 5 | # Copyright (C) 2010 Michael Tremer & Christian Schmidt # |
5b20e43a 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 | ||
6c74a64c MT |
22 | LOG_FACILITY=$(basename ${0}) |
23 | ||
5b20e43a | 24 | umask 022 |
5b20e43a | 25 | |
6c74a64c MT |
26 | PPP_VARIABLES="IFNAME IPLOCAL IPREMOTE DNS1 DNS2 MACREMOTE LLLOCAL LLREMOTE" |
27 | ||
711ffac1 | 28 | # Give the variables we get passed by pppd an own namespace |
6c74a64c | 29 | for i in ${PPP_VARIABLES}; do |
711ffac1 MT |
30 | export PPP_${i}=${!i} |
31 | unset ${i} | |
32 | done | |
33 | ||
5ca9dc30 | 34 | . @networkdir@/functions |
5b20e43a | 35 | |
6c74a64c MT |
36 | log DEBUG "Called." |
37 | for i in ${PPP_VARIABLES}; do | |
38 | i="PPP_${i}" | |
39 | log DEBUG " ${i} = ${!i}" | |
40 | done | |
41 | ||
1848564d | 42 | # Zone equals IFNAME |
711ffac1 | 43 | ZONE=${PPP_IFNAME} |
5b20e43a | 44 | |
e814246d MT |
45 | # If the given device is a known zone, we will call the required |
46 | # hook methods. If we don't know about any zone with name ${ZONE}, | |
47 | # we do nothing. | |
48 | ||
6c74a64c | 49 | if isset ZONE && zone_exists ${ZONE}; then |
e814246d MT |
50 | HOOK=$(zone_get_hook ${ZONE}) |
51 | ||
52 | assert isset HOOK | |
53 | assert hook_zone_exists ${HOOK} | |
54 | ||
55 | PROGNAME=$(basename ${0}) | |
2181765d MT |
56 | METHOD="" |
57 | case "${PROGNAME}" in | |
58 | ip-pre-up) | |
59 | METHOD="ppp_ip_pre_up" | |
60 | ;; | |
61 | ipv6-down) | |
62 | METHOD="ppp_ipv6_down" | |
63 | ;; | |
64 | ipv6-up) | |
65 | METHOD="ppp_ipv6_up" | |
66 | ;; | |
67 | ip-down) | |
68 | METHOD="ppp_ipv4_down" | |
69 | ;; | |
70 | ip-up) | |
71 | METHOD="ppp_ipv4_up" | |
72 | ;; | |
73 | esac | |
74 | assert isset METHOD | |
711ffac1 | 75 | |
2181765d | 76 | log DEBUG "${PROGNAME}/${METHOD} was called with the following parameters:" |
e814246d | 77 | log DEBUG " $@" |
1848564d | 78 | |
2181765d MT |
79 | hook_zone_exec "${HOOK}" "${METHOD}" "${ZONE}" |
80 | exit $? | |
e814246d | 81 | fi |
201b7dff | 82 | |
e814246d | 83 | exit ${EXIT_OK} |