2 config_get ifname
"$1" ifname
4 config_set
"$1" ifname
"ppp$pppdev"
5 config_set
"$1" unit
"$pppdev"
6 pppdev
="$(($pppdev + 1))"
12 # make sure only one pppd process is started
13 lock
"/var/lock/ppp-${cfg}"
14 local pid
="$(head -n1 /var/run/ppp-${cfg}.pid 2>/dev/null)"
15 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
16 lock
-u "/var/lock/ppp-${cfg}"
20 config_get device
"$cfg" device
21 config_get unit
"$cfg" unit
22 config_get username
"$cfg" username
23 config_get password
"$cfg" password
24 config_get keepalive
"$cfg" keepalive
26 config_get connect
"$cfg" connect
27 config_get disconnect
"$cfg" disconnect
28 config_get pppd_options
"$cfg" pppd_options
29 config_get_bool defaultroute
"$cfg" defaultroute
1
30 [ "$defaultroute" -eq 1 ] && defaultroute
="defaultroute replacedefaultroute" || defaultroute
=""
32 interval
="${keepalive##*[, ]}"
33 [ "$interval" != "$keepalive" ] || interval
=5
35 config_get demand
"$cfg" demand
36 [ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp
/resolv.conf.auto
38 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
39 ${demand:+precompiled-active-filter /etc/ppp/filter demand idle }${demand:-persist} \
42 ${username:+user "$username" password "$password"} \
46 ${connect:+connect "$connect"} \
47 ${disconnect:+disconnect "$disconnect"} \
50 lock
-u "/var/lock/ppp-${cfg}"
53 setup_interface_ppp
() {
57 config_get device
"$config" device
59 config_get mtu
"$cfg" mtu
61 start_pppd
"$config" \