[AI] fix: stop Execute after ACK or Done - #315
Conversation
Execute could wait forever when conntrack sent a Multi reply followed by an ACK without Done. For requests with Acknowledge, keep receiving until ACK or Done, following kernel YNL behavior.
|
Thanks for the PR! I will try to review as soon as I can. Some initial questions after looking at it...
Judging from your tests, you get a multi-part reply even though you do not set a
Indeed, they do seem to exit when an ACK is received, I wonder whether that's the reason for it. Could you provide some more details about the issue ? Are you replicating the exact same requests that conntrack makes ? Assuming the fix is correct, we should consider having it in the plain receive path as well. |
Yes, when getting a single conntrack entry via
The added integration test does exactly that - admittingly the assertion code isn't the most obvious.
Yup, see above snippet.
I can have a look! |
|
Seems like the kernel sets the NLM_F_MULTI when port_id != 0 for conntrack. It seems like From our side this might be a regression introduced in 5af0e4f. I'll try to understand more about this tomorrow. There might more netfilter subsystems that are affected.
👍
I believe the fix would be to reset for {
more = false
for m, err := range c.sock.ReceiveIter() {
...Thanks for the detailed explanation! |
Receive kept the multipart state set after a datagram containing NLM_F_MULTI. When conntrack returned a single Multi reply followed by an acknowledgement in a separate datagram, it waited indefinitely for another response. Reset the state before each Socket.ReceiveIter call so completion is determined by the latest datagram, restoring the behavior from before ReceiveIter was introduced.
|
@nickgarlis I'm very sorry for not getting back here! I've tested the proposed minimal fix ( |
nickgarlis
left a comment
There was a problem hiding this comment.
Thanks for changing your approach. The tests look good!
Execute could wait forever when conntrack sent a Multi reply followed by an ACK without Done.
For requests with Acknowledge, keep receiving until ACK or Done, following kernel YNL behavior.
Notes:
Error (0).