svn commit: r205178 - head/sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Mon Mar 15 18:09:22 UTC 2010


Author: luigi
Date: Mon Mar 15 18:09:21 2010
New Revision: 205178
URL: http://svn.freebsd.org/changeset/base/205178

Log:
  small fixes to estimate the buffer size when requesting all pipes/flows.

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dummynet.c	Mon Mar 15 17:55:46 2010	(r205177)
+++ head/sys/netinet/ipfw/ip_dummynet.c	Mon Mar 15 18:09:21 2010	(r205178)
@@ -814,15 +814,15 @@ copy_obj(char **start, char *end, void *
 }
 
 /* Specific function to copy a queue.
- * It copies only the common part of a queue, and correctly set
- * the length
+ * Copies only the user-visible part of a queue (which is in
+ * a struct dn_flow), and sets len accordingly.
  */
 static int
 copy_obj_q(char **start, char *end, void *_o, const char *msg, int i)
 {
 	struct dn_id *o = _o;
 	int have = end - *start;
-	int len = sizeof(struct dn_queue);
+	int len = sizeof(struct dn_flow); /* see above comment */
 
 	if (have < len || o->len == 0 || o->type != DN_QUEUE) {
 		D("ERROR type %d %s %d have %d need %d",
@@ -1783,9 +1783,13 @@ compute_space(struct dn_id *cmd, struct 
 	if (x & DN_C_LINK) {
 		need += dn_cfg.schk_count * sizeof(struct dn_link) / 2;
 	}
-	/* XXX queue space might be variable */
+	/*
+	 * When exporting a queue to userland, only pass up the
+	 * struct dn_flow, which is the only visible part.
+	 */
+
 	if (x & DN_C_QUEUE)
-		need += dn_cfg.queue_count * sizeof(struct dn_queue);
+		need += dn_cfg.queue_count * sizeof(struct dn_flow);
 	if (x & DN_C_FLOW)
 		need += dn_cfg.si_count * (sizeof(struct dn_flow));
 	return need;


More information about the svn-src-head mailing list