unbound: prevent reloading local-data every 5 minutes for unchanged records in odhcpd.sh (longtime) #28111
+21
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📦 Package Details
Maintainer: @EricLuehrsen, @dibdot
Description: modifies the "longtime" method in odhcpd.sh so that DHCP leases that appear identically on both the "del" and "add" lists are removed from both lists and are not unloaded then immediately reloaded via unbound-control
The default longtime handler dumps and reloads the full lease list every 5 minutes, causing Unbound to reload all local-data records even when nothing changed. This creates periodic CPU/RSS spikes and increases memory fragmentation, increasing the chance of earlyoom killing Unbound on low-memory devices (i.e., on most devices running openwrt). This can leave the router unable to resolve DNS queries or hand out DHCP leases until the unbound service is manually restarted.
This patch adds a small pipeline (tr | sed | grep | sed) to filter out unchanged lease entries, so only true deltas are sent to Unbound via local_datas / local_datas_remove. Filtering is done using grouped local-data + local-data-ptr pairs. When there are no changes to any DHCP leases from the last 5 minutes, unbound-control is not called at all. This is implemented so that:
🧪 Run Testing Details
✅ Formalities
Signed-off-by: Anthony Barone [email protected]