Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2013 08:02:58 -0700
From:      Ian Lepore <ian@FreeBSD.org>
To:        Ian Smith <smithi@nimnet.asn.au>
Cc:        freebsd-ipfw <freebsd-ipfw@FreeBSD.org>, "Alexander V. Chernikov" <melifaro@FreeBSD.org>, Luigi Rizzo <rizzo@iet.unipi.it>, freebsd-stable <freebsd-stable@FreeBSD.org>, =?ISO-8859-1?Q?=D6zkan?= KIRIK <ozkan.kirik@gmail.com>
Subject:   Re: ipfw table add problem
Message-ID:  <1385391778.1220.4.camel@revolution.hippie.lan>
In-Reply-To: <20131125152238.S78756@sola.nimnet.asn.au>
References:  <CAAcX-AGDZbFn5RmhLBBn2PPWRPcsFUnea5MgTc7nuXGD8Ge53A@mail.gmail.com> <52911993.8010108@ipfw.ru> <CAAcX-AEt_i8RUfmMy6WLnER0X=uLk5A1=oj911k-nyMJEghRLw@mail.gmail.com> <529259DE.2040701@FreeBSD.org>  <20131125152238.S78756@sola.nimnet.asn.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1385391778.1220.4.camel>