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
21 config_get proto "$cfg" proto
23 # unique link identifier
24 local link="${proto:-ppp}-$cfg"
26 # make sure only one pppd process is started
27 lock "/var/lock/ppp-${link}"
28 local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
29 [ -d "/proc/$pid" ] && grep pppd "/proc/$pid/cmdline" 2>/dev/null >/dev/null && {
30 lock -u "/var/lock/ppp-${link}"
34 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
35 # /dev/ppp fast enough to be used here
36 [ -e /dev/ppp ] || mknod /dev/ppp c 108 0
39 config_get device "$cfg" device
42 config_get username "$cfg" username
45 config_get password "$cfg" password
48 config_get keepalive "$cfg" keepalive
51 config_get connect "$cfg" connect
54 config_get disconnect "$cfg" disconnect
57 config_get pppd_options "$cfg" pppd_options
60 config_get_bool defaultroute "$cfg" defaultroute 1
61 [ "$defaultroute" -eq 1 ] && \
62 defaultroute="defaultroute replacedefaultroute" || defaultroute="nodefaultroute"
64 local interval="${keepalive##*[, ]}"
65 [ "$interval" != "$keepalive" ] || interval=5
68 config_get dns "$config" dns
78 config_get_bool peerdns "$cfg" peerdns $peer_default
80 if [ "$peerdns" -eq 1 ] || [ ! -e /tmp/resolv.conf.auto ]; then
81 echo -n "" > /tmp/resolv.conf.auto
84 [ "$peerdns" -eq 1 ] && {
89 echo "nameserver $dns" >> /tmp/resolv.conf.auto
94 config_get_bool demand "$cfg" demand 0
97 [ "$demand" -eq 1 ] && {
98 demandargs="precompiled-active-filter /etc/ppp/filter demand idle"
99 [ "$has_dns" -eq 0 ] && \
100 echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto
106 config_get_bool ipv6 "$cfg" ipv6 0
107 [ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""
109 /usr/sbin/pppd "$@" \
110 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
114 ${username:+user "$username" password "$password"} \
118 ${connect:+connect "$connect"} \
119 ${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" \