Dhcp_host_domain_ng.py: Add_lease, hostname check failed

I don’t think getting the hostname.lan A records into DNS was ever a problem (in the past few years) for devices that ask for a reasonable hostname. So I’d check what names are attempted. (even underscores aren’t allowed if we look at the standards, as I understand it, but I they should work now)

The annoyance I’ve got is excessive Add_lease, hostname check failed messages for devices that have no hostname. For every dd.update_dhcp(sys_op, hostname, ipv4) call from main, it prints the hostname check failed message for every device with no hostname.

This seems to be caused by DHCPv4._load_hints() (being called from DHCPv4.__init__()) reading the leases file and calling _add_lease(hostname, ipv4) for every line. It looks like this is required as sometimes the script is called to refresh all the leases from the file, but surely it shouldn’t be adding all the leases from the file every time it is called to just add/update one?

I’ve resolved the excess logging by adding a check in _load_hints():

if hostname != "*":
    self._add_lease(hostname, ipv4)

It does seem like a bug though to update all the leases from the file when the script is called to update one from the env.

1 Like

Ah, I didn’t realize that all you want is to get rid of that logged line.

1 Like

I guess we were curious if that’s a real issue, and how to fix it.
If it’s not, it apparently should not be logged.

This also depends on what issues are to be logged, I don’t see option to increase/decrease level of logging in syslog-ng.

Submitted as https://gitlab.nic.cz/turris/turris-os-packages/-/merge_requests/651

1 Like

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