Bugzilla – Bug 794
Ipv4Mask constructor for "/yy"-notation is wrong
Last modified: 2010-02-05 13:04:08 UTC
In src/node/ipv4-address.cc, line 71 and onwards, The constructor should be: Ipv4Mask::Ipv4Mask (char const *mask) { if (*mask == ASCII_SLASH) { uint32_t plen = static_cast<uint32_t> (atoi (++mask)); NS_ASSERT (plen <= 32); m_mask = 0xffffffff >> (32-plen); } else { m_mask = AsciiToIpv4Host (mask); } } Right now it just places the prefix length, as is, to m_mask, ending up with some rather weird results.
Whoops, obviously the bit-shift should be to other direction, so m_mask = 0xffffffff << (32-plen); is correct.
Created attachment 733 [details] patch to fix IMO, this is ready to commit. Tested (does not change any existing test output). I made a slight adjustment to what was previously posted for the boundary condition of "/0".
+1 on readiness. This is a P5 bug, so theoretically we should not commit until release unless the priority is bumped.
(In reply to comment #3) > +1 on readiness. > > This is a P5 bug, so theoretically we should not commit until release unless > the priority is bumped. Craig, can you push this one?
changeset 8dcb272f3c00