Odhcpd lifetime bug?

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.

2 Likes

Can the https://github.com/openwrt/odhcpd repo get some love too?

yawn here we are, months later. Still nothing happened.

1 Like

Is there any update on this issue ? can you fire an issue over https://github.com/openwrt/odhcpd

@systemcrash

1 Like

I sent the patches via the dev mailing list and they eventually got merged.

I have a second set of patches which fixes a few other minor issues and they went to the dev list a while ago. No comments...

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.