]> git.ipfire.org Git - people/ms/network.git/blob - ppp/ip-updown
hostapd: Enable WMM by default.
[people/ms/network.git] / ppp / ip-updown
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
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 LOG_FACILITY=$(basename ${0})
23
24 umask 022
25
26 PPP_VARIABLES="IFNAME IPLOCAL IPREMOTE DNS1 DNS2 MACREMOTE LLLOCAL LLREMOTE"
27
28 # Give the variables we get passed by pppd an own namespace
29 for i in ${PPP_VARIABLES}; do
30 export PPP_${i}=${!i}
31 unset ${i}
32 done
33
34 . /usr/lib/network/functions
35
36 log DEBUG "Called."
37 for i in ${PPP_VARIABLES}; do
38 i="PPP_${i}"
39 log DEBUG " ${i} = ${!i}"
40 done
41
42 # Zone equals IFNAME
43 ZONE=${PPP_IFNAME}
44
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
49 if isset ZONE && zone_exists ${ZONE}; then
50 HOOK=$(zone_get_hook ${ZONE})
51
52 assert isset HOOK
53 assert hook_zone_exists ${HOOK}
54
55 PROGNAME=$(basename ${0})
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
75
76 log DEBUG "${PROGNAME}/${METHOD} was called with the following parameters:"
77 log DEBUG " $@"
78
79 hook_zone_exec "${HOOK}" "${METHOD}" "${ZONE}"
80 exit $?
81 fi
82
83 exit ${EXIT_OK}