qca-nss-clients: misc. script fixes

This commit is contained in:
bitthief 2023-05-20 00:19:29 +03:00
parent 76965b65ed
commit 0d82494ea9
3 changed files with 34 additions and 17 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# #
# Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved. # Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
# #
@ -38,7 +38,6 @@ ecm_unload () {
} }
ecm_disable() { ecm_disable() {
if [ ! -d /sys/module/ecm ]; then if [ ! -d /sys/module/ecm ]; then
return; return;
fi fi
@ -62,7 +61,17 @@ ecm_enable() {
kernel_version_check_5_4() { kernel_version_check_5_4() {
major_ver=$(uname -r | awk -F '.' '{print $1}') major_ver=$(uname -r | awk -F '.' '{print $1}')
minor_ver=$(uname -r | awk -F '.' '{print $2}') minor_ver=$(uname -r | awk -F '.' '{print $2}')
if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 4 ] ) ; then if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 4 ] ); then
return 1
else
return 0
fi
}
kernel_version_check_5_15() {
major_ver=$(uname -r | awk -F '.' '{print $1}')
minor_ver=$(uname -r | awk -F '.' '{print $2}')
if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 15 ] ); then
return 1 return 1
else else
return 0 return 0
@ -70,12 +79,16 @@ kernel_version_check_5_4() {
} }
start_klips() { start_klips() {
if kernel_version_check_5_4 if kernel_version_check_5_4; then
then
echo "Kernel 5.4 doesn't support klips stack." echo "Kernel 5.4 doesn't support klips stack."
return $? return $?
fi fi
if kernel_version_check_5_15; then
echo "Kernel 5.15 doesn't support klips stack."
return $?
fi
touch $NSS_IPSEC_OL_FILE touch $NSS_IPSEC_OL_FILE
ecm_load ecm_load
@ -97,12 +110,16 @@ start_klips() {
} }
stop_klips() { stop_klips() {
if kernel_version_check_5_4 if kernel_version_check_5_4; then
then
echo "Kernel 5.4 doesn't support klips stack." echo "Kernel 5.4 doesn't support klips stack."
return $? return $?
fi fi
if kernel_version_check_5_15; then
echo "Kernel 5.15 doesn't support klips stack."
return $?
fi
ecm_disable ecm_disable
/etc/init.d/ipsec stop /etc/init.d/ipsec stop

View File

@ -14,11 +14,6 @@
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
########################################################################### ###########################################################################
restart() {
rmmod act_nssmirred.ko
insmod act_nssmirred.ko
}
start() { start() {
insmod act_nssmirred.ko insmod act_nssmirred.ko
} }
@ -26,3 +21,8 @@ start() {
stop() { stop() {
rmmod act_nssmirred.ko rmmod act_nssmirred.ko
} }
restart() {
stop
start
}

View File

@ -14,11 +14,6 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
restart() {
rmmod qca-nss-netlink.ko
modprobe qca-nss-netlink
}
start() { start() {
modprobe qca-nss-netlink modprobe qca-nss-netlink
@ -29,3 +24,8 @@ start() {
stop() { stop() {
rmmod qca-nss-netlink.ko rmmod qca-nss-netlink.ko
} }
restart() {
stop
start
}