Page MenuHomeFreeBSD

sack_filter: Brand-new path in sack_filter_blks
AbandonedPublic

Authored by thebugfixers_pm.me on Jun 24 2026, 10:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 11, 7:58 PM
Unknown Object (File)
Mon, Aug 10, 12:36 AM
Unknown Object (File)
Sun, Aug 9, 6:36 PM
Unknown Object (File)
Sun, Aug 9, 12:07 AM
Unknown Object (File)
Fri, Aug 7, 7:26 PM
Unknown Object (File)
Fri, Aug 7, 3:42 PM
Unknown Object (File)
Thu, Aug 6, 12:26 PM
Unknown Object (File)
Wed, Aug 5, 9:44 PM

Details

Summary

Added at counter and memcpy(&in[at], &in[i], ...). When a block is skipped via continue, at lags behind i, so subsequent accepted blocks are shifted forward into the gap. cnt_added equals at, so the caller iterates in[0..cnt_added-1] and sees exactly the accepted blocks.

Replaced unconditional sf->sf_used++ with if (sack_blk_used(sf, sf->sf_cur) == 0) sf->sf_used++. The bit is checked before it's set by sack_blk_set on the same line. If the slot was already in use (wraparound with numblks ≥ SACK_FILTER_BLOCKS), sf_used is not inflated. This matches the pattern in sack_filter_run.

Replaced if (sf->sf_cur) sf->sf_cur--; with sf->sf_cur = (sf->sf_cur + SACK_FILTER_BLOCKS - 1) % SACK_FILTER_BLOCKS;. The modular form handles the case where sf_cur wrapped to 0, correctly yielding SACK_FILTER_BLOCKS - 1. The condition changed from if (sf->sf_cur) to if (cnt_added) so we don't touch sf_cur when nothing was added.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

tuexen requested changes to this revision.Jun 28 2026, 4:00 PM
tuexen added a subscriber: tuexen.

I don't see what problem this patch should solve nor do I think at compiles at all, since the variable at is not declared in sack_filter_blks(). Please describe which bug you want to fix. Also, when providing a patch, provide context. If you generate the patch file using git diff, please use git diff -U999999 instead.

This revision now requires changes to proceed.Jun 28 2026, 4:00 PM