Skip to content

Persist dnsmasq DHCP leases on mounted storage#1695

Merged
gsanchietti merged 1 commit into
NethServer:nethsecurity-8.8from
gsanchietti:dhcp-lease-persistence-8-8
May 26, 2026
Merged

Persist dnsmasq DHCP leases on mounted storage#1695
gsanchietti merged 1 commit into
NethServer:nethsecurity-8.8from
gsanchietti:dhcp-lease-persistence-8-8

Conversation

@gsanchietti
Copy link
Copy Markdown
Member

Summary

  • store dnsmasq DHCP leases on /mnt/data/dnsmasq/dhcp.leases when storage is mounted
  • keep /tmp/dhcp.leases as the compatibility path and fall back to it before storage removal
  • restart victoria-metrics around fstab changes so remove-storage can release /mnt/data

Related issue

#1694

How to test

  1. Confirm uci get dhcp.ns_dnsmasq.leasefile is /tmp/dhcp.leases when storage is not configured.
  2. Run add-storage /dev/<data-partition> and verify the lease path switches to /mnt/data/dnsmasq/dhcp.leases, /tmp/dhcp.leases becomes a symlink, and the storage lease file is created.
  3. Reboot and confirm the lease file on /mnt/data is preserved.
  4. Run remove-storage and verify dnsmasq returns to /tmp/dhcp.leases before /mnt/data is unmounted.

Dependencies

None.

@gsanchietti gsanchietti self-assigned this May 26, 2026
@gsanchietti gsanchietti requested a review from stephdl May 26, 2026 10:46
Comment thread packages/ns-storage/files/10-ns-storage-dhcp-leases Outdated
Comment thread packages/ns-storage/files/10-ns-storage-dhcp-leases Outdated
Comment thread packages/ns-storage/files/ns-storage-dhcp-leases Outdated
Comment thread packages/ns-storage/files/add-storage
@gsanchietti gsanchietti force-pushed the dhcp-lease-persistence-8-8 branch 3 times, most recently from d766a95 to eba8e86 Compare May 26, 2026 12:53
@gsanchietti gsanchietti requested a review from Tbaile May 26, 2026 13:21
Copy link
Copy Markdown
Collaborator

@Tbaile Tbaile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not fond of a hotplug that writes down uci changes, the alternative should be to have a proc.d that listens on changes of fstab configuration, not sure it's the scope here.

@gsanchietti
Copy link
Copy Markdown
Member Author

I agree @Tbaile: I'm going to remove the hotplug part: It should not be needed 99% of the time.

@gsanchietti gsanchietti force-pushed the dhcp-lease-persistence-8-8 branch from eba8e86 to ad8d0bf Compare May 26, 2026 14:20
@gsanchietti gsanchietti requested a review from Tbaile May 26, 2026 14:20
Comment thread packages/ns-storage/Makefile Outdated
Store dnsmasq DHCP leases on /mnt/data when storage is
available and keep /tmp/dhcp.leases as the compatibility
path for existing readers.

Switch back to /tmp before storage removal and restart
victoria-metrics around fstab changes so the data mount
can be released cleanly.

Assisted-by: Copilot:gpt-5.4
@gsanchietti gsanchietti force-pushed the dhcp-lease-persistence-8-8 branch from ad8d0bf to df76962 Compare May 26, 2026 15:11
@gsanchietti gsanchietti merged commit 3d45a07 into NethServer:nethsecurity-8.8 May 26, 2026
1 check failed
@gsanchietti gsanchietti deleted the dhcp-lease-persistence-8-8 branch May 26, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants