Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions etc/rc.d/rc.avahidaemon
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ avahid_reload(){
}

avahid_update(){
if avahid_running && check && [[ "$(this allow-interfaces)" != "$BIND" ]]; then
log "Updating $DAEMON..."
avahid_restart # note we need restart here, not reload in order to update interfaces
if check && [[ "$(this allow-interfaces)" != "$BIND" ]]; then
if avahid_running; then
log "Updating $DAEMON..."
avahid_restart # note we need restart here, not reload in order to update interfaces
else
avahid_start # handle case where avahi-daemon exited because no suitable interfaces
fi
Comment on lines +123 to +129

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Stopped-daemon recovery is still blocked when bind list matches config.

At Line 123, both restart and start paths are gated by allow-interfaces != BIND. If Avahi is stopped and interfaces recover to the same bind list (common after transient loss), update remains a no-op and Avahi stays down. The mismatch check should gate only the running restart path; the stopped recovery path should be independent (with check/BIND validation).

Suggested fix
 avahid_update(){
-  if check && [[ "$(this allow-interfaces)" != "$BIND" ]]; then
-    if avahid_running; then
-      log "Updating $DAEMON..."
-      avahid_restart # note we need restart here, not reload in order to update interfaces
-    else
-      avahid_start # handle case where avahi-daemon exited because no suitable interfaces
-    fi
-  fi
+  if avahid_running; then
+    if check && [[ "$(this allow-interfaces)" != "$BIND" ]]; then
+      log "Updating $DAEMON..."
+      avahid_restart # note we need restart here, not reload in order to update interfaces
+    fi
+  else
+    # recover daemon when network is back, even if config already matches computed bind list
+    if check && [[ -n $BIND ]]; then
+      log "Recovering $DAEMON..."
+      avahid_start
+    fi
+  fi
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@etc/rc.d/rc.avahidaemon` around lines 123 - 129, The current guard (if check
&& [[ "$(this allow-interfaces)" != "$BIND" ]]) prevents avahid_start from
running when the daemon is stopped but the allow-interfaces list equals BIND;
change the logic so the outer check only validates "check" (and any BIND sanity
you need) and move the allow-interfaces != BIND test to only gate the
avahid_restart path: call avahid_restart when avahid_running and
allow-interfaces differs from BIND, and call avahid_start when avahid_running is
false (regardless of the allow-interfaces == BIND condition) so stopped-daemon
recovery is attempted independently; reference avahid_running, avahid_restart,
avahid_start, check, BIND and this allow-interfaces in your changes.

fi
}

Expand Down
Loading