Module Name:    src
Committed By:   gutteridge
Date:           Fri Jun 30 02:03:59 UTC 2023

Modified Files:
        src/external/apache2/mDNSResponder/dist/mDNSPosix: PosixDaemon.c

Log Message:
PosixDaemon.c: restore NetBSD logging additions lost in merges

Restore part of local modifications r. 1.2 & 1.4 from tsarna@. One
aspect could not be carried forward, as Apple dropped the bug detection
query functionality that was formerly represented by the teststate
member of the DNSServer struct. Otherwise, reapplied almost verbatim,
except for minor consistency and style changes.

This was added again in part as an example should there be a need to
add further logging content for NetBSD's purposes. (DumpStateLog() has
changed further as of Apple's 1790.80.10 release, but should we roll
forward, our means here should still be viable.)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
    src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.17 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.18
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.17	Fri Jun 30 01:59:45 2023
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Fri Jun 30 02:03:58 2023
@@ -125,11 +125,38 @@ mDNSlocal void ParseCmdLinArgs(int argc,
     }
 }
 
-mDNSlocal void DumpStateLog()
+mDNSlocal void DumpStateLog(mDNS *const m)
 // Dump a little log of what we've been up to.
 {
+    DNSServer *s;
+    PosixNetworkInterface *i;
+
     LogMsg("---- BEGIN STATE LOG ----");
     udsserver_info();
+
+    LogMsgNoIdent("----- Network Interfaces -------");
+    for (i = (PosixNetworkInterface*)(m->HostInterfaces);
+         i; i = (PosixNetworkInterface *)(i->coreIntf.next))
+    {
+        LogMsg("%p %p %d %s%s%s%s%s %-8s %#a", i,
+               (void *)(i->coreIntf.InterfaceID), i->index,
+               i->coreIntf.InterfaceActive ? "-" : "D",
+               i->coreIntf.IPv4Available ? "4" : "-",
+               i->coreIntf.IPv6Available ? "6" : "-",
+               i->coreIntf.Advertise ? "A" : "-",
+               i->coreIntf.McastTxRx ? "M" : "-",
+               i->intfName, &(i->coreIntf.ip));
+    }
+
+    LogMsgNoIdent("--------- DNS Servers ----------");
+    if (!m->DNSServers) LogMsgNoIdent("<None>");
+    else
+    {
+        for (s = m->DNSServers; s; s = s->next)
+            LogMsgNoIdent("DNS Server %##s %#a:%d",
+                          s->domain.c, &s->addr, mDNSVal16(s->port));
+    }
+
     LogMsg("----  END STATE LOG  ----");
 }
 
@@ -167,7 +194,7 @@ mDNSlocal mStatus MainLoop(mDNS *m) // L
         (void) mDNSPosixRunEventLoopOnce(m, &timeout, &signals, &gotData);
 
         if (sigismember(&signals, SIGHUP )) Reconfigure(m);
-        if (sigismember(&signals, SIGUSR1)) DumpStateLog();
+        if (sigismember(&signals, SIGUSR1)) DumpStateLog(m);
         // SIGPIPE happens when we try to write to a dead client; death should be detected soon in request_callback() and cleaned up.
         if (sigismember(&signals, SIGPIPE)) LogMsg("Received SIGPIPE - ignoring");
         if (sigismember(&signals, SIGINT) || sigismember(&signals, SIGTERM)) break;

Reply via email to