ppp: use modprobe in place of insmod
authorManas Sambhus <manas.sambhus+github@gmail.com>
Sat, 9 Jul 2022 06:26:09 +0000 (11:56 +0530)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 27 Sep 2022 15:16:42 +0000 (17:16 +0200)
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>
package/network/services/ppp/Makefile
package/network/services/ppp/files/ppp.sh

index 10e9bdfdfe1e7778a3e9080cf60a48a59d762497..8476204e14fcda827c14a45e167057d2424143f7 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ppp
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
index 7bbc497c43bd44ff1da3f50e08fc8c186e29435c..6d3a8e29ffae218317c94ec4dcd11544a66eddd7 100755 (executable)
@@ -220,9 +220,7 @@ proto_pppoe_setup() {
        local config="$1"
        local iface="$2"
 
-       for module in slhc ppp_generic pppox pppoe; do
-               /sbin/insmod $module 2>&- >&-
-       done
+       /sbin/modprobe -qa slhc ppp_generic pppox pppoe
 
        json_get_var mtu mtu
        mtu="${mtu:-1492}"
@@ -262,9 +260,7 @@ proto_pppoa_setup() {
        local config="$1"
        local iface="$2"
 
-       for module in slhc ppp_generic pppox pppoatm; do
-               /sbin/insmod $module 2>&- >&-
-       done
+       /sbin/modprobe -qa slhc ppp_generic pppox pppoatm
 
        json_get_vars atmdev vci vpi encaps
 
@@ -311,13 +307,8 @@ proto_pptp_setup() {
                exit 1
        }
 
-       local load
-       for module in slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp; do
-               grep -q "^$module " /proc/modules && continue
-               /sbin/insmod $module 2>&- >&-
-               load=1
-       done
-       [ "$load" = "1" ] && sleep 1
+       /sbin/modprobe -qa slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp
+       sleep 1
 
        ppp_generic_setup "$config" \
                plugin pptp.so \
@@ -335,4 +326,3 @@ proto_pptp_teardown() {
        [ -f /usr/lib/pppd/*/pppoatm.so ] && add_protocol pppoa
        [ -f /usr/lib/pppd/*/pptp.so ] && add_protocol pptp
 }
-