tst_test.sh: TCONF on xfrm algorithms rejected via netlink extack
PATCH 1/1 tst_test.sh: TCONF on xfrm algorithms rejected via netlink extack
From: Avinesh Kumar <[email protected]>
TST_RTNL_CHK maps a kernel's "not supported" reply to TCONF by matching the "RTNETLINK answers: ..." strings. Since v6.1 the kernel reports an unknown/removed xfrm algorithm with -ENOSYS plus a netlink extack message, which iproute2 prints as:
Error: Requested AUTH algorithm not found.
This matches none of the existing strings, so TST_RTNL_CHK() reports TBROK instead of skipping.
tcp_ipsec 1 TBROK: ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi 0x1000 proto esp enc serpent 0x81ea7757e7c71dc8f95bee692c0e8b1a2ac6e006066e74ce0024a54ee0175b70 auth hmac(rmd160) 0xf46316501051af3e3b2abd0bdfed7cf21a76fe04 mode transport sel src 10.0.0.2 dst 10.0.0.1 failed: Error: Requested AUTH algorithm not found.
This surfaced with kernel v7.1 commit05d42dc8ab92 ("xfrm: Drop support for HMAC-RIPEMD-160") which removed hmac(rmd160) and broke the net_stress.ipsec_* "-a rmd160" variants. Match the extack form too.
--- testcases/lib/tst_test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
testcases/lib/tst_test.sh +8 -3
@@ -266,13 +266,18 @@ TST_RTNL_CHK() local msg1="RTNETLINK answers: Function not implemented" local msg2="RTNETLINK answers: Operation not supported" local msg3="RTNETLINK answers: Protocol not supported" + # Since v6.1 the kernel reports an unknown/removed xfrm algorithm via + # netlink extack (-ENOSYS + NL_SET_ERR_MSG), which iproute2 prints as + # "Error: Requested AUTH algorithm not found." + local msg4="Requested .* algorithm not found" local output="$($@ 2>&1 || echo 'LTP_ERR')" - local msg + local msg match echo "$output" | grep -q "LTP_ERR" || return 0 - for msg in "$msg1" "$msg2" "$msg3"; do - echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg" + for msg in "$msg1" "$msg2" "$msg3" "$msg4"; do + match=$(echo "$output" | grep "$msg") && \ + tst_brk TCONF "'$@': $match" done tst_brk TBROK "$@ failed: $output"
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 1 line · Avinesh Kumar
tst_test.sh: TCONF on xfrm algorithms rejected via netlink extack
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 11 lines
TST_RTNL_CHKmaps a kernel's "not supported" reply to TCONF by matching the "RTNETLINK answers: ..." strings. Since v6.1 the kernel reports an unknown/removed xfrm algorithm with-ENOSYSplus a netlink extack message, which iproute2 prints as:Error: Requested AUTH algorithm not found.
This matches none of the existing strings, so
TST_RTNL_CHK()reports TBROK instead of skipping.
tcp_ipsec1 TBROK: ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi0x1000proto esp enc serpent0x81ea7757e7c71dc8f95bee692c0e8b1a2ac6e006066e74ce0024a54ee0175b70auth hmac(rmd160)0xf46316501051af3e3b2abd0bdfed7cf21a76fe04mode transport sel src 10.0.0.2 dst 10.0.0.1 failed: Error: Requested AUTH algorithm not found.
Thanks for finding it!
Quoted 4 lines
This surfaced with kernel v7.1 commit
05d42dc8ab92("xfrm: Drop support for HMAC-RIPEMD-160") which removed hmac(rmd160) and broke the net_stress.ipsec_* "-a rmd160" variants. Match the extack form too.
+1 for documenting the change.
Quoted 10 lines
Signed-off-by Avinesh Kumar <[email protected]>--- testcases/lib/tst_test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)testcases/lib/tst_test.sh +0
-0
testcases/lib/tst_test.sh TST_RTNL_CHK() · line 273
Quoted 8 lines
testcases/lib/tst_test.sh +4
-0@@ -266,13 +266,18 @@ TST_RTNL_CHK() local msg1="RTNETLINK answers: Function not implemented" local msg2="RTNETLINK answers: Operation not supported" local msg3="RTNETLINK answers: Protocol not supported" + # Since v6.1 the kernel reports an unknown/removed xfrm algorithm via + # netlink extack (-ENOSYS + NL_SET_ERR_MSG), which iproute2 prints as + # "Error: Requested AUTH algorithm not found." + local msg4="Requested .* algorithm not found" local output="$($@ 2>&1 || echo 'LTP_ERR')"
nit: we have in $output also "LTP_ERR" in the end (on error)...
testcases/lib/tst_test.sh TST_RTNL_CHK() · line 280
Quoted 10 lines
testcases/lib/tst_test.sh +4
-3- local msg + local msg match echo "$output" | grep -q "LTP_ERR" || return 0 - for msg in "$msg1" "$msg2" "$msg3"; do - echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg" + for msg in "$msg1" "$msg2" "$msg3" "$msg4"; do + match=$(echo "$output" | grep "$msg") && \ + tst_brk TCONF "'$@': $match"
... now we print error message also with "LTP_ERR" in the end. I wonder if we should bother with removing it, e.g. with sed:
- match=$(echo "$output" | grep "$msg") && \
+ match=$(echo "$output" | grep "$msg" | sed 's/LTP_ERR$//') && \
(untested)
Both w/a this change (can be done before merge).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Petr,
Thank for the review.
Quoted 28 lines
testcases/lib/tst_test.sh TST_RTNL_CHK() · line 273
Quoted 13 lines
testcases/lib/tst_test.sh +4
-0@@ -266,13 +266,18 @@ TST_RTNL_CHK() local msg1="RTNETLINK answers: Function not implemented" local msg2="RTNETLINK answers: Operation not supported" local msg3="RTNETLINK answers: Protocol not supported" + # Since v6.1 the kernel reports an unknown/removed xfrm algorithm via + # netlink extack (-ENOSYS + NL_SET_ERR_MSG), which iproute2 prints as + # "Error: Requested AUTH algorithm not found." + local msg4="Requested .* algorithm not found" local output="$($@ 2>&1 || echo 'LTP_ERR')"nit: we have in $output also "
LTP_ERR" in the end (on error)...testcases/lib/tst_test.sh TST_RTNL_CHK() · line 280
Quoted 10 lines
testcases/lib/tst_test.sh +4
-3- local msg + local msg match echo "$output" | grep -q "LTP_ERR" || return 0 - for msg in "$msg1" "$msg2" "$msg3"; do - echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg" + for msg in "$msg1" "$msg2" "$msg3" "$msg4"; do + match=$(echo "$output" | grep "$msg") && \ + tst_brk TCONF "'$@': $match"... now we print error message also with "
LTP_ERR" in the end. I wonder if we should bother with removing it, e.g. with sed:
Review
Quoted 2 lines
(quoted diff) +1
-1- match=$(echo "$output" | grep "$msg") && \ + match=$(echo "$output" | grep "$msg" | sed 's/LTP_ERR$//') && \
I tested my patch, and I see atleast the TCONF path is fine, it does not print 'LTP_ERR' -
tcp_ipsec 1 TCONF: 'ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi 0x1000 proto esp enc serpent 0x5a78724d91fbdab8873e6bc7933816f9bb58b3da90ec2a6e0346ba41c6c18c63 auth hmac(rmd160) 0x4b53e65cb2e928d34c0db747782dda0457a3e4ed mode transport sel src 10.0.0.2 dst 10.0.0.1': Error: Requested AUTH algorithm not found.
but we will have it printed in TRBOK cases, as it was before this patch also:tcp_ipsec 1 TBROK: ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi 0x1000 proto esp enc serpent 0x40e68502109572c1014d131358bcc38b45ae02e5bbdae35752de32c2b6c68a6e auth hmac(rmd160) 0x87658785bf2ffc586ce49e4d31318246429063ef mode tunnel sel src 10.0.0.2 dst 10.0.0.1 failed: Error: Requested AUTH algorithm not found. LTP_ERR
Quoted 8 lines
(untested)
Both w/a this change (can be done before merge).
Reviewed-by Petr Vorel <[email protected]>Kind regards,
Petr
Regards,
Avinesh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 3 lines
Hi Petr,
Thank for the review.
Yw!
Quoted 39 lines
Quoted 28 lines
testcases/lib/tst_test.sh TST_RTNL_CHK() · line 273
Quoted 13 lines
testcases/lib/tst_test.sh +4
-0@@ -266,13 +266,18 @@ TST_RTNL_CHK() local msg1="RTNETLINK answers: Function not implemented" local msg2="RTNETLINK answers: Operation not supported" local msg3="RTNETLINK answers: Protocol not supported" + # Since v6.1 the kernel reports an unknown/removed xfrm algorithm via + # netlink extack (-ENOSYS + NL_SET_ERR_MSG), which iproute2 prints as + # "Error: Requested AUTH algorithm not found." + local msg4="Requested .* algorithm not found" local output="$($@ 2>&1 || echo 'LTP_ERR')"nit: we have in $output also "
LTP_ERR" in the end (on error)...testcases/lib/tst_test.sh TST_RTNL_CHK() · line 280
Quoted 10 lines
testcases/lib/tst_test.sh +4
-3- local msg + local msg match echo "$output" | grep -q "LTP_ERR" || return 0 - for msg in "$msg1" "$msg2" "$msg3"; do - echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg" + for msg in "$msg1" "$msg2" "$msg3" "$msg4"; do + match=$(echo "$output" | grep "$msg") && \ + tst_brk TCONF "'$@': $match"... now we print error message also with "
LTP_ERR" in the end. I wonder if we should bother with removing it, e.g. with sed:Review
Quoted 2 lines
(quoted diff) +1
-1- match=$(echo "$output" | grep "$msg") && \ + match=$(echo "$output" | grep "$msg" | sed 's/LTP_ERR$//') && \I tested my patch, and I see atleast the TCONF path is fine, it does not print '
LTP_ERR' -
tcp_ipsec1 TCONF: 'ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi0x1000proto esp enc serpent0x5a78724d91fbdab8873e6bc7933816f9bb58b3da90ec2a6e0346ba41c6c18c63auth hmac(rmd160)0x4b53e65cb2e928d34c0db747782dda0457a3e4edmode transport sel src 10.0.0.2 dst 10.0.0.1': Error: Requested AUTH algorithm not found.
Quoted 8 lines
but we will have it printed in TRBOK cases, as it was before this patch also:
tcp_ipsec1 TBROK: ip xfrm state add src 10.0.0.2 dst 10.0.0.1 spi0x1000proto esp enc serpent0x40e68502109572c1014d131358bcc38b45ae02e5bbdae35752de32c2b6c68a6eauth hmac(rmd160)0x87658785bf2ffc586ce49e4d31318246429063efmode tunnel sel src 10.0.0.2 dst 10.0.0.1 failed: Error: Requested AUTH algorithm not found.LTP_ERR
Good point! OK, in that case I've merged your solution as is and post a fix for this minor issue myself.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp