net/traceroute01: Check also -T flag
PATCH 1/1 net/traceroute01: Check also -T flag
From: Petr Vorel <[email protected]>
and move checks to run_trace()
There are 3 traceroute versions:
* Dmitry Butskoy (http://traceroute.sourceforge.net/)
* busybox
* iputils (only tracepath6; deprecated, but still used (e.g. OpenWrt Project)
-I is supported by Dmitry Butskoy's and busybox implementation -T is supported only by Dmitry Butskoy's implementation
---
Hi Alexey, Kory,
follow up to Kory's fix (there are some problems with suse.cz mailserver, thus I haven't reply about pushing your patch).
Kind regards,
Petr
testcases/network/traceroute/traceroute01.sh | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-)
testcases/network/traceroute/traceroute01.sh +17 -13
@@ -13,9 +13,12 @@ TST_NEEDS_TMPDIR=1 setup() { - tst_res TINFO "traceroute version:" - tst_res TINFO $(traceroute --version 2>&1) - [ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils is not supported" + + TRACEROUTE=traceroute${TST_IPV6} + tst_require_cmds $TRACEROUTE + + tst_res TINFO "$TRACEROUTE version:" + tst_res TINFO $($TRACEROUTE --version 2>&1) } run_trace()
@@ -24,18 +27,23 @@ run_trace() local ip=$(tst_ipaddr rhost) local pattern="^[ ]+1[ ]+$ip([ ]+[0-9]+[.][0-9]+ ms){3}" + if $TRACEROUTE $opts 2>&1 | grep -q "invalid option"; then + tst_res TCONF "$opts flag not supported" + return + fi + # According to man pages, default sizes: local bytes=60 [ "$TST_IPV6" ] && bytes=80 - EXPECT_PASS traceroute $ip $bytes -n -m 2 $opts \>out.log 2>&1 + EXPECT_PASS $TRACEROUTE $ip $bytes -n -m 2 $opts \>out.log 2>&1 grep -q "$bytes byte" out.log if [ $? -ne 0 ]; then cat out.log tst_res TFAIL "'$bytes byte' not found" else - tst_res TPASS "traceroute use $bytes bytes" + tst_res TPASS "$TRACEROUTE use $bytes bytes" fi tail -1 out.log | grep -qE "$pattern"
@@ -43,24 +51,20 @@ run_trace() cat out.log tst_res TFAIL "pattern '$pattern' not found in log" else - tst_res TPASS "traceroute test completed with 1 hop" + tst_res TPASS "$TRACEROUTE test completed with 1 hop" fi } test1() { - tst_res TINFO "run traceroute with ICMP ECHO" + tst_res TINFO "run $TRACEROUTE with ICMP ECHO" run_trace -I } test2() { - tst_res TINFO "run traceroute with TCP SYN" - if traceroute -T 2>&1 | grep -q "invalid option"; then - tst_res TCONF "-T flag (TCP SYN) not supported" - else - run_trace -T - fi + tst_res TINFO "run $TRACEROUTE with TCP SYN" + run_trace -T } tst_run
Signature · 1 line
2.29.2
PATCH 1/1 net/traceroute01: Check also -T flag
Hello Petr,
Just find out you didn't merge your patch which makes the code cleaner. :)
Regards,
Quoted 101 lines · On Thu, 12 Nov 2020 18:36:09 +0100 Petr Vorel <[email protected]> wrote:
From: Petr Vorel <[email protected]>
and move checks to
run_trace()There are 3 traceroute versions:
* Dmitry Butskoy (http://traceroute.sourceforge.net/)
* busybox
* iputils (only tracepath6; deprecated, but still used (e.g. OpenWrt Project)(quoted diff) +0
-2-I is supported by Dmitry Butskoy's and busybox implementation -T is supported only by Dmitry Butskoy's implementationSigned-off-by Petr Vorel <[email protected]>---
Hi Alexey, Kory,follow up to Kory's fix (there are some problems with suse.cz mailserver, thus I haven't reply about pushing your patch).
Kind regards,
Petrtestcases/network/traceroute/traceroute01.sh | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/testcases/network/traceroute/traceroute01.shindex38f4d3b85..90030af39100755 ---a/testcases/network/traceroute/traceroute01.sh
+++b/testcases/network/traceroute/traceroute01.shtestcases/network/traceroute/traceroute01.sh +0
-3@@ -13,9 +13,12 @@ TST_NEEDS_TMPDIR=1 setup() { - tst_res TINFO "traceroute version:" - tst_res TINFO $(traceroute --version 2>&1) - [ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils isnot supported" +
testcases/network/traceroute/traceroute01.sh +16
-10+ TRACEROUTE=traceroute${TST_IPV6} + tst_require_cmds $TRACEROUTE + + tst_res TINFO "$TRACEROUTE version:" + tst_res TINFO $($TRACEROUTE --version 2>&1) } run_trace()@@ -24,18 +27,23 @@ run_trace() local ip=$(tst_ipaddr rhost) local pattern="^[ ]+1[ ]+$ip([ ]+[0-9]+[.][0-9]+ ms){3}" + if $TRACEROUTE $opts 2>&1 | grep -q "invalid option"; then + tst_res TCONF "$opts flag not supported" + return + fi + # According to man pages, default sizes: local bytes=60 [ "$TST_IPV6" ] && bytes=80 - EXPECT_PASS traceroute $ip $bytes -n -m 2 $opts \>out.log 2>&1 + EXPECT_PASS $TRACEROUTE $ip $bytes -n -m 2 $opts \>out.log 2>&1 grep -q "$bytes byte" out.log if [ $? -ne 0 ]; then cat out.log tst_res TFAIL "'$bytes byte' not found" else - tst_res TPASS "traceroute use $bytes bytes" + tst_res TPASS "$TRACEROUTE use $bytes bytes" fi tail -1 out.log | grep -qE "$pattern"@@ -43,24 +51,20 @@ run_trace() cat out.log tst_res TFAIL "pattern '$pattern' not found in log" else - tst_res TPASS "traceroute test completed with 1 hop" + tst_res TPASS "$TRACEROUTE test completed with 1 hop" fi } test1() { - tst_res TINFO "run traceroute with ICMP ECHO" + tst_res TINFO "run $TRACEROUTE with ICMP ECHO" run_trace -I } test2() { - tst_res TINFO "run traceroute with TCP SYN" - if traceroute -T 2>&1 | grep -q "invalid option"; then - tst_res TCONF "-T flag (TCP SYN) not supported" - else - run_trace -T - fi + tst_res TINFO "run $TRACEROUTE with TCP SYN" + run_trace -T } tst_run
Signature · 3 lines
K?ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH 1/1 net/traceroute01: Check also -T flag
Hi Kory, Alexey,
Quoted 3 lines
Hello Petr,
Just find out you didn't merge your patch which makes the code cleaner. :)
Waiting for Alexey's review.
Also hesitate about tracepath6 symlink to traceroute being always installed on all distros (hopefully yes).
Kind regards,
Petr
Quoted 107 lines
Regards,
Quoted 101 lines · On Thu, 12 Nov 2020 18:36:09 +0100 Petr Vorel <[email protected]> wrote:
From: Petr Vorel <[email protected]>
and move checks to
run_trace()There are 3 traceroute versions:
* Dmitry Butskoy (http://traceroute.sourceforge.net/)
* busybox
* iputils (only tracepath6; deprecated, but still used (e.g. OpenWrt Project)(quoted diff) +0
-2-I is supported by Dmitry Butskoy's and busybox implementation -T is supported only by Dmitry Butskoy's implementationSigned-off-by Petr Vorel <[email protected]>---
Hi Alexey, Kory,follow up to Kory's fix (there are some problems with suse.cz mailserver, thus I haven't reply about pushing your patch).
Kind regards,
Petrtestcases/network/traceroute/traceroute01.sh | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/testcases/network/traceroute/traceroute01.shindex38f4d3b85..90030af39100755 ---a/testcases/network/traceroute/traceroute01.sh
+++b/testcases/network/traceroute/traceroute01.shtestcases/network/traceroute/traceroute01.sh +0
-3@@ -13,9 +13,12 @@ TST_NEEDS_TMPDIR=1 setup() { - tst_res TINFO "traceroute version:" - tst_res TINFO $(traceroute --version 2>&1) - [ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils isnot supported" +
testcases/network/traceroute/traceroute01.sh +16
-10+ TRACEROUTE=traceroute${TST_IPV6} + tst_require_cmds $TRACEROUTE + + tst_res TINFO "$TRACEROUTE version:" + tst_res TINFO $($TRACEROUTE --version 2>&1) } run_trace()@@ -24,18 +27,23 @@ run_trace() local ip=$(tst_ipaddr rhost) local pattern="^[ ]+1[ ]+$ip([ ]+[0-9]+[.][0-9]+ ms){3}" + if $TRACEROUTE $opts 2>&1 | grep -q "invalid option"; then + tst_res TCONF "$opts flag not supported" + return + fi + # According to man pages, default sizes: local bytes=60 [ "$TST_IPV6" ] && bytes=80 - EXPECT_PASS traceroute $ip $bytes -n -m 2 $opts \>out.log 2>&1 + EXPECT_PASS $TRACEROUTE $ip $bytes -n -m 2 $opts \>out.log 2>&1 grep -q "$bytes byte" out.log if [ $? -ne 0 ]; then cat out.log tst_res TFAIL "'$bytes byte' not found" else - tst_res TPASS "traceroute use $bytes bytes" + tst_res TPASS "$TRACEROUTE use $bytes bytes" fi tail -1 out.log | grep -qE "$pattern"@@ -43,24 +51,20 @@ run_trace() cat out.log tst_res TFAIL "pattern '$pattern' not found in log" else - tst_res TPASS "traceroute test completed with 1 hop" + tst_res TPASS "$TRACEROUTE test completed with 1 hop" fi } test1() { - tst_res TINFO "run traceroute with ICMP ECHO" + tst_res TINFO "run $TRACEROUTE with ICMP ECHO" run_trace -I } test2() { - tst_res TINFO "run traceroute with TCP SYN" - if traceroute -T 2>&1 | grep -q "invalid option"; then - tst_res TCONF "-T flag (TCP SYN) not supported" - else - run_trace -T - fi + tst_res TINFO "run $TRACEROUTE with TCP SYN" + run_trace -T } tst_run
PATCH 1/1 net/traceroute01: Check also -T flag
Quoted 8 lines · Petr Vorel
Hi Kory, Alexey,
Quoted 3 lines
Hello Petr,
Just find out you didn't merge your patch which makes the code cleaner. :)
Waiting for Alexey's review.
Also hesitate about tracepath6 symlink to traceroute being always installed on all distros (hopefully yes).
Hi Petr,
From the subject it seems you are adding a new check for -T flag but it is actually for -I option?
I think it's ok using symlink or -4/-6, it is also adding an extra check for ipv6 that $(tst_ipaddr rhost) is indeed ipv6.
PATCH 1/1 net/traceroute01: Check also -T flag
Hi Alexey,
Quoted 8 lines · Petr Vorel
Quoted 7 lines
Hi Kory, Alexey,
Quoted 3 lines
Hello Petr,
Just find out you didn't merge your patch which makes the code cleaner. :)
Waiting for Alexey's review.
Also hesitate about tracepath6 symlink to traceroute being always installed
I meant here traceroute6 symlink to traceroute.
Quoted 6 lines
Quoted 1 line
on all distros (hopefully yes).
Hi Petr,
From the subject it seems you are adding a new check for -T flag but it is actually for -I option?
Good catch, thanks!
Quoted 1 line
I think it's ok using symlink or -4/-6,
If nobody complains I'd keep symlink version as it can check traceroute from iputils. -4/-6 is more portable. If anybody complains and we revert it back, I'd also put back iputils related warning.
Quoted 2 lines
it is also adding an extra
check for ipv6 that $(tst_ipaddr rhost) is indeed ipv6.
Sorry, I didn't get this.
BTW ack this change?
Kind regards,
Petr
PATCH 1/1 net/traceroute01: Check also -T flag
Quoted 19 lines · Petr Vorel
Hi Alexey,
Quoted 8 lines · Petr Vorel
Quoted 7 lines
Hi Kory, Alexey,
Quoted 3 lines
Hello Petr,
Just find out you didn't merge your patch which makes the code cleaner. :)
Waiting for Alexey's review.
Also hesitate about tracepath6 symlink to traceroute being always installedI meant here traceroute6 symlink to traceroute.
Quoted 6 lines
Quoted 1 line
on all distros (hopefully yes).
Hi Petr,
From the subject it seems you are adding a new check for -T flag but it is actually for -I option?
Good catch, thanks!
Quoted 9 lines
Quoted 1 line
I think it's ok using symlink or -4/-6,
If nobody complains I'd keep symlink version as it can check traceroute from iputils. -4/-6 is more portable. If anybody complains and we revert it back, I'd also put back iputils related warning.
Quoted 2 lines
it is also adding an extra
check for ipv6 that $(tst_ipaddr rhost) is indeed ipv6.Sorry, I didn't get this.
Hi Petr,
traceroute6 127.0.0.1
traceroute6: 127.0.0.1: Address family for hostname not supported
And both ::1 and 127.0.0.1 are ok for traceroute without the address family option.
Quoted 2 lines
BTW ack this change?
PATCH 1/1 net/traceroute01: Check also -T flag
Hi Alexey,
...
Quoted 7 lines
Hi Petr,
traceroute6 127.0.0.1
traceroute6: 127.0.0.1: Address family for hostname not supportedAnd both ::1 and 127.0.0.1 are ok for traceroute without the address family option.
Thanks for an explanation!
Quoted 4 lines
Quoted 1 line
BTW ack this change?
Acked-by Alexey Kodanev <[email protected]>
Thanks! Merged.
Kind regards,
Petr