Lines 21-26
requote()
Link Here
|
21 |
printf "'%s' " "$@" |
21 |
printf "'%s' " "$@" |
22 |
} |
22 |
} |
23 |
|
23 |
|
|
|
24 |
pppd_is_ge_248() |
25 |
{ |
26 |
local ver_str="$(/usr/sbin/pppd --version 2>&1 | grep -o '[[:digit:]\.]\+')" |
27 |
local maj_ver="$(echo ${ver_str} | cut -d . -f 1)" |
28 |
local min_ver="$(echo ${ver_str} | cut -d . -f 2)" |
29 |
local patch_ver="$(echo ${ver_str} | cut -d . -f 3)" |
30 |
|
31 |
if [ "${maj_ver}" -gt 2 ] ; then |
32 |
return 0 |
33 |
elif [ "${maj_ver}" -eq 2 ] ; then |
34 |
if [ "${min_ver}" -gt 4 ] ; then |
35 |
return 0 |
36 |
elif [ "${min_ver}" -eq 4 ] ; then |
37 |
if [ "${patch_ver}" -ge 8 ] ; then |
38 |
return 0 |
39 |
else |
40 |
return 1 |
41 |
fi |
42 |
else |
43 |
return 1 |
44 |
fi |
45 |
else |
46 |
return 1 |
47 |
fi |
48 |
} |
49 |
|
24 |
pppd_pre_start() |
50 |
pppd_pre_start() |
25 |
{ |
51 |
{ |
26 |
# Interface has to be called ppp |
52 |
# Interface has to be called ppp |
Lines 39-45
pppd_pre_start()
Link Here
|
39 |
return 0 |
65 |
return 0 |
40 |
fi |
66 |
fi |
41 |
|
67 |
|
42 |
local link= i= unit="${IFACE#ppp}" opts= |
68 |
local link= i= unit="${IFACE#ppp}" opts= routemetric=defaultmetric |
|
|
69 |
|
70 |
# https://github.com/paulusmack/ppp/commit/35e5a569c988b1ff865b02a24d9a727a00db4da9 |
71 |
pppd_is_ge_248 && routemetric=defaultroute-metric |
43 |
|
72 |
|
44 |
# PPP requires a link to communicate over - normally a serial port |
73 |
# PPP requires a link to communicate over - normally a serial port |
45 |
# PPPoE communicates over Ethernet |
74 |
# PPPoE communicates over Ethernet |
Lines 76-81
pppd_pre_start()
Link Here
|
76 |
return 1 |
105 |
return 1 |
77 |
;; |
106 |
;; |
78 |
defaultmetric) hasdefaultmetric=true;; |
107 |
defaultmetric) hasdefaultmetric=true;; |
|
|
108 |
defaultroute-metric) hasdefaultmetric=true;; |
79 |
mtu) hasmtu=true;; |
109 |
mtu) hasmtu=true;; |
80 |
mru) hasmru=true;; |
110 |
mru) hasmru=true;; |
81 |
maxfail) hasmaxfail=true;; |
111 |
maxfail) hasmaxfail=true;; |
Lines 98-104
pppd_pre_start()
Link Here
|
98 |
local m= |
128 |
local m= |
99 |
eval m=\$metric_${IFVAR} |
129 |
eval m=\$metric_${IFVAR} |
100 |
[ -z "${m}" ] && : $(( m = metric + $(_ifindex) )) |
130 |
[ -z "${m}" ] && : $(( m = metric + $(_ifindex) )) |
101 |
opts="${opts} defaultmetric ${m}" |
131 |
opts="${opts} ${routemetric} ${m}" |
102 |
fi |
132 |
fi |
103 |
if [ -n "${mtu}" ]; then |
133 |
if [ -n "${mtu}" ]; then |
104 |
${hasmtu} || opts="${opts} mtu ${mtu}" |
134 |
${hasmtu} || opts="${opts} mtu ${mtu}" |
105 |
- |
|
|