Page MenuHomeFreeBSD

tcp_hostcache: ensure expire and prune values stay consistent with each other
ClosedPublic

Authored by rscheff on Thu, Jul 23, 7:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 31, 5:13 AM
Unknown Object (File)
Fri, Jul 31, 4:03 AM
Unknown Object (File)
Thu, Jul 30, 11:38 PM
Unknown Object (File)
Thu, Jul 30, 7:47 PM
Unknown Object (File)
Thu, Jul 30, 11:41 AM
Unknown Object (File)
Thu, Jul 30, 9:59 AM
Unknown Object (File)
Thu, Jul 30, 9:00 AM
Unknown Object (File)
Thu, Jul 30, 8:37 AM

Details

Summary
While getting more information around PR296474 it was found that existing
configurations can end up with unexpectedly long pruning intervals, which
defy an explict short expire timeout of the hostcache entries.

When configuring the expire timeout to something short, make sure that the
prune time runs at least at that interval. Similarly, when adjusting the
prune interval up, ensure the expire timeout reflect that expected minimum
time also.

MFC after 3 days alongside D58360

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 75131
Build 72014: arc lint + arc unit

Event Timeline

pouria added inline comments.
sys/netinet/tcp_hostcache.c
184

Can we use UINT here?

636
638–639

Maybe use u_int?

  • also restart the callout so the next pruning will occur at the expected time

I agree that switching to unsigned for time intervals should be more correct. But the struct tcp_hostcache members now are int and that makes the sysctls to be signed. If structure members are also changed, a more thorough review of all the code that uses expire and prune needed. @rscheff since you already catched one difficult signedness bug in this code, maybe you can do such sweep, too?

rscheff marked 3 inline comments as done.
  • make sysctl configurables uint

I agree that switching to unsigned for time intervals should be more correct. But the struct tcp_hostcache members now are int and that makes the sysctls to be signed. If structure members are also changed, a more thorough review of all the code that uses expire and prune needed. @rscheff since you already catched one difficult signedness bug in this code, maybe you can do such sweep, too?

Checking the use of purge, purgeall and expire, I agree with @pouria that those should be uint; their use is benign as they really only interface with userland / sysctl, and negative values for them are illogical. Validation handling for negatives is then handled by sysctl_handler_int already too.

Fix other sim

This revision was not accepted when it landed; it landed in state Needs Review.Tue, Jul 28, 9:21 PM
This revision was automatically updated to reflect the committed changes.