Skip to content

Improve Asuswrt-Merlin 3006 DNS/SDN integration and service lifecycle - #343

Open
maghuro wants to merge 36 commits into
Control-D-Inc:v1.0from
maghuro:fix/v1-merlin-3006-integration
Open

maghuro wants to merge 36 commits into
Control-D-Inc:v1.0from
maghuro:fix/v1-merlin-3006-integration

Conversation

@maghuro

@maghuro maghuro commented Sep 27, 2026

Copy link
Copy Markdown

Closes #342

Related to #229.

Summary

This updates the maintained v1.x Asuswrt-Merlin integration to coexist safely with shared Merlin hooks, support Merlin 3006 Guest Network Pro / SDN through the supported extension points, and harden ctrld's service lifecycle and self-upgrade behavior.

Shared dnsmasq hook coexistence

  • manage only explicit ctrld-owned blocks inside shared hooks;
  • preserve unrelated user/addon content, ordering and existing modes;
  • migrate the legacy ctrld-generated hook format;
  • remove the historical enclosing-script exit 0;
  • perform atomic writes with path/content revalidation.

Merlin 3006 / Guest Network Pro / SDN

  • integrate through both dnsmasq.postconf and dnsmasq-sdn.postconf;
  • verify generated main and SDN dnsmasq configurations after restart;
  • reject unresolved conf-file=, conf-dir= and conf-script= includes during verification;
  • never publish complete dnsmasq-N.conf SDN replacements;
  • retain a compatibility fallback only for main dnsmasq when the supported hook demonstrably did not apply;
  • make Merlin NVRAM setup/restore retry-safe without changing other router backends;
  • migrate legacy ctrld dnsmasq snapshots using crash-safe, inode-aware ownership state and conservative restoration.

Merlin service lifecycle

  • atomically publish and conservatively migrate ctrld.startup;
  • preserve installed argv and POSIX shell argument boundaries;
  • perform legacy startup migration from the newly launched binary after self-update;
  • validate PID ownership through /proc/<pid>/cmdline and signal the same validated PID;
  • serialize Merlin lifecycle operations and the actual CLI restart/upgrade stop-cleanup-start transaction;
  • publish missing shared hook stubs with no-clobber semantics;
  • remove both current quoted and legacy unquoted hook references during uninstall;
  • validate dnsmasq process ownership before the diskmon service-event signal path.

Compatibility

This targets the maintained v1.0 line.

The v1.x dnsmasq implementation deliberately retains text/template; the unrelated main-branch html/template change is not included.

Validation

The final combined branch was validated with:

  • go test -race ./...
  • Staticcheck
  • Ubuntu
  • macOS
  • Windows

All three CI jobs pass on the final combined tree.

The implementation was developed as independently reviewed/staged changes for hook coexistence, DNS/SDN integration and service lifecycle before being combined on the v1.x maintenance line.

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.

1 participant