From owner-freebsd-questions@FreeBSD.ORG Wed Nov 26 06:12:45 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E57C016A4CE for ; Wed, 26 Nov 2003 06:12:45 -0800 (PST) Received: from web15306.mail.bjs.yahoo.com (web15306.mail.cnb.yahoo.com [202.3.77.181]) by mx1.FreeBSD.org (Postfix) with SMTP id 2E82E43FEA for ; Wed, 26 Nov 2003 06:12:44 -0800 (PST) (envelope-from lxp_welcome@yahoo.com.cn) Message-ID: <20031126141242.298.qmail@web15306.mail.bjs.yahoo.com> Received: from [158.132.12.73] by web15306.mail.bjs.yahoo.com via HTTP; Wed, 26 Nov 2003 22:12:42 CST Date: Wed, 26 Nov 2003 22:12:42 +0800 (CST) From: =?gb2312?q?villy=20Luo?= To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit Subject: problem on dummynet, please help me X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2003 14:12:46 -0000 After reading the ip_dummynet.c, I found that dummynet uses link list to store packets as the following code: if (q->head == NULL) q->head = pkt; else DN_NEXT(q->tail) = pkt; q->tail = pkt; q->len++; q->len_bytes += len ; However, when I tried to use the following function to get the length of the queue, I get the different value to the q->len and the return is always 1. static int getQueueLen(struct dn_flow_queue *q){ struct dn_pkt * pFirst; int i; pFirst = q->head; for(i = 1 ; (pFirst != NULL); i ++){ pFirst = DN_NEXT(pFirst); } return i; } I donot know why this happens. Please help me slove this problem. Million thanks. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com