Page MenuHomeFreeBSD

sack_filter: Brand-new path in sack_filter_blks
AbandonedPublic

Authored by thebugfixers_pm.me on Wed, Jun 24, 10:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 6, 3:34 AM
Unknown Object (File)
Mon, Jul 6, 1:41 AM
Unknown Object (File)
Sun, Jul 5, 8:37 PM
Unknown Object (File)
Sun, Jul 5, 8:34 PM
Unknown Object (File)
Sat, Jul 4, 10:08 AM
Unknown Object (File)
Sat, Jul 4, 10:05 AM
Unknown Object (File)
Fri, Jul 3, 9:36 PM
Unknown Object (File)
Fri, Jul 3, 3:29 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.Sun, Jun 28, 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.Sun, Jun 28, 4:00 PM