From owner-freebsd-stable@FreeBSD.ORG Mon Nov 25 15:03:05 2013 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AB1D428; Mon, 25 Nov 2013 15:03:05 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5ED1A2FF7; Mon, 25 Nov 2013 15:03:05 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Vkxgm-000NtG-Fv; Mon, 25 Nov 2013 15:03:04 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id rAPF2w68004656; Mon, 25 Nov 2013 08:02:58 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX187EZWJOYy3dfW2L8BSCaSJ Subject: Re: ipfw table add problem From: Ian Lepore To: Ian Smith In-Reply-To: <20131125152238.S78756@sola.nimnet.asn.au> References: <52911993.8010108@ipfw.ru> <529259DE.2040701@FreeBSD.org> <20131125152238.S78756@sola.nimnet.asn.au> Content-Type: text/plain; charset="ISO-8859-1" Date: Mon, 25 Nov 2013 08:02:58 -0700 Message-ID: <1385391778.1220.4.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by damnhippie.dyndns.org id rAPF2w68004656 Cc: freebsd-ipfw , "Alexander V. Chernikov" , Luigi Rizzo , freebsd-stable , =?ISO-8859-1?Q?=D6zkan?= KIRIK X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Nov 2013 15:03:05 -0000 On Mon, 2013-11-25 at 15:30 +1100, Ian Smith wrote: > On Sun, 24 Nov 2013 23:56:14 +0400, Alexander V. Chernikov wrote: > > On 24.11.2013 19:43, =D6zkan KIRIK wrote: > > > Hi, > > >=20 > > > I tested patch. This patch solves, ipfw table 1 add 4899 > > Ok. So I'll commit this fix soon. > > >=20 > > > But, ipfw table 1 add 10.2.3.01 works incorrectly. > > > output is below. > > > # ./ipfw table 1 flush > > > # ./ipfw table 1 add 10.2.3.01 > > inet_pton() does not recognize this as valid IPv4 address, so it is > > treated as usigned unteger key. It looks like this behavior is menti= oned > > in STANDARDS section. > > > # ./ipfw table 1 list > > > 0.0.0.10/32 0 >=20 > I'm wondering if "so don't do that" is really sufficient to deal with=20 > this? If it's not recognised as a valid address, shouldn't it fail to=20 > add anything, with a complaint? I don't see how a string containing=20 > dots can be seen as a valid unsigned integer? It's still not clear to me that inet_pton() is doing the right thing. Per the rfc cited earlier in the thread, it's not supposed to interpret the digits as octal or hex -- they are specifically declared to be decimal numbers. There's nothing invalid about "01" as a decimal number. The fact that many of us have a C-programming background and tend to think of leading-zero as implying octal doesn't change that. -- Ian