From owner-svn-src-all@FreeBSD.ORG Mon Mar 15 18:09:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E63FF106566B; Mon, 15 Mar 2010 18:09:21 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D51258FC20; Mon, 15 Mar 2010 18:09:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FI9LPw036835; Mon, 15 Mar 2010 18:09:21 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FI9LhA036833; Mon, 15 Mar 2010 18:09:21 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201003151809.o2FI9LhA036833@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 15 Mar 2010 18:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205178 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 18:09:22 -0000 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;