snmp_mibII: use sysctl(3) to read min/max TCP retransmission timeouts
Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D50892
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include <netinet/in_pcb.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_var.h>
|
||||
#include <netinet/tcp_timer.h>
|
||||
#include <netinet/tcp_fsm.h>
|
||||
|
||||
struct tcp_index {
|
||||
@@ -51,7 +50,8 @@ static uint64_t tcps_states[TCP_NSTATES];
|
||||
static struct xinpgen *xinpgen;
|
||||
static size_t xinpgen_len;
|
||||
static u_int tcp_total;
|
||||
|
||||
static int tcp_rexmit_min;
|
||||
static int tcp_rexmit_max;
|
||||
static u_int oidnum;
|
||||
static struct tcp_index *tcpoids;
|
||||
|
||||
@@ -90,6 +90,28 @@ fetch_tcp_stats(void)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
len = sizeof(tcp_rexmit_min);
|
||||
if (sysctlbyname("net.inet.tcp.rexmit_min", &tcp_rexmit_min, &len,
|
||||
NULL, 0) == -1) {
|
||||
syslog(LOG_ERR, "net.inet.tcp.rexmit_min: %m");
|
||||
return (-1);
|
||||
}
|
||||
if (len != sizeof(tcp_rexmit_min)) {
|
||||
syslog(LOG_ERR, "net.inet.tcp.rexmit_min: wrong size");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
len = sizeof(tcp_rexmit_max);
|
||||
if (sysctlbyname("net.inet.tcp.rexmit_max", &tcp_rexmit_max, &len,
|
||||
NULL, 0) == -1) {
|
||||
syslog(LOG_ERR, "net.inet.tcp.rexmit_max: %m");
|
||||
return (-1);
|
||||
}
|
||||
if (len != sizeof(tcp_rexmit_max)) {
|
||||
syslog(LOG_ERR, "net.inet.tcp.rexmit_max: wrong size");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
tcp_stats_tick = get_ticks();
|
||||
|
||||
return (0);
|
||||
@@ -211,16 +233,13 @@ op_tcp(struct snmp_context *ctx __unused, struct snmp_value *value,
|
||||
value->v.integer = 4; /* Van Jacobson */
|
||||
break;
|
||||
|
||||
#define hz clockinfo.hz
|
||||
|
||||
case LEAF_tcpRtoMin:
|
||||
value->v.integer = 1000 * TCPTV_MIN / hz;
|
||||
value->v.integer = tcp_rexmit_min;
|
||||
break;
|
||||
|
||||
case LEAF_tcpRtoMax:
|
||||
value->v.integer = 1000 * TCPTV_REXMTMAX / hz;
|
||||
value->v.integer = tcp_rexmit_max;
|
||||
break;
|
||||
#undef hz
|
||||
|
||||
case LEAF_tcpMaxConn:
|
||||
value->v.integer = -1;
|
||||
|
||||
Reference in New Issue
Block a user