While investigating PR296474 it was found that some parameters
picked up from the hostcache are essential to reproduce the behavior
of the TCP stack.
No facilities existed to load and manipulate the hostcache entries
before, making it difficult to populate and prepare the initial
state exactly alike to the problematic scenario.
This refactories the update function which walks the hostcache or
finds the most pertinent entry to overwrite with support for a callback
function. The old update function is then a wrapper with the middle
section put in a dedicated function, where the values derived from the
stack get inserted into the host cache.
Secondly, a custom sysctl interface with a simple parser is provided
to allow the explicit modification of enties and subsets of values.
Usage:
sysctl net.inet.tcp.hostcache.update=::1,1460,,10,500,60000,20000,10000,1000
The order is the same as with net.inet.tcp.hostcache.list. The initial IPv4
or IPv6 address is mandatory. Subsequent values can be skipped (,,), set to
a specific number (RTT and RTTvar operate at ms granularity, not the internal
representation), or increase/descrease with signed numbers like +100 or -200.