test_net.sh: add tst_wait_ipv6_dad()
PATCH 1/1 test_net.sh: add tst_wait_ipv6_dad()
New function is waiting for IPv6 DAD completion on the specified interfaces.
Add it to netns setup to make sure previously configured IPv6 addresses are ready to be used by tests.
--- testcases/lib/test_net.sh | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
testcases/lib/test_net.sh +28 -0
@@ -44,6 +44,7 @@ init_ltp_netspace() TST_IPV6=6 tst_add_ipaddr TST_IPV6=6 tst_add_ipaddr rhost + tst_wait_ipv6_dad } # Run command on remote host.
@@ -278,6 +279,33 @@ tst_restore_ipaddr() return $ret } +# tst_wait_ipv6_dad [LHOST_IFACE] [RHOST_IFACE] +# wait for IPv6 DAD completion +tst_wait_ipv6_dad() +{ + local ret= + local i= + local iface_loc=${1:-$(tst_iface)} + local iface_rmt=${2:-$(tst_iface rhost)} + + for i in $(seq 1 5); do + ip a sh $iface_loc | grep -q tentative + ret=$? + + tst_rhost_run -c "ip a sh $iface_rmt | grep -q tentative" + + [ $ret -ne 0 -a $? -ne 0 ] && return + + if [ $i -ne 5 ]; then + tst_resm TINFO "wait for IPv6 DAD completion $i/5 sec" + tst_sleep 1s + continue + fi + + tst_resm TWARN "Interface has tentative IP address(es)" + done +} + # tst_netload ADDR [FILE] [TYPE] [OPTS] # Run network load test # ADDR: IP address
Signature · 1 line
1.7.1
PATCH 1/1 test_net.sh: add tst_wait_ipv6_dad()
Hi!
Quoted 8 lines
testcases/lib/test_net.sh +8
-0+tst_wait_ipv6_dad() +{ + local ret= + local i= + local iface_loc=${1:-$(tst_iface)} + local iface_rmt=${2:-$(tst_iface rhost)} + + for i in $(seq 1 5); do
testcases/lib/test_net.sh tst_restore_ipaddr() · line 301
Quoted 10 lines
testcases/lib/test_net.sh +10
-0+ ip a sh $iface_loc | grep -q tentative + ret=$? + + tst_rhost_run -c "ip a sh $iface_rmt | grep -q tentative" + + [ $ret -ne 0 -a $? -ne 0 ] && return + + if [ $i -ne 5 ]; then + tst_resm TINFO "wait for IPv6 DAD completion $i/5 sec" + tst_sleep 1s
My only concern here is that sleeping for 1s is too much and will slow down things more than it should. How long this operation usually takes? Can we reduce the sleep to 0.1s here and print the TINFO only if [ $((i % 10)) -eq 0 ] ?
Quoted 16 lines
testcases/lib/test_net.sh +7
-0+ continue + fi + + tst_resm TWARN "Interface has tentative IP address(es)" + done +} + # tst_netload ADDR [FILE] [TYPE] [OPTS] # Run network load test # ADDR: IP addressSignature · 5 lines
1.7.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 test_net.sh: add tst_wait_ipv6_dad()
Quoted 5 lines · Cyril Hrubis
My only concern here is that sleeping for 1s is too much and will slow down things more than it should. How long this operation usually takes? Can we reduce the sleep to 0.1s here and print the TINFO only if [ $((i % 10)) -eq 0 ] ?
Hi Cyril,
1 sec minimum, I guess it should be fine if I add a check whether interfaces
already configured or not, as a result we shouldn't flush/configure/wait on each
test or group of tests...
Thanks,
Alexey
PATCH 1/1 test_net.sh: add tst_wait_ipv6_dad()
In reply to Cyril HrubisQuoted 15 lines · Cyril Hrubis
Hi!
Quoted 14 lines
testcases/lib/test_net.sh +14
-0+tst_wait_ipv6_dad() +{ + local ret= + local i= + local iface_loc=${1:-$(tst_iface)} + local iface_rmt=${2:-$(tst_iface rhost)} + + for i in $(seq 1 5); do + ip a sh $iface_loc | grep -q tentative + ret=$? + + tst_rhost_run -c "ip a sh $iface_rmt | grep -q tentative" + + [ $ret -ne 0 -a $? -ne 0 ] && return
Quoted 8 lines
testcases/lib/test_net.sh tst_restore_ipaddr() · line 301
Quoted 4 lines
testcases/lib/test_net.sh +4
-0+ + if [ $i -ne 5 ]; then + tst_resm TINFO "wait for IPv6 DAD completion $i/5 sec" + tst_sleep 1sMy only concern here is that sleeping for 1s is too much and will slow down things more than it should. How long this operation usually takes? Can we reduce the sleep to 0.1s here and print the TINFO only if [ $((i % 10)) -eq 0 ] ?
Changed to 100ms and applied.