snmp_mibII: use net.inet.ip.fragttl sysctl for ipReasmTimeout

Using IPFRAGTTL define was never correct, as it was measured in
PR_SLOWTIMO intervals.  The sysctl returns seconds, just what
ipReasmTimeout is.
This commit is contained in:
Gleb Smirnoff 2022-08-21 07:44:58 -07:00
parent 6498153665
commit 9d54812421

View File

@ -44,6 +44,7 @@ static struct icmpstat icmpstat;
static int ip_forwarding; static int ip_forwarding;
static int ip_defttl; static int ip_defttl;
static u_int ip_fragttl;
static uint64_t ip_tick; static uint64_t ip_tick;
static uint64_t ipstat_tick; static uint64_t ipstat_tick;
@ -79,6 +80,17 @@ fetch_ipstat(void)
return (-1); return (-1);
} }
len = sizeof(ip_fragttl);
if (sysctlbyname("net.inet.ip.fragttl", &ip_fragttl, &len,
NULL, 0) == -1) {
syslog(LOG_ERR, "net.inet.ip.fragttl: %m");
return (-1);
}
if (len != sizeof(ip_fragttl)) {
syslog(LOG_ERR, "net.inet.ip.fragttl: wrong size");
return (-1);
}
ipstat_tick = get_ticks(); ipstat_tick = get_ticks();
return (0); return (0);
} }
@ -309,7 +321,7 @@ op_ipstat(struct snmp_context *ctx __unused, struct snmp_value *value,
break; break;
case LEAF_ipReasmTimeout: case LEAF_ipReasmTimeout:
value->v.integer = IPFRAGTTL; value->v.integer = ip_fragttl;
break; break;
case LEAF_ipReasmReqds: case LEAF_ipReasmReqds: