Index: sys/netinet/tcp_hostcache.c =================================================================== --- sys/netinet/tcp_hostcache.c +++ sys/netinet/tcp_hostcache.c @@ -124,6 +124,10 @@ static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hostcache, CTLFLAG_RW, 0, "TCP Host cache"); +SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, enable, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_use_hostcache), 0, + "Enable the TCP hostcache"); + SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, cachelimit, CTLFLAG_VNET | CTLFLAG_RDTUN, &VNET_NAME(tcp_hostcache.cache_limit), 0, "Overall entry limit for hostcache"); @@ -272,6 +276,9 @@ static struct hc_metrics * tcp_hc_lookup(struct in_conninfo *inc) { + if (!V_tcp_use_hostcache) + return NULL; + int hash; struct hc_head *hc_head; struct hc_metrics *hc_entry; @@ -328,6 +335,9 @@ static struct hc_metrics * tcp_hc_insert(struct in_conninfo *inc) { + if (!V_tcp_use_hostcache) + return NULL; + int hash; struct hc_head *hc_head; struct hc_metrics *hc_entry; @@ -419,6 +429,9 @@ void tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) { + if (!V_tcp_use_hostcache) + return; + struct hc_metrics *hc_entry; /* @@ -458,6 +471,9 @@ u_long tcp_hc_getmtu(struct in_conninfo *inc) { + if (!V_tcp_use_hostcache) + return 0; + struct hc_metrics *hc_entry; u_long mtu; @@ -480,6 +496,9 @@ void tcp_hc_updatemtu(struct in_conninfo *inc, u_long mtu) { + if (!V_tcp_use_hostcache) + return; + struct hc_metrics *hc_entry; /* @@ -519,6 +538,9 @@ void tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) { + if (!V_tcp_use_hostcache) + return; + struct hc_metrics *hc_entry; hc_entry = tcp_hc_lookup(inc);