From owner-freebsd-net@FreeBSD.ORG Sat May 24 16:19:19 2014 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7F822A5; Sat, 24 May 2014 16:19:19 +0000 (UTC) Received: from mail-pb0-x233.google.com (mail-pb0-x233.google.com [IPv6:2607:f8b0:400e:c01::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B208727FA; Sat, 24 May 2014 16:19:19 +0000 (UTC) Received: by mail-pb0-f51.google.com with SMTP id ma3so5626946pbc.10 for ; Sat, 24 May 2014 09:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :thread-index:content-language; bh=kufZk8ihhzFTR05hSHTM6nfNdMjkkw0C6oxWA/fU4FA=; b=U7y1rxPi//x/WrJghgGNDpIh7ZT7ub3cXkm4tDG59XqVuA0oR/0NVETSM9DIzG0idk Nj6tz7etSitDVrsdzCyvLryvu8H2eTIuUzFOlqQ3w1LWjhJxasnBapLwKsBAkntSoYtj mzmP3YyFI5hCy21iqt3XkDNlTWYOe6gaHs6caVYCo3jQbXSCUZyg+xPXyI3MsgXxgRxv TbYlooyRihUZduhdMZ/yD1hMHFJDFeedxvn0n9FGRmgjLoAazsc//EITxFD123AYIjp6 +DUrn9m2OQSCBKyGhooqd351BCJBW6cSU4+LGJbjWGnyTlPGtFwM/8TRKzovMK9djkf8 sg5w== X-Received: by 10.69.19.139 with SMTP id gu11mr15025473pbd.36.1400948359292; Sat, 24 May 2014 09:19:19 -0700 (PDT) Received: from billwin7 (amx-tls2.starhub.net.sg. [203.116.164.12]) by mx.google.com with ESMTPSA id pq3sm10031019pbb.57.2014.05.24.09.19.15 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 May 2014 09:19:18 -0700 (PDT) From: "bycn82" To: "Alexander V. Chernikov" , "Luigi Rizzo" Subject: a defect in ipfw dummynet Date: Sun, 25 May 2014 00:19:15 +0800 Message-ID: <000f01cf776b$ea602810$bf207830$@gmail.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac93a95BPtMHR/tZQky39x87iu6lXA== Content-Language: en-us Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 May 2014 16:19:20 -0000 Hi Alexander, =20 Since you guys are working on the =E2=80=9Cnamed table=E2=80=9D feature. = So I have stopped implementing it using my way. Hence I got some time to = read more about the existing codes. This afternoon I just started to = read the dummynet part, then I have another question to ask. Maybe it is = not a small defect, Or just because there are some more story which I = don=E2=80=99t know. anyway. =20 For example, when we run command as below,=20 >ipfw pipe config 1 100kbps the userspace program need to read the bandwidth value which is = =E2=80=9C100kbps=E2=80=9D, And I found the code as below,=20 if ((*end =3D=3D 'B' && _substrcmp2(end, "Bi", "Bit/s") !=3D 0) = || _substrcmp2(end, "by", "bytes") =3D=3D = 0) bw *=3D 8; =20 Sure it works. But I want to ask whether it can be more readable If we = list down all the possibilities and directly =E2=80=9Chard code=E2=80=9D = in the source, At least it can be more accurate.=20 =20 With current logic, we have change to have below situation. =20 root@FB10Head:~ # ipfw pipe config 1 bw 1ByeBye <- = the command will be considered as =E2=80=9C1 Byte per second=E2=80=9D root@FB10Head:~ # ipfw pipe 1 show 00001: 8.000 bit/s 0 ms burst 0=20 q131073 50 sl. 0 flows (1 buckets) sched 65537 weight 0 lmax 0 pri 0 = droptail sched 65537 type FIFO flags 0x0 0 buckets 0 active root@FB10Head:~ # =20 =20 =20 =20 =20 Best Regards, Bycn82 =20