5 config_get proto
"$cfg" proto
7 local link
="$proto-$cfg"
8 [ -f "/var/run/ppp-${link}.pid" ] && {
9 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
11 grep -qs pppd
"/proc/$pid/cmdline" && kill -TERM $pid && \
12 while grep -qs pppd
"/proc/$pid/cmdline" && [ $
((try
++)) -lt 5 ]; do sleep 1; done
13 grep -qs pppd
"/proc/$pid/cmdline" && kill -KILL $pid && \
14 while grep -qs pppd
"/proc/$pid/cmdline"; do sleep 1; done
15 rm -f "/var/run/ppp-${link}.pid"
20 local lock
="/var/lock/ppp-$link"
21 [ -f "$lock" ] && lock
-u "$lock"
28 config_get proto
"$cfg" proto
30 # unique link identifier
31 local link
="${proto:-ppp}-$cfg"
33 # make sure only one pppd process is started
34 lock
"/var/lock/ppp-${link}"
35 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
36 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
37 lock
-u "/var/lock/ppp-${link}"
41 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
42 # /dev/ppp fast enough to be used here
43 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
46 config_get device
"$cfg" device
49 config_get username
"$cfg" username
52 config_get password
"$cfg" password
55 config_get keepalive
"$cfg" keepalive
58 config_get connect
"$cfg" connect
61 config_get disconnect
"$cfg" disconnect
64 config_get pppd_options
"$cfg" pppd_options
67 config_get_bool defaultroute
"$cfg" defaultroute
1
68 [ "$defaultroute" -eq 1 ] && \
69 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
71 local interval
="${keepalive##*[, ]}"
72 [ "$interval" != "$keepalive" ] || interval
=5
75 config_get dns
"$config" dns
85 config_get_bool peerdns
"$cfg" peerdns
$peer_default
87 [ "$peerdns" -eq 1 ] && {
95 config_get demand
"$cfg" demand
0
98 [ "$demand" -gt 0 ] && {
99 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle $demand"
100 [ "$has_dns" -eq 0 ] && add_dns
"$cfg" 1.1.1.1
106 config_get_bool ipv6
"$cfg" ipv6
0
107 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
109 start-stop-daemon
-S -b -x /usr
/sbin
/pppd
-m -p /var
/run
/ppp-
$link.pid
-- "$@" \
110 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
114 ${username:+user "$username" password "$password"} \
117 ${connect:+connect "$connect"} \
118 ${disconnect:+disconnect "$disconnect"} \
123 lock
-u "/var/lock/ppp-${link}"
126 setup_interface_ppp
() {
131 config_get device
"$config" device
134 config_get mtu
"$config" mtu
137 start_pppd
"$config" \