From d8a77f3f199f1aa7597d76b83210b4e084f1361c Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 7 Jul 2020 11:40:17 +0800 Subject: [PATCH] shortcut-fe-cm: load only once to avoid panic (#5019) --- package/lean/fast-classifier/Makefile | 2 +- package/lean/fast-classifier/src/fast-classifier.c | 2 +- package/lean/shortcut-fe/files/etc/init.d/shortcut-fe | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/lean/fast-classifier/Makefile b/package/lean/fast-classifier/Makefile index b08267afd..2b02f1b64 100644 --- a/package/lean/fast-classifier/Makefile +++ b/package/lean/fast-classifier/Makefile @@ -88,4 +88,4 @@ endef $(eval $(call KernelPackage,$(PKG_NAME))) $(eval $(call KernelPackage,$(PKG_NAME)-noload)) -$(eval $(call BuildPackage,fast-classifier-example)) +#$(eval $(call BuildPackage,fast-classifier-example)) diff --git a/package/lean/fast-classifier/src/fast-classifier.c b/package/lean/fast-classifier/src/fast-classifier.c index e9f3d0eb4..19e2e6fad 100644 --- a/package/lean/fast-classifier/src/fast-classifier.c +++ b/package/lean/fast-classifier/src/fast-classifier.c @@ -1824,7 +1824,7 @@ static int __init fast_classifier_init(void) DEBUG_ERROR("failed to register genl family: %d\n", result); goto exit5; } -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) result = genl_register_family_with_ops_groups(&fast_classifier_gnl_family, fast_classifier_gnl_ops, fast_classifier_genl_mcgrp); diff --git a/package/lean/shortcut-fe/files/etc/init.d/shortcut-fe b/package/lean/shortcut-fe/files/etc/init.d/shortcut-fe index 16ca75876..8c0d3a27a 100755 --- a/package/lean/shortcut-fe/files/etc/init.d/shortcut-fe +++ b/package/lean/shortcut-fe/files/etc/init.d/shortcut-fe @@ -30,11 +30,12 @@ load_sfe_cm() { #shortcut-fe-drv.ko is not needed because other connection manager is not enabled [ -d "/sys/module/shortcut_fe_drv" ] && rmmod shortcut_fe_drv - [ -e "/lib/modules/$kernel_version/shortcut-fe-cm.ko" ] && { - [ -d /sys/module/shortcut_fe_cm ] || insmod /lib/modules/$kernel_version/shortcut-fe-cm.ko - } [ -e "/lib/modules/$kernel_version/fast-classifier.ko" ] && { - [ -d /sys/module/fast_classifier ] || insmod /lib/modules/$kernel_version/fast-classifier.ko + [ -d /sys/module/fast_classifier ] || insmod /lib/modules/$kernel_version/fast-classifier.ko && return + } + + [ -e "/lib/modules/$kernel_version/shortcut-fe-cm.ko" ] && { + [ -d /sys/module/shortcut_fe_cm ] || insmod /lib/modules/$kernel_version/shortcut-fe-cm.ko && return } }