blob: 168e849a2370db536551eadb872ee48f9a6aeef7 [file] [log] [blame]
developer10cbf2c2022-02-09 10:39:21 +08001--- a/package/base-files/files/etc/hotplug.d/net/00-sysctl 2022-02-09 17:30:24.308209645 +0800
2+++ b/package/base-files/files/etc/hotplug.d/net/00-sysctl 2022-02-09 21:01:24.392931550 +0800
3@@ -1,4 +1,29 @@
4 #!/bin/sh
5+# $1: module name
6+# return value
7+# 1: if the module named $1 is built-in or inserted.
8+# 0: if the module exists but has not been inserted.
9+# -1: if the module does not exist.
10+module_exist()
11+{
12+ mpath="/lib/modules/`uname -r`"
13+ retval=-1
14+ mod_in_lib=`find $mpath -name "$1".ko > /dev/null 2>&1`
15+ #echo "find $mpath -name "$1".ko" > /dev/console
16+ if [ ! -z $mod_in_lib ]; then
17+ retval=0
18+ fi
19+ # TODO find out a way in OpenWRT
20+ mod_builtin=`grep $1 $mpath/modules.builtin 2>/dev/null`
21+ if [ ! -z "$mod_builtin" ]; then
22+ retval=1
23+ fi
24+ mod_inserted=`lsmod | grep $1 2>/dev/null`
25+ if [ ! -z "$mod_inserted" ]; then
26+ retval=1
27+ fi
28+ echo $retval
29+}
30
31 if [ "$ACTION" = add ]; then
32 for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
33@@ -6,4 +31,11 @@
developer11a17742021-05-18 15:28:31 +080034 sed -ne "/^[[:space:]]*net\..*\.$DEVICENAME\./p" "$CONF" | \
35 sysctl -e -p - | logger -t sysctl
36 done
developer10cbf2c2022-02-09 10:39:21 +080037+ is_mac80211=$(module_exist "mt76")
developer11a17742021-05-18 15:28:31 +080038+
developer10cbf2c2022-02-09 10:39:21 +080039+ if [ "$is_mac80211" = "1" ]; then
40+ [ -f /sbin/smp-mac80211.sh ] && /sbin/smp-mac80211.sh
41+ else
42+ [ -f /sbin/smp.sh ] && /sbin/smp.sh
43+ fi
developer11a17742021-05-18 15:28:31 +080044 fi