5 config_get proto
"$cfg" proto
8 config_get ifname
"$cfg" ifname
10 [ -f "/var/run/ppp-${ifname}.pid" ] && {
11 local pid
="$(head -n1 /var/run/ppp-${ifname}.pid 2>/dev/null)"
12 grep -qs pppd
"/proc/$pid/cmdline" && kill -TERM $pid && \
13 while grep -qs pppd
"/proc/$pid/cmdline"; do sleep 1; done
14 rm -f "/var/run/ppp-${ifname}.pid"
17 local lock
="/var/lock/ppp-$ifname"
18 [ -f "$lock" ] && lock
-u "$lock"
25 config_get proto
"$cfg" proto
27 # unique link identifier
28 local link
="${proto:-ppp}-$cfg"
30 # make sure only one pppd process is started
31 lock
"/var/lock/ppp-${link}"
32 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
33 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
34 lock
-u "/var/lock/ppp-${link}"
38 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
39 # /dev/ppp fast enough to be used here
40 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
43 config_get device
"$cfg" device
46 config_get username
"$cfg" username
49 config_get password
"$cfg" password
52 config_get keepalive
"$cfg" keepalive
55 config_get connect
"$cfg" connect
58 config_get disconnect
"$cfg" disconnect
61 config_get pppd_options
"$cfg" pppd_options
64 config_get_bool defaultroute
"$cfg" defaultroute
1
65 [ "$defaultroute" -eq 1 ] && \
66 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
68 local interval
="${keepalive##*[, ]}"
69 [ "$interval" != "$keepalive" ] || interval
=5
72 config_get dns
"$config" dns
82 config_get_bool peerdns
"$cfg" peerdns
$peer_default
84 if [ "$peerdns" -eq 1 ] ||
[ ! -e /tmp
/resolv.conf.auto
]; then
85 echo -n "" > /tmp
/resolv.conf.auto
88 [ "$peerdns" -eq 1 ] && {
93 echo "nameserver $dns" >> /tmp
/resolv.conf.auto
98 config_get_bool demand
"$cfg" demand
0
101 [ "$demand" -eq 1 ] && {
102 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle"
103 [ "$has_dns" -eq 0 ] && \
104 echo "nameserver 1.1.1.1" > /tmp
/resolv.conf.auto
110 config_get_bool ipv6
"$cfg" ipv6
0
111 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
113 /usr
/sbin
/pppd
"$@" \
114 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
118 ${username:+user "$username" password "$password"} \
122 ${connect:+connect "$connect"} \
123 ${disconnect:+disconnect "$disconnect"} \
127 lock
-u "/var/lock/ppp-${link}"
130 setup_interface_ppp
() {
135 config_get device
"$config" device
138 config_get mtu
"$config" mtu
141 start_pppd
"$config" \