Skip to content

Conversation

@jkool702
Copy link

@jkool702 jkool702 commented Dec 18, 2025

📦 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:

  • No change to real-time lease updates.
  • Fail-safe: if filtering fails, falls back to stock full reload.
  • Preserves original record ordering.
  • Works with busybox or GNU versions of tr, sed, grep, sort, uniq
  • Tested on IPQ8074 (dynalink dl-wrx36) with NSS + SQM + Unbound + odhcpd + large adblock list.

🧪 Run Testing Details

  • OpenWrt Version: snapshot (Dec 7th, 2025) - custom build with qosmio's NSS patches (12/7/25)
  • OpenWrt Target/Subtarget: qualcommax (ipq807x)
  • OpenWrt Device: Dynalink dl-wrx36

✅ Formalities

  • [✅] I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

Signed-off-by: Anthony Barone [email protected]

…ecords in odhcpd.sh (longtime)

The default longtime handler (every 5 minutes) dumps the full lease list, 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 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.

- No change to real-time lease updates.
- Fail-safe: if filtering fails, falls back to stock full reload.
- Preserves original record ordering.
- Works with busybox or GNU versions of tr, sed, grep, sort, uniq
- Tested on IPQ8074 (dynalink dl-wrx36) with NSS + SQM + Unbound + odhcpd + large adblock list.

Signed-off-by: Anthony Barone <[email protected]>

Signed-off-by: Anthony <[email protected]>
Made sed filter that identifies PTR lines more robust

Signed-off-by: Anthony <[email protected]>
@GeorgeSapkin
Copy link
Member

You need to format your commit message according to 50/75 rule, bump PKG_RELEASE in the Makefile, and use your real name and email address both in author and sign-off. Commits must start with a prefix. Have a look at the submissions guidelines.

@dibdot
Copy link
Contributor

dibdot commented Dec 19, 2025

... and please change/inform the unbound maintainer @EricLuehrsen ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants