openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
160 stars 96 forks source link

dhcpv6-ia.c: make tmp lease file hidden #190

Closed ldir-EDB0 closed 1 year ago

ldir-EDB0 commented 1 year ago

Use a hidden . prefixed temporary lease file instead of appending '.tmp'. Dnsmasq is capable of scanning files/directories using inotify to receive file change notifications and updating its view of hostname ip address mapping without being SIGHUPped. Until dnsmasq v2.88 this mechanism allows additions to hostnames, no deletions. dnsmasq v2.88 when released will understand how to remove mappings.

Unfortunately without this change dnsmasq sees odhcpd's temporary lease file via inotify and it also sees the change when odhcpd atomically renames the file from '.tmp' to the correct name.

dnsmasq excludes hidden '.' files from it's inotify scans, thus changing odhcpd to use a hidden temporary lease file reduces load and makes sense.

Signed-off-by: Kevin Darbyshire-Bryant ldir@darbyshire-bryant.me.uk

dedeckeh commented 1 year ago

Thx for the patch; merged as https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=a92c0a73d018cd6453dcf253d9617f97311becab