Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_hostcache.c
Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Lines | |||||
* unsorted order. | * unsorted order. | ||||
*/ | */ | ||||
static int | static int | ||||
sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) | sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
const int linesize = 128; | const int linesize = 128; | ||||
struct sbuf sb; | struct sbuf sb; | ||||
int i, error, len; | int i, error, len; | ||||
bool do_drain = false; | |||||
struct hc_metrics *hc_entry; | struct hc_metrics *hc_entry; | ||||
char ip4buf[INET_ADDRSTRLEN]; | char ip4buf[INET_ADDRSTRLEN]; | ||||
#ifdef INET6 | #ifdef INET6 | ||||
char ip6buf[INET6_ADDRSTRLEN]; | char ip6buf[INET6_ADDRSTRLEN]; | ||||
#endif | #endif | ||||
if (jailed_without_vnet(curthread->td_ucred) != 0) | if (jailed_without_vnet(curthread->td_ucred) != 0) | ||||
return (EPERM); | return (EPERM); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | #endif | ||||
msec((u_long)hc_entry->rmx_rttvar * | msec((u_long)hc_entry->rmx_rttvar * | ||||
(RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE))), | (RTM_RTTUNIT / (hz * TCP_RTTVAR_SCALE))), | ||||
hc_entry->rmx_cwnd, | hc_entry->rmx_cwnd, | ||||
hc_entry->rmx_sendpipe, | hc_entry->rmx_sendpipe, | ||||
hc_entry->rmx_recvpipe, | hc_entry->rmx_recvpipe, | ||||
hc_entry->rmx_hits, | hc_entry->rmx_hits, | ||||
hc_entry->rmx_updates, | hc_entry->rmx_updates, | ||||
hc_entry->rmx_expire); | hc_entry->rmx_expire); | ||||
do_drain = true; | |||||
} | } | ||||
THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); | THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); | ||||
/* Need to track if sbuf has data, to avoid | /* Need to track if sbuf has data, to avoid | ||||
* a KASSERT when calling sbuf_drain. | * a KASSERT when calling sbuf_drain. | ||||
*/ | */ | ||||
if (do_drain) { | |||||
sbuf_drain(&sb); | sbuf_drain(&sb); | ||||
do_drain = false; | |||||
} | |||||
} | } | ||||
#undef msec | #undef msec | ||||
error = sbuf_finish(&sb); | error = sbuf_finish(&sb); | ||||
sbuf_delete(&sb); | sbuf_delete(&sb); | ||||
return(error); | return(error); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |