Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3915 - Expiration time for leases populated incorrectly in dhcp.leases #8913

Open
openwrt-bot opened this issue Jul 5, 2021 · 4 comments
Open
Labels
flyspray release/21.02

Comments

@openwrt-bot
Copy link

@openwrt-bot openwrt-bot commented Jul 5, 2021

overnight_spaghetti:

I'm running 21.02 on a FriendlyArm R4S. Noticed that all dhcp leases in Luci show as expired. Checking dhcp.leases, it shows:

43200 dc:xx:xx:xx:xx:xx 192.168.1.52 octopi *

According to dnsmasq, the first column should be the timestamp of when the lease is expiring (so either 'now + leasetime' or 'uptime + leasetime'). In this case, it is just '0 + leasetime'.

Not sure if this is an issue with dnsmasq or openwrt itself. Happy to add more info if needed!

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jul 6, 2021

overnight_spaghetti:

This turns out to be an effect of HAVE_BROKEN_RTC flag in dnsmasq. However, ubus still returns expiration time of 0 for all IPv4 leases -> listing as expired in Luci

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jul 7, 2021

jow-:

Did you build yourself? The HAVE_BROKEN_RTC build option should be disabled by default in official builds. LuCI currently expects UNIX timestamps in the expiration time column and not relative remaining validity times.

I am considering adding some heuristics to workaround the problem. Basically if the expire value is smaller than a specific cutoff date (say 2020-01-01, 1577833200) then treat it as relative, else as absolute expiration value, then act accordingly.

However it is low priority since the broken RTC flag is not a default configuration. If you want to give it a stab yourself, then the relevant code would be here: https://github.com/openwrt/luci/blob/master/libs/rpcd-mod-luci/src/luci.c#L534

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jul 7, 2021

overnight_spaghetti:

You are indeed correct, it's homemade and the flag is set. I'll build it again without and see if that helps (which I now expect :) )

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jul 7, 2021

overnight_spaghetti:

Setting

CONFIG_PACKAGE_dnsmasq_full_broken_rtc=n

fixed it.

Handling the other mode seems quite difficult, as the first column will only statically show the lease time. I am actually not sure if there is a way to calculate the remaining time, unless it is possible to find out when the lease was handed out and calculate from there.

@aparcar aparcar added the release/21.02 label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray release/21.02
Projects
None yet
Development

No branches or pull requests

2 participants