]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: udp: Avoid socket skips and repeats during iteration
authorJordan Rife <jordan@jrife.io>
Fri, 2 May 2025 16:15:24 +0000 (09:15 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Fri, 2 May 2025 19:07:46 +0000 (12:07 -0700)
commit5668f73f09aef16755da4453dc0b5b725469878a
tree73b19b0d6c5c329a159cf1541f76f83981f0fb06
parent251c6636e0159fca79c3b78d982d1cec6f8785bc
bpf: udp: Avoid socket skips and repeats during iteration

Replace the offset-based approach for tracking progress through a bucket
in the UDP table with one based on socket cookies. Remember the cookies
of unprocessed sockets from the last batch and use this list to
pick up where we left off or, in the case that the next socket
disappears between reads, find the first socket after that point that
still exists in the bucket and resume from there.

This approach guarantees that all sockets that existed when iteration
began and continue to exist throughout will be visited exactly once.
Sockets that are added to the table during iteration may or may not be
seen, but if they are they will be seen exactly once.

Signed-off-by: Jordan Rife <jordan@jrife.io>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
net/ipv4/udp.c