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"
19 # Workaround for PPPoE service and AC name options,
20 # filter out the nic-* argument and append it as last option
23 nic-
*) nic
="$1"; shift ;;
27 config_get proto
"$cfg" proto
29 # unique link identifier
30 local link
="${proto:-ppp}-$cfg"
32 # make sure only one pppd process is started
33 lock
"/var/lock/ppp-${link}"
34 local pid
="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
35 [ -d "/proc/$pid" ] && grep pppd
"/proc/$pid/cmdline" 2>/dev
/null
>/dev
/null
&& {
36 lock
-u "/var/lock/ppp-${link}"
40 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
41 # /dev/ppp fast enough to be used here
42 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
45 config_get device
"$cfg" device
48 config_get username
"$cfg" username
51 config_get password
"$cfg" password
54 config_get keepalive
"$cfg" keepalive
57 config_get connect
"$cfg" connect
60 config_get disconnect
"$cfg" disconnect
63 config_get pppd_options
"$cfg" pppd_options
66 config_get_bool defaultroute
"$cfg" defaultroute
1
67 [ "$defaultroute" -eq 1 ] && \
68 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
70 local interval
="${keepalive##*[, ]}"
71 [ "$interval" != "$keepalive" ] || interval
=5
74 config_get dns
"$config" dns
84 config_get_bool peerdns
"$cfg" peerdns
$peer_default
86 [ "$peerdns" -eq 1 ] && {
94 config_get demand
"$cfg" demand
0
97 [ "$demand" -gt 0 ] && {
98 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle $demand"
99 [ "$has_dns" -eq 0 ] && add_dns
"$cfg" 1.1.1.1
105 config_get_bool ipv6
"$cfg" ipv6
0
106 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
108 start-stop-daemon
-S -b -x /usr
/sbin
/pppd
-m -p /var
/run
/ppp-
$link.pid
-- "$@" \
109 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
113 ${username:+user "$username" password "$password"} \
116 ${connect:+connect "$connect"} \
117 ${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" \