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
F168963481: D57813.id180521.diff
Sun, Aug 30, 11:44 PM
Unknown Object (File)
Sat, Aug 29, 8:31 PM
Unknown Object (File)
Sat, Aug 29, 12:06 AM
Unknown Object (File)
Thu, Aug 27, 7:40 PM
Unknown Object (File)
Thu, Aug 27, 7:31 PM
Unknown Object (File)
Thu, Aug 27, 7:25 PM
Unknown Object (File)
Wed, Aug 26, 10:30 PM
Unknown Object (File)
Wed, Aug 26, 11:15 AM

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