Hi,

On Fri, Feb 17, 2012 at 10:58:16PM +0100, Gert Doering wrote:
> [ on ir->netbits and ir6->netbits, signed int vs. unsigned int ]
> 
> Thanks for reporting this.  I'll look into it.

I've dug a bit further into the code, and the IPv4 and IPv6 code differ
here - IPv4 flags "a host iroute" with ir->netbits = -1, while for IPv6,
a "host iroute" is just a /128.

The difference shows up in 

 - options.c, option_iroute() vs. option_iroute_ipv6()
 - push.c in checking "if < 0 then make it a /32":

    if (network == ir->network && netmask == netbits_to_netmask (ir->netbits >= 
0 ? ir->netbits : 32))

 - multi.c, in pretty-printing host routes "without the /32":

          if (ir->netbits >= 0)
            msg (D_MULTI_LOW, "MULTI: internal route %s/%d -> %s",
...
          else
            msg (D_MULTI_LOW, "MULTI: internal route %s -> %s",

   (which I blindly copied for IPv6, not noticing that ir6->netbits cannot
    be negative anyway)

 - mroute.c, in the mroute_helper_{add,del}_iroute[6]() helpers that you've
   found


Now I'm wondering which way forward is cleaner - make ip->netbits an 
"unsigned" as well, changing all the places where "<0 == host route" to 
be "/32 = host" (mostly prettyprinting I think, but need to understand
the mroute stuff better), or live with artificial IPv4/IPv6 asymmetry 
here...

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: pgpVDlUwsdlTN.pgp
Description: PGP signature

Reply via email to