Attention @PolynomialDivision @dedeckeh regarding this commit.
I reviewed the odhcpd source to locate a problem I've been chasing in relation to this thread.
If a user supplies preferred_lifetime
alone, it is summarily ignored. If a user also sets ra_useleasetime
to true, both the valid and preferred values are then 'correctly' inherited according to the wiki description of functionality.
It seems that if a user supplies preferred_lifetime
alone, it should be inherited (is this wrong or problematic somehow with regard to the RFCs?), regardless of whether the user set ra_useleasetime
to true. In other words, preferred_lifetime
should not also depend on ra_useleasetime
.
Functionality today is so:
if (addr->preferred_lt > (uint32_t)now) {
preferred_lt = TIME_LEFT(addr->preferred_lt, now);
if (iface->ra_useleasetime &&
preferred_lt > iface->preferred_lifetime)
preferred_lt = iface->preferred_lifetime;
}
...
I think this needs to be something like:
if (addr->preferred_lt > (uint32_t)now) {
preferred_lt = TIME_LEFT(addr->preferred_lt, now);
if (preferred_lt > iface->preferred_lifetime) {
// set to possibly user mandated preferred_lt
preferred_lt = iface->preferred_lifetime;
}
}
...
I've tested the above change and it works as expected.