From d8e2e27165e72af01c626085249abf380be4ca9c Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 17 Aug 2010 16:41:16 +0000 Subject: Ensure a minimum "slop" of 10 extra pcb structures when providing a memory size estimate to userland for pcb list sysctls. The previous behavior of a "slop" of n/8 does not work well for small values of n (e.g. no slop at all if you have less than 8 open UDP connections). Reviewed by: bz MFC after: 1 week --- sys/netinet/raw_ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/netinet/raw_ip.c') diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 0b77b5b..d6b426c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -993,8 +993,8 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) */ if (req->oldptr == 0) { n = V_ripcbinfo.ipi_count; - req->oldidx = 2 * (sizeof xig) - + (n + n/8) * sizeof(struct xinpcb); + n += imax(n / 8, 10); + req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb); return (0); } -- cgit v1.1