carlos / platform Public

host: name a peer-mismatch refusal in the socket advisory instead of dropping it

socketServing folded every unixdial.Checked error, including
ErrPeerMismatch, into a plain false. A route whose socket is a symlink to
another listener therefore looked identical to one nobody was serving at
all, which is exactly the case an operator chasing issue #17 needs to see
named. Log the peer-mismatch case before returning false, matching the
package's existing advisory log shape.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ1ZvWj7naf73GjTX8MBv5
Paul Campbell pushed by paul@keymail.dev de560a9e43656cb276d9d2f8224044c0c79f8daf parent ab141b6
1 file changed, +11 −0
  • internal/host/socket_advice.go +11 −0
diff --git a/internal/host/socket_advice.go b/internal/host/socket_advice.go
index af3883cb5..7f17602f8 100644
--- a/internal/host/socket_advice.go
+++ b/internal/host/socket_advice.go
@@ -8,6 +8,7 @@ package host
import (
"context"
+ "errors"
"log"
"math/rand/v2"
"net"
@@ -48,11 +49,21 @@ func warnExternalSockets(routes []registry.Route, serving func(socket string) bo
// socketServing: the real probe. A live listener answers the dial; a
// stale socket file nobody listens on refuses it — only the former is
// "served". Same-box unix accept, so the timeout is generous.
+//
+// A path-mismatch refusal (the socket is a symlink to some OTHER
+// listener, or otherwise resolves to a path unixdial won't vouch for) is
+// logged rather than silently folded into "not served": the difference
+// between "nothing answers this socket" and "something answers it, but
+// not honestly" is exactly what an operator chasing issue #17 needs to
+// see named, not dropped on the floor.
func socketServing(socket string) bool {
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
defer cancel()
c, err := unixdial.Checked(ctx, &net.Dialer{}, socket)
if err != nil {
+ if errors.Is(err, unixdial.ErrPeerMismatch) {
+ log.Printf("socket advice: %s: %v", socket, err)
+ }
return false
}
c.Close()