]>
git.ipfire.org Git - people/arne_f/network.git/blob - functions.ppp
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
23 mkdir
-p /var
/run
/ppp
2>/dev
/null
26 function ppp_common_ip_pre_up
() {
30 if ! zone_exists
${zone}; then
31 error
"Zone '${zone}' does not exist."
35 red_db_from_ppp
${zone}
37 # Request firewall reload
43 function ppp_common_ip_up
() {
47 if ! zone_exists
${zone}; then
48 error
"Zone '${zone}' does not exist."
52 red_db_set
${zone} active
1
53 red_routing_update
${zone}
55 # Emit interface-up event
56 event_interface_up
${zone}
61 function ppp_common_ip_down
() {
65 if ! zone_exists
${zone}; then
66 error
"Zone '${zone}' does not exist."
70 # Save accounting information
71 ppp_accounting
${zone}
73 # Emit interface-up event
74 event_interface_down
${zone}
79 function ppp_secret
() {
86 # Updateing secret file
88 while read user a secret
; do
89 if [ "'${USER}'" != "${user}" ]; then
90 echo "${user} ${a} ${secret}" >> ${PPP_SECRETS}.tmp
93 echo "'${USER}' * '${SECRET}'" >> ${PPP_SECRETS}.tmp
94 cat ${PPP_SECRETS}.tmp > ${PPP_SECRETS}
95 rm -f ${PPP_SECRETS}.tmp
98 function ppp_accounting() {
102 db_ppp_update ${zone} --duration="${CONNECT_TIME}" \
103 --rcvd="${BYTES_RCVD}" --sent="${BYTES_SENT}"
106 function pppd_exec() {
109 log DEBUG "Running pppd with parameters '$@
'."