svn commit: r211890 - stable/7/sys/netinet

John Baldwin jhb at FreeBSD.org
Fri Aug 27 18:50:33 UTC 2010


Author: jhb
Date: Fri Aug 27 18:50:32 2010
New Revision: 211890
URL: http://svn.freebsd.org/changeset/base/211890

Log:
  MFC 211433:
  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).

Modified:
  stable/7/sys/netinet/ip_divert.c
  stable/7/sys/netinet/raw_ip.c
  stable/7/sys/netinet/tcp_subr.c
  stable/7/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/netinet/ip_divert.c
==============================================================================
--- stable/7/sys/netinet/ip_divert.c	Fri Aug 27 18:50:12 2010	(r211889)
+++ stable/7/sys/netinet/ip_divert.c	Fri Aug 27 18:50:32 2010	(r211890)
@@ -579,8 +579,8 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = divcbinfo.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;
 	}
 

Modified: stable/7/sys/netinet/raw_ip.c
==============================================================================
--- stable/7/sys/netinet/raw_ip.c	Fri Aug 27 18:50:12 2010	(r211889)
+++ stable/7/sys/netinet/raw_ip.c	Fri Aug 27 18:50:32 2010	(r211890)
@@ -894,8 +894,8 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = 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);
 	}
 

Modified: stable/7/sys/netinet/tcp_subr.c
==============================================================================
--- stable/7/sys/netinet/tcp_subr.c	Fri Aug 27 18:50:12 2010	(r211889)
+++ stable/7/sys/netinet/tcp_subr.c	Fri Aug 27 18:50:32 2010	(r211890)
@@ -939,8 +939,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 	if (req->oldptr == NULL) {
 		m = syncache_pcbcount();
 		n = tcbinfo.ipi_count;
-		req->oldidx = 2 * (sizeof xig)
-			+ ((m + n) + n/8) * sizeof(struct xtcpcb);
+		n += imax(n / 8, 10);
+		req->oldidx = 2 * (sizeof xig) +
+		    (m + n) * sizeof(struct xtcpcb);
 		return (0);
 	}
 

Modified: stable/7/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/7/sys/netinet/udp_usrreq.c	Fri Aug 27 18:50:12 2010	(r211889)
+++ stable/7/sys/netinet/udp_usrreq.c	Fri Aug 27 18:50:32 2010	(r211890)
@@ -684,8 +684,8 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = udbinfo.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);
 	}
 


More information about the svn-src-stable-7 mailing list