5 config_get proto
"$cfg" proto
8 config_get ifname
"$cfg" ifname
10 local link
="${proto:-ppp}-$ifname"
11 [ -f "/var/run/ppp-${link}.pid" ] && {
12 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
13 grep -qs pppd
"/proc/$pid/cmdline" && kill -TERM $pid && \
14 while grep -qs pppd
"/proc/$pid/cmdline"; do sleep 1; done
15 rm -f "/var/run/ppp-${link}.pid"
18 local lock
="/var/lock/ppp-$link"
19 [ -f "$lock" ] && lock
-u "$lock"
26 config_get proto
"$cfg" proto
28 # unique link identifier
29 local link
="${proto:-ppp}-$cfg"
31 # make sure only one pppd process is started
32 lock
"/var/lock/ppp-${link}"
33 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
34 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
35 lock
-u "/var/lock/ppp-${link}"
39 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
40 # /dev/ppp fast enough to be used here
41 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
44 config_get device
"$cfg" device
47 config_get username
"$cfg" username
50 config_get password
"$cfg" password
53 config_get keepalive
"$cfg" keepalive
56 config_get connect
"$cfg" connect
59 config_get disconnect
"$cfg" disconnect
62 config_get pppd_options
"$cfg" pppd_options
65 config_get_bool defaultroute
"$cfg" defaultroute
1
66 [ "$defaultroute" -eq 1 ] && \
67 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
69 local interval
="${keepalive##*[, ]}"
70 [ "$interval" != "$keepalive" ] || interval
=5
73 config_get dns
"$config" dns
83 config_get_bool peerdns
"$cfg" peerdns
$peer_default
85 if [ "$peerdns" -eq 1 ] ||
[ ! -e /tmp
/resolv.conf.auto
]; then
86 echo -n "" > /tmp
/resolv.conf.auto
89 [ "$peerdns" -eq 1 ] && {
94 echo "nameserver $dns" >> /tmp
/resolv.conf.auto
99 config_get_bool demand
"$cfg" demand
0
102 [ "$demand" -eq 1 ] && {
103 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle"
104 [ "$has_dns" -eq 0 ] && \
105 echo "nameserver 1.1.1.1" > /tmp
/resolv.conf.auto
111 config_get_bool ipv6
"$cfg" ipv6
0
112 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
114 /usr
/sbin
/pppd
"$@" \
115 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
119 ${username:+user "$username" password "$password"} \
123 ${connect:+connect "$connect"} \
124 ${disconnect:+disconnect "$disconnect"} \
128 lock
-u "/var/lock/ppp-${link}"
131 setup_interface_ppp
() {
136 config_get device
"$config" device
139 config_get mtu
"$config" mtu
142 start_pppd
"$config" \