Grab a snap amount of TCP connections in syncache from tcpstat.
This commit is contained in:
parent
57a78e3bae
commit
75dd79d937
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294870
@ -1590,7 +1590,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
* resource-intensive to repeat twice on every request.
|
||||
*/
|
||||
if (req->oldptr == NULL) {
|
||||
n = V_tcbinfo.ipi_count + syncache_pcbcount();
|
||||
n = V_tcbinfo.ipi_count +
|
||||
TCPSTAT_FETCH(tcps_states[TCPS_SYN_RECEIVED]);
|
||||
n += imax(n / 8, 10);
|
||||
req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb);
|
||||
return (0);
|
||||
@ -1607,7 +1608,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
n = V_tcbinfo.ipi_count;
|
||||
INP_LIST_RUNLOCK(&V_tcbinfo);
|
||||
|
||||
m = syncache_pcbcount();
|
||||
m = TCPSTAT_FETCH(tcps_states[TCPS_SYN_RECEIVED]);
|
||||
|
||||
error = sysctl_wire_old_buffer(req, 2 * (sizeof xig)
|
||||
+ (n + m) * sizeof(struct xtcpcb));
|
||||
|
@ -2099,25 +2099,6 @@ syncookie_reseed(void *arg)
|
||||
callout_schedule(&sc->secret.reseed, SYNCOOKIE_LIFETIME * hz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the current number of syncache entries. This number
|
||||
* will probably change before you get around to calling
|
||||
* syncache_pcblist.
|
||||
*/
|
||||
int
|
||||
syncache_pcbcount(void)
|
||||
{
|
||||
struct syncache_head *sch;
|
||||
int count, i;
|
||||
|
||||
for (count = 0, i = 0; i < V_tcp_syncache.hashsize; i++) {
|
||||
/* No need to lock for a read. */
|
||||
sch = &V_tcp_syncache.hashbase[i];
|
||||
count += sch->sch_length;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exports the syncache entries to userland so that netstat can display
|
||||
* them alongside the other sockets. This function is intended to be
|
||||
|
@ -46,7 +46,6 @@ int syncache_add(struct in_conninfo *, struct tcpopt *,
|
||||
void *, void *);
|
||||
void syncache_chkrst(struct in_conninfo *, struct tcphdr *);
|
||||
void syncache_badack(struct in_conninfo *);
|
||||
int syncache_pcbcount(void);
|
||||
int syncache_pcblist(struct sysctl_req *req, int max_pcbs, int *pcbs_exported);
|
||||
|
||||
struct syncache {
|
||||
|
Loading…
Reference in New Issue
Block a user