Skip to content

fix(avahi): recover stopped daemon even when bind list matches config#2664

Open
elibosley wants to merge 1 commit into
masterfrom
codex/avahi-update-start-stopped
Open

fix(avahi): recover stopped daemon even when bind list matches config#2664
elibosley wants to merge 1 commit into
masterfrom
codex/avahi-update-start-stopped

Conversation

@elibosley

@elibosley elibosley commented Jun 11, 2026

Copy link
Copy Markdown
Member

Follow-up to #2661 (already merged), addressing CodeRabbit's review.

avahid_update previously gated both the restart and start paths behind the allow-interfaces != BIND mismatch. That meant a stopped daemon would stay down if interfaces recovered to the same bind list — common after transient interface loss.

This splits on daemon state instead:

  • Running: restart only when check passes and allow-interfaces differs from $BIND (unchanged).
  • Stopped: recover via avahid_start whenever check passes and $BIND is non-empty, regardless of whether the bind list matches the saved config.

Verified with bash -n etc/rc.d/rc.avahidaemon and git diff --check.

Summary by CodeRabbit

  • Bug Fixes
    • Optimized Avahi daemon restart logic to avoid unnecessary restarts by detecting actual configuration changes.
    • Improved daemon recovery behavior with smarter conditional startup based on interface configuration.

Gate the allow-interfaces mismatch check only on the running restart
path; recover a stopped daemon independently when interfaces are back.

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a424a2b8-01dc-419f-b873-520fcb944e7e

📥 Commits

Reviewing files that changed from the base of the PR and between d9c5bbc and 9b1d39a.

📒 Files selected for processing (1)
  • etc/rc.d/rc.avahidaemon

Walkthrough

The PR restructures the avahid_update function to introduce explicit conditional logic based on whether the Avahi daemon is currently running. When running, it intelligently restarts only when the computed interface binding differs from the configured BIND value. When stopped, it adds recovery logic to conditionally restart the daemon if configuration permits.

Changes

Avahi daemon recovery and update

Layer / File(s) Summary
Daemon state-aware update and recovery
etc/rc.d/rc.avahidaemon
avahid_update adds an explicit running/not-running branch. When running, it compares the computed allow-interfaces value against BIND and triggers restart only on mismatch. When not running, it adds a recovery path that conditionally starts the daemon when BIND is non-empty and check succeeds.

Sequence Diagram(s)

No sequence diagram is necessary; the state flow is captured in the hidden review stack diagram above.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • unraid/webgui#2661: Both PRs modify etc/rc.d/rc.avahidaemon's avahid_update logic to handle the case where avahi-daemon is not running by starting/recovering it on update, while preserving the restart behavior when running and allow-interfaces mismatches BIND.

Suggested labels

7.3

Suggested reviewers

  • limetech

Poem

🐰 A daemon in rest finds new grace,
With logic that checks its own place—
When running, compare,
When stopped, with care,
Recovery restarts at the right pace! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: recovering a stopped Avahi daemon even when the bind list matches the config, which is the core behavioral change in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/avahi-update-start-stopped

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.06.11.2109
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2664/webgui-pr-2664.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
etc/rc.d/rc.avahidaemon

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2664, or run:

plugin remove webgui-pr-2664

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@elibosley elibosley added the 7.3 label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant