Skip to contentSkip to conversation

network/tcp_cc: check sch_netem driver in the lib

PATCH New Alexey Kodanev 2 participants 10 messages Aug 4, 2021 – Aug 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 network/tcp_cc: check sch_netem driver in the lib

bbr01, bbr02 and dctcp01 are using netem.

---
 testcases/network/tcp_cc/tcp_cc_lib.sh | 1 +
 1 file changed, 1 insertion(+)
testcases/network/tcp_cc/tcp_cc_lib.sh +1 -0
index dff8cef19..1a6845664 100755
@@ -6,6 +6,7 @@
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="sysctl tc"
+TST_NEEDS_DRIVERS="sch_netem"
 
 . tst_net.sh
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 network/tst_net.sh: fix busybox/sysctl in tst_set_sysctl()

busybox/sysctl expects -e option to be set before 'name=value'. This can easily be fixed by splitting the string in tst_set_sysctl(), so that 'rparam' with '-e' option is added in between.

---
 testcases/lib/tst_net.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_net.sh +1 -1
index 511fb7eb1..bb30c13ec 100644
@@ -918,7 +918,7 @@ tst_set_sysctl()
 	local rparam=
 	[ "$TST_USE_NETNS" = "yes" ] && rparam="-r '-e'"
 
-	tst_net_run $safe $rparam "sysctl -q -w $name=$value"
+	tst_net_run $safe $rparam "sysctl -q -w" "$name=$value"
 }
 
 tst_cleanup_rhost()
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 network/tst_net.sh: fix busybox/sysctl in tst_set_sysctl()

Hi Alexey,

Quoted 3 lines

busybox/sysctl expects -e option to be set before 'name=value'. This can easily be fixed by splitting the string in tst_set_sysctl(), so that 'rparam' with '-e' option is added in between.

Good catch.

...

testcases/lib/tst_net.sh tst_set_sysctl() · line 921

Quoted 10 lines
testcases/lib/tst_net.sh +1 -1
index 511fb7eb1..bb30c13ec 100644
@@ -918,7 +918,7 @@ tst_set_sysctl()
 	local rparam=
 	[ "$TST_USE_NETNS" = "yes" ] && rparam="-r '-e'"
 
-	tst_net_run $safe $rparam "sysctl -q -w $name=$value"
+	tst_net_run $safe $rparam "sysctl -q -w" "$name=$value"

I wonder if it were a bit clearer if we moves all params to second arg:

	tst_net_run $safe "sysctl" "$name=$value -q -w"

Kind regards,
Petr

#3 lore raw

PATCH 2/3 network/tst_net.sh: fix busybox/sysctl in tst_set_sysctl()

Quoted 17 lines · Petr Vorel

Hi Alexey,

Quoted 3 lines

busybox/sysctl expects -e option to be set before 'name=value'. This can easily be fixed by splitting the string in tst_set_sysctl(), so that 'rparam' with '-e' option is added in between.

Good catch.

...

Quoted 7 lines
testcases/lib/tst_net.sh +0 -0
index 511fb7eb1..bb30c13ec 100644
@@ -918,7 +918,7 @@ tst_set_sysctl()
 	local rparam=
 	[ "$TST_USE_NETNS" = "yes" ] && rparam="-r '-e'"
Quoted 5 lines

testcases/lib/tst_net.sh tst_set_sysctl() · line 921

Quoted 2 lines
testcases/lib/tst_net.sh +1 -1
-	tst_net_run $safe $rparam "sysctl -q -w $name=$value"
+	tst_net_run $safe $rparam "sysctl -q -w" "$name=$value"

I wonder if it were a bit clearer if we moves all params to second arg:

	tst_net_run $safe "sysctl" "$name=$value -q -w"

OK, but changed to "sysctl" "-q -w $name=$value" because the other options should also be placed before the key/value pair:

    Usage: sysctl -p [-enq] [FILE...] / [-enqaw] [KEY[=VALUE]]...

Thanks for review Petr! Applied the patches.

#4 lore raw

PATCH 2/3 network/tst_net.sh: fix busybox/sysctl in tst_set_sysctl()

Hi Alexey,

..

Quoted 10 lines
Quoted 5 lines

testcases/lib/tst_net.sh tst_set_sysctl() · line 921

Quoted 2 lines
testcases/lib/tst_net.sh +1 -1
-	tst_net_run $safe $rparam "sysctl -q -w $name=$value"
+	tst_net_run $safe $rparam "sysctl -q -w" "$name=$value"

I wonder if it were a bit clearer if we moves all params to second arg:

	tst_net_run $safe "sysctl" "$name=$value -q -w"

OK, but changed to "sysctl" "-q -w $name=$value" because the other options should also be placed before the key/value pair:

    Usage: sysctl -p [-enq] [FILE...] / [-enqaw] [KEY[=VALUE]]...

Thanks for addressing it!

Kind regards,
Petr

#5 lore raw

PATCH 3/3 network/tst_net.sh: extend the pattern in tst_ping_opt_unsupported()

In reply to Alexey Kodanev
---
 testcases/lib/tst_net.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_net.sh +1 -1
index bb30c13ec..c15413a6d 100644
@@ -811,7 +811,7 @@ tst_netload_compare()
 
 tst_ping_opt_unsupported()
 {
-	ping $@ 2>&1 | grep -q "invalid option"
+	ping $@ 2>&1 | grep -qE "(invalid|unrecognized) option"
 }
 
 # tst_ping -c COUNT -s MESSAGE_SIZES -p PATTERN -I IFACE -H HOST
Signature · 1 line
2.25.1
#6 lore raw

PATCH 3/3 network/tst_net.sh: extend the pattern in tst_ping_opt_unsupported()

Hi Alexey,

testcases/lib/tst_net.sh tst_netload_compare() · line 814

Quoted 2 lines
testcases/lib/tst_net.sh +1 -1
-	ping $@ 2>&1 | grep -q "invalid option"
+	ping $@ 2>&1 | grep -qE "(invalid|unrecognized) option"

Which implementation needs it? Both ping from iputils and busybox report "invalid option".

Kind regards,
Petr

#7 lore raw

PATCH 3/3 network/tst_net.sh: extend the pattern in tst_ping_opt_unsupported()

Hi Petr,

Quoted 8 lines · Petr Vorel

Hi Alexey,

testcases/lib/tst_net.sh tst_netload_compare() · line 814

Quoted 2 lines
testcases/lib/tst_net.sh +1 -1
-	ping $@ 2>&1 | grep -q "invalid option"
+	ping $@ 2>&1 | grep -qE "(invalid|unrecognized) option"

Which implementation needs it? Both ping from iputils and busybox report "invalid option".

It's busybox/ping that is using musl libc getopt():
misc/getopt.c: __getopt_msg(argv[0], ": unrecognized option: ", optchar, k);

#8 lore raw

PATCH 3/3 network/tst_net.sh: extend the pattern in tst_ping_opt_unsupported()

Hi Alexey,

Quoted 11 lines

Hi Petr,

Quoted 7 lines · Petr Vorel

Hi Alexey,

testcases/lib/tst_net.sh tst_netload_compare() · line 814

Quoted 2 lines
testcases/lib/tst_net.sh +1 -1
-	ping $@ 2>&1 | grep -q "invalid option"
+	ping $@ 2>&1 | grep -qE "(invalid|unrecognized) option"

Which implementation needs it? Both ping from iputils and busybox report "invalid option".

Quoted 2 lines

It's busybox/ping that is using musl libc getopt():
misc/getopt.c: __getopt_msg(argv[0], ": unrecognized option: ", optchar, k);

Ah, thx for info.

Kind regards,
Petr