5 config_get proto
"$cfg" proto
7 local link
="$proto-$cfg"
8 service_kill pppd
"/var/run/ppp-${link}.pid"
12 local lock
="/var/lock/ppp-$link"
13 [ -f "$lock" ] && lock
-u "$lock"
20 config_get proto
"$cfg" proto
22 # unique link identifier
23 local link
="${proto:-ppp}-$cfg"
25 # make sure only one pppd process is started
26 lock
"/var/lock/ppp-${link}"
27 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
28 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
29 lock
-u "/var/lock/ppp-${link}"
33 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
34 # /dev/ppp fast enough to be used here
35 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
38 config_get device
"$cfg" device
41 config_get username
"$cfg" username
44 config_get password
"$cfg" password
47 config_get keepalive
"$cfg" keepalive
50 config_get connect
"$cfg" connect
53 config_get disconnect
"$cfg" disconnect
56 config_get pppd_options
"$cfg" pppd_options
59 config_get_bool defaultroute
"$cfg" defaultroute
1
60 [ "$defaultroute" -eq 1 ] && \
61 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
63 local interval
="${keepalive##*[, ]}"
64 [ "$interval" != "$keepalive" ] || interval
=5
67 config_get dns
"$config" dns
77 config_get_bool peerdns
"$cfg" peerdns
$peer_default
79 [ "$peerdns" -eq 1 ] && {
87 config_get demand
"$cfg" demand
0
90 [ "$demand" -gt 0 ] && {
91 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle $demand"
92 [ "$has_dns" -eq 0 ] && add_dns
"$cfg" 1.1.1.1
98 config_get_bool ipv6
"$cfg" ipv6
0
99 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
101 start-stop-daemon
-S -b -x /usr
/sbin
/pppd
-m -p /var
/run
/ppp-
$link.pid
-- "$@" \
102 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
106 ${username:+user "$username" password "$password"} \
109 ${connect:+connect "$connect"} \
110 ${disconnect:+disconnect "$disconnect"} \
115 lock
-u "/var/lock/ppp-${link}"
118 setup_interface_ppp
() {
123 config_get device
"$config" device
126 config_get mtu
"$config" mtu
129 start_pppd
"$config" \