dhcpv6-ia: make tmp lease file hidden
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Fri, 21 Oct 2022 13:28:59 +0000 (14:28 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 24 Oct 2022 19:52:14 +0000 (21:52 +0200)
commita92c0a73d018cd6453dcf253d9617f97311becab
tree3d762fca3dc505b77fcadbb3078bca2a754b41d5
parent4a673e1cd26d58ebf4397dd06ee5fa39f7f832da
dhcpv6-ia: make tmp lease file hidden

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.

Also, while here, only rename the temporary file if it actually contains
different content.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
src/dhcpv6-ia.c