ppp: use modprobe in place of insmod (#10191)

This will prevent `module is already loaded` lines from
appearing in the logs when a PPP connection is reconnecting

Signed-off-by: Manas Sambhus <manas.sambhus+github@gmail.com>

Signed-off-by: Manas Sambhus <manas.sambhus+github@gmail.com>
Co-authored-by: Manas Sambhus <manas.sambhus+github@gmail.com>
This commit is contained in:
Beginner 2022-09-29 00:00:39 +08:00 committed by GitHub
parent 5463662206
commit 936b8f9589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,9 +220,7 @@ proto_pppoe_setup() {
local config="$1" local config="$1"
local iface="$2" local iface="$2"
for module in slhc ppp_generic pppox pppoe; do /sbin/modprobe -qa slhc ppp_generic pppox pppoe
/sbin/insmod $module 2>&- >&-
done
json_get_var mtu mtu json_get_var mtu mtu
mtu="${mtu:-1492}" mtu="${mtu:-1492}"
@ -271,9 +269,7 @@ proto_pppoa_setup() {
local config="$1" local config="$1"
local iface="$2" local iface="$2"
for module in slhc ppp_generic pppox pppoatm; do /sbin/modprobe -qa slhc ppp_generic pppox pppoatm
/sbin/insmod $module 2>&- >&-
done
json_get_vars atmdev vci vpi encaps json_get_vars atmdev vci vpi encaps
@ -320,13 +316,8 @@ proto_pptp_setup() {
exit 1 exit 1
} }
local load /sbin/modprobe -qa slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp
for module in slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp; do sleep 1
grep -q "^$module " /proc/modules && continue
/sbin/insmod $module 2>&- >&-
load=1
done
[ "$load" = "1" ] && sleep 1
ppp_generic_setup "$config" \ ppp_generic_setup "$config" \
plugin pptp.so \ plugin pptp.so \
@ -344,4 +335,3 @@ proto_pptp_teardown() {
[ -f /usr/lib/pppd/*/pppoatm.so ] && add_protocol pppoa [ -f /usr/lib/pppd/*/pppoatm.so ] && add_protocol pppoa
[ -f /usr/lib/pppd/*/pptp.so ] && add_protocol pptp [ -f /usr/lib/pppd/*/pptp.so ] && add_protocol pptp
} }