diff mbox series

[v4] mpls01.sh: Add --allow-unsupported for modprobe

Message ID 20240904035808.5891-1-wegao@suse.com
State Changes Requested
Headers show
Series [v4] mpls01.sh: Add --allow-unsupported for modprobe | expand

Commit Message

Wei Gao Sept. 4, 2024, 3:58 a.m. UTC
In sle-micro we encounter following error when do modprobe:
root# modprobe mpls_router
modprobe: ERROR: module 'mpls_router' is unsupported
modprobe: ERROR: Use --allow-unsupported or set allow_unsupported_modules 1 in
modprobe: ERROR: /etc/modprobe.d/10-unsupported-modules.conf
modprobe: ERROR: could not insert 'mpls_router': Operation not permitted

Signed-off-by: Wei Gao <wegao@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/mpls/mpls01.sh   |  4 ++--
 testcases/network/mpls/mpls_lib.sh | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Petr Vorel Sept. 4, 2024, 4:47 a.m. UTC | #1
Hi Wei,

I suggest these changes:

1) use mpls_setup_driver also in mpls_setup()
- replace tst_net_run(). I don't understand why you did not do it in the
  patchset (I suggested that), but I can replace it during merge.
2) update the commit message: s/mpls01.sh/mpls01/
   (fixing all mpls tests)

With that:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

+++ testcases/network/mpls/mpls_lib.sh
@@ -47,7 +47,7 @@ mpls_setup()
 {
 	local label="$1"
 
-	tst_net_run -s "modprobe -a $TST_NEEDS_DRIVERS"
+	mpls_setup_driver
 
 	ROD sysctl -q net.mpls.conf.$(tst_iface).input=1
 	tst_set_sysctl net.mpls.conf.lo.input 1 safe
Wei Gao Sept. 4, 2024, 6:50 a.m. UTC | #2
On Wed, Sep 04, 2024 at 06:47:10AM +0200, Petr Vorel wrote:
> Hi Wei,
> 
> I suggest these changes:
> 
> 1) use mpls_setup_driver also in mpls_setup()
> - replace tst_net_run(). I don't understand why you did not do it in the
>   patchset (I suggested that), but I can replace it during merge.
Sorry i forget that, will sent another patch. Thanks for point that.
> 2) update the commit message: s/mpls01.sh/mpls01/
>    (fixing all mpls tests)
> 
> With that:
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> Kind regards,
> Petr
> 
> +++ testcases/network/mpls/mpls_lib.sh
> @@ -47,7 +47,7 @@ mpls_setup()
>  {
>  	local label="$1"
>  
> -	tst_net_run -s "modprobe -a $TST_NEEDS_DRIVERS"
> +	mpls_setup_driver
>  
>  	ROD sysctl -q net.mpls.conf.$(tst_iface).input=1
>  	tst_set_sysctl net.mpls.conf.lo.input 1 safe
diff mbox series

Patch

diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh
index 196b5b2f9..e453f8130 100755
--- a/testcases/network/mpls/mpls01.sh
+++ b/testcases/network/mpls/mpls01.sh
@@ -21,7 +21,7 @@  cleanup()
 
 setup()
 {
-	ROD modprobe mpls_router
+	mpls_setup_driver
 }
 
 test1()
@@ -66,5 +66,5 @@  test3()
 	tst_res TPASS "created and removed mpls routes"
 }
 
-. tst_net.sh
+. mpls_lib.sh
 tst_run
diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh
index 380b568bb..2ded31ee9 100755
--- a/testcases/network/mpls/mpls_lib.sh
+++ b/testcases/network/mpls/mpls_lib.sh
@@ -33,6 +33,16 @@  mpls_virt_cleanup()
 	mpls_cleanup
 }
 
+mpls_setup_driver()
+{
+	local args
+
+	grep -q 'sl-micro' /etc/os-release && args='--allow-unsupported'
+	if [ "$TST_NEEDS_DRIVERS" ]; then
+		tst_net_run -s "modprobe $args -a $TST_NEEDS_DRIVERS"
+	fi
+}
+
 mpls_setup()
 {
 	local label="$1"