Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/apache2/mDNSResponder/dist/mDNSPosix PosixDaemon.c:...



details:   https://anonhg.NetBSD.org/src/rev/8ad59c199b21
branches:  trunk
changeset: 377178:8ad59c199b21
user:      gutteridge <gutteridge%NetBSD.org@localhost>
date:      Fri Jun 30 02:03:58 2023 +0000

description:
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.)

diffstat:

 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c |  31 ++++++++++++-
 1 files changed, 29 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r 276d4353119a -r 8ad59c199b21 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
--- a/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Fri Jun 30 01:59:45 2023 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Fri Jun 30 02:03:58 2023 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index