I have found evidence that the wide-dhcpv6 version in Ubuntu 14.04 at least was 
written on a 32-bit architecture and never properly redesigned for a 64-bit 
compilation.  The evidence for this found in the source code goes as follows:
1. Consistent use of the printf formatter %ul for 32-bit int fields.  On a 
32-bit architecture this is fine, but on a 64-bit compile with gcc unsigned 
long (ul) is 64-bits.  This explains why the debug print statement grabs extra 
bytes.  It also hints at another problem in that while the printf code is 
consistently wrong for a 64-bit compile, only the PD specific vltime picks up 
extra non-zero bytes beyond the 32-bit boundary.  As best as I can tell this is 
due to compiler specific circumstance.

2. As above is a display issue with debugging messages, if you consider
there are problems consistent with 32-bit only testing, it seems logical
to assume somewhere those extra bytes beyond the 32-bit vltime gets
assigned to the timer in an unsafe manner.  I think I may have found
this in that in prefixconf.c there is an assignment of vltime to tv_sec,
which on a 64-bit compile would be assigning a 32-bit unsigned int to a
64-bit integer without a cast.  As I normally due a cast for such
conversions, I am suspecting without a cast the random bytes beyond the
32-bit boundary are getting sucked in on this particular assignment.
For the NA specific vltime value the bytes just happen to be all zero,
so no noticed issue, but as the incorrectly implemented printf statement
shows, the bytes beyond the 32-bit boundary for the PD specific vltime
are not zero and so a tv_sec value for the refresh timer gets set to
something ridiculously high.  The logs show that the NA specific address
gets refreshed at the prescribed time while the PD specific address
range does not, so everything matches up for this hypothesis.

Now I just need to make some changes and test it all out...

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1559741

Title:
  wide-dhcpv6 client apparently sets incorrect PD specfic vltime

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wide-dhcpv6/+bug/1559741/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to