icmp: return ENOENT when no echo reply is available - #590
Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Collaborator
Author
rjarry
requested review from
christophefontaine
and removed request for
david-marchand
April 8, 2026 15:43
rjarry
force-pushed
the
icmp-msgsize
branch
4 times, most recently
from
April 9, 2026 06:55
dde1f3a to
85c5709
Compare
christophefontaine
approved these changes
Apr 9, 2026
david-marchand
approved these changes
Apr 9, 2026
Since commit ab83fb6 ("api: validate response payload size in clients"), the client library rejects responses whose payload size does not match the declared response type. The ICMP and ICMPv6 recv handlers were returning success with an empty payload when no reply had arrived yet, which now triggers EMSGSIZE on the client side. Here is an excerpt from a failed test (truncated): ``` + grcli ping fd00:ba4:1::2 count 3 delay 10 API: accept_conn_cb: new connection fd=20 pid=17607 API: read_cb: ... (GR_HELLO) req_len=132 status=0 (Success) resp_len=0 API: read_cb: ... (GR_IP6_ICMP6_SEND) req_len=26 status=0 (Success) resp_len=0 TRACE: [tx p1] ... / ICMPv6 neigh solicit who has fd00:ba4:1::2? ... API: read_cb: ... (GR_IP6_ICMP6_RECV) req_len=4 status=0 (Success) resp_len=0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: command failed: Message too long (EMSGSIZE) API: disconnect_client: client pid=17607 disconnected TRACE: [rx p1] ... / ICMPv6 neigh advert fd00:ba4:1::2 is at ... TRACE: [tx p1] ... / ICMPv6 echo request id=53710 seq=0, (pkt_len=70) TRACE: [rx p1] ... / ICMPv6 echo reply id=53710 seq=0, (pkt_len=70) ``` Return ENOENT from the recv handlers when no matching echo reply is found. Adjust the CLI polling loops to retry on ENOENT and treat it as a normal "not yet" condition rather than a fatal error. I have checked that no other API handlers return an empty success response when they are expected to return a payload with the following obscure shell pipeline: ``` sed -En 's/^GR_REQ\((.+), .+, (.+)\)\;$/\1 \2/p' $(git grep -wl GR_REQ) | grep -v gr_empty | sed -En 's/(.*) struct .*/\1/p' | while read -r req; do sed -En "s/^.*api_handler\($req, (.+)\);$/\\1/p" $(git grep -wl $req); done | \ while read -r func; do sed -En "/$func\\(/,/^}\$/p" $(git grep -wl $func); done | grep -c 'api_out(0, 0' ``` Signed-off-by: Robin Jarry <rjarry@redhat.com> Reviewed-by: Christophe Fontaine <cfontain@redhat.com> Reviewed-by: David Marchand <david.marchand@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since commit ab83fb6 ("api: validate response payload size in clients"), the client library rejects responses whose payload size does not match the declared response type. The ICMP and ICMPv6 recv handlers were returning success with an empty payload when no reply had arrived yet, which now triggers EMSGSIZE on the client side.
Here is an example trace (truncated):
Return ENOENT from the recv handlers when no matching echo reply is found. Adjust the CLI polling loops to retry on ENOENT and treat it as a normal "not yet" condition rather than a fatal error.
I have checked that no other API handlers return an empty success response when they are expected to return a payload with the following obscure shell pipeline:
Technical changes
Control layer (ICMP / ICMPv6 recv handlers)
CLI layer (polling loops)
Control-flow simplification
Workflows and test helpers
Rationale tied to code history