Subject: Re: Error: an inet prefix is expected rather than "0/0".

From: Patrick McHardy <[email-masked]>
Date: Tue, 14 Oct 2008 23:54:37 +0200

Patrick McHardy wrote:
> 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

OK, the last one is wrong. I thought we fixed that :)