Repository navigation
netlink: do not ack a successful dump - #15949
Merged
Merged
Conversation
A dump request with NLM_F_ACK got an NLMSG_ERROR ack in the same reply as the dump, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux skips the ack once a dump has started and still acks errors. Fixes gvisor#15945
carzh
approved these changes
Oct 30, 2026
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
Fixes #15945 A netlink dump request with NLM_F_ACK gets an NLMSG_ERROR ack in the reply stream, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux doesn't send that ack: once `__netlink_dump_start` starts a dump it returns -EINTR, and `netlink_rcv_skb` skips the ack in that case. `ProcessMessages` now skips `DumpAckMessage` when the handler produced a multipart reply (`ms.Multi`) and returned no error. It keys on the reply, not the NLM_F_DUMP bit, so non-dump requests and errors are still acked as before. Testing: new `NetlinkRouteTest.GetLinkDumpWithAck` sends RTM_GETLINK with NLM_F_DUMP|NLM_F_ACK and checks that no NLMSG_ERROR arrives, NLMSG_DONE does, and nothing is left to read afterwards. It fails without the change and passes with it. The rest of `//test/syscalls:socket_netlink_route_test_runsc_ptrace` passes, including `LinkUp`, `ChangeMTU`, `ChangeLinkName` and `GetLinkByIndexNotFound`, which cover non-dump acks and error acks. FUTURE_COPYBARA_INTEGRATE_REVIEW=#15949 from adi-IL:fix-netlink-dump-ack 9241ad3 PiperOrigin-RevId: 1010745170
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.
Fixes #15945
A netlink dump request with NLM_F_ACK gets an NLMSG_ERROR ack in the reply stream, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux doesn't send that ack: once
__netlink_dump_startstarts a dump it returns -EINTR, andnetlink_rcv_skbskips the ack in that case.ProcessMessagesnow skipsDumpAckMessagewhen the handler produced a multipart reply (ms.Multi) and returned no error. It keys on the reply, not the NLM_F_DUMP bit, so non-dump requests and errors are still acked as before.Testing: new
NetlinkRouteTest.GetLinkDumpWithAcksends RTM_GETLINK with NLM_F_DUMP|NLM_F_ACK and checks that no NLMSG_ERROR arrives, NLMSG_DONE does, and nothing is left to read afterwards. It fails without the change and passes with it. The rest of//test/syscalls:socket_netlink_route_test_runsc_ptracepasses, includingLinkUp,ChangeMTU,ChangeLinkNameandGetLinkByIndexNotFound, which cover non-dump acks and error acks.