tcp: Ensure that vnets have an initialized V_default_cc_ptr

This causes new vnets to inherit the cc algorithm from vnet0. This is a
temporary patch to fix vnet jail creation.

With encouragement from: glebius
Fixes: b8d60729de ("tcp: Congestion control cleanup.")
Differential Revision: https://reviews.freebsd.org/D32970
This commit is contained in:
Mark Johnston 2021-11-12 11:44:12 -07:00 committed by Warner Losh
parent 7e3c9ec906
commit 034a924009

View file

@ -316,6 +316,23 @@ cc_register_algo(struct cc_algo *add_cc)
return (err);
}
static void
vnet_cc_sysinit(void *arg)
{
struct cc_algo *cc;
if (IS_DEFAULT_VNET(curvnet))
return;
CURVNET_SET(vnet0);
cc = V_default_cc_ptr;
CURVNET_RESTORE();
V_default_cc_ptr = cc;
}
VNET_SYSINIT(vnet_cc_sysinit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
vnet_cc_sysinit, NULL);
/*
* Perform any necessary tasks before we exit congestion recovery.
*/