[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48F514AD.3010109@trash.net>
Date: Tue, 14 Oct 2008 23:52:45 +0200
From: Patrick McHardy <kaber@...sh.net>
To: Stephen Hemminger <shemminger@...tta.com>
CC: Herbert Xu <herbert@...dor.apana.org.au>,
Krzysztof Oledzki <ole@....pl>, netdev@...r.kernel.org
Subject: Re: Error: an inet prefix is expected rather than "0/0".
Stephen Hemminger wrote:
> There is no easy solution, I'll will have to go back rewrite this
> code, and will document the result. I expect the result will displease
> someone, but given the original code that is just going to happen.
>
> Busted cases:
> correct incorrect
> Original code: 127.2 => 127.0.0.2 127.2.0.0
> inet_pton: 10.0 => 10.0.0.0 fails invalid
> inet_aton: 10 => 10.0.0.0 0.0.0.10
>
> The problem was Alexey (or Jamal) invented their own abbreviation format
> and did not follow unix standard conventions.
We fixed the same problem in iptables a few years ago, maybe you could
reuse some of that code. Some quick testing shows that it parses all
addresses according to your table:
# iptables -I OUTPUT -d 127.2
# iptables -I OUTPUT -d 10.0
# iptables -I OUTPUT -d 10
# iptables -vxnL OUTPUT
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination
0 0 all -- * * 0.0.0.0/0
10.0.0.0
0 0 all -- * * 0.0.0.0/0
10.0.0.0
0 0 all -- * * 0.0.0.0/0
127.2.0.0
You can find the code in "xtables.c", function numeric_to_ipaddr().
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists