Source-Changes-HG archive

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

[src/netbsd-9]: src/external/apache2/mDNSResponder/dist Pull up following rev...



details:   https://anonhg.NetBSD.org/src/rev/cba0c1228186
branches:  netbsd-9
changeset: 376155:cba0c1228186
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jun 03 15:34:30 2023 +0000

description:
Pull up following revision(s) (requested by andvar in ticket #1641):

        external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c: revision 1.7
        external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 1.16

mdnsd(8): restore fixes for PR bin/46758, lost on resolving merge conflicts.

Original commit message from Roy Marples:
"Derive our primary interface and address by trying to connect to an
address in the TEST-NET-2 network as noted in RFC5737 instead of using
the 1.1.1.1 address. Also, use port 7 (echo) for better style.
Fixes PR bin/46758 thanks to Lloyd Parkes."

diffstat:

 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c     |   2 +-
 external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c |  18 +++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 2690de60f383 -r cba0c1228186 external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
--- a/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Sat Jun 03 15:27:13 2023 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c       Sat Jun 03 15:34:30 2023 +0000
@@ -92,7 +92,7 @@ mDNSlocal void mDNS_StatusCallback(mDNS 
 static void Reconfigure(mDNS *m)
 {
     mDNSAddr DynDNSIP;
-    const mDNSAddr dummy = { mDNSAddrType_IPv4, { { { 1, 1, 1, 1 } } } };;
+    const mDNSAddr dummy = { mDNSAddrType_IPv4, { { { 198, 51, 100, 42 } } } };;
     mDNS_SetPrimaryInterfaceInfo(m, NULL, NULL, NULL);
     mDNS_Lock(m);
     if (ParseDNSServers(m, uDNS_SERVERS_FILE) < 0)
diff -r 2690de60f383 -r cba0c1228186 external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c
--- a/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c   Sat Jun 03 15:27:13 2023 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c   Sat Jun 03 15:34:30 2023 +0000
@@ -52,7 +52,7 @@ mDNSexport void mDNSPlatformSourceAddrFo
         addr.a4.sin_len         = inner_len;
         #endif
         addr.a4.sin_family      = AF_INET;
-        addr.a4.sin_port        = 1;    // Not important, any port will do
+        addr.a4.sin_port        = 7;    // Not important, any port will do
         addr.a4.sin_addr.s_addr = dst->ip.v4.NotAnInteger;
     }
     else if (dst->type == mDNSAddrType_IPv6)
@@ -63,7 +63,7 @@ mDNSexport void mDNSPlatformSourceAddrFo
         #endif
         addr.a6.sin6_family   = AF_INET6;
         addr.a6.sin6_flowinfo = 0;
-        addr.a6.sin6_port     = 1;  // Not important, any port will do
+        addr.a6.sin6_port     = 7;  // Not important, any port will do
         addr.a6.sin6_addr     = *(struct in6_addr*)&dst->ip.v6;
         addr.a6.sin6_scope_id = 0;
     }
@@ -71,9 +71,17 @@ mDNSexport void mDNSPlatformSourceAddrFo
 
     if ((connect(sock, &addr.s, inner_len)) < 0)
     {
-        if (errno != EADDRNOTAVAIL)
-           LogMsg("mDNSPlatformSourceAddrForDest: connect %#a failed errno %d (%s)", dst, errno, strerror(errno));
-       goto exit;
+        static mDNSv4Addr dummy = { 198, 51, 100, 42 };
+
+        // Don't spam if we can't connect to 198.51.100.42 to the console.
+        // That is our test address to out which interfaces/address should be primary and is also
+        // configured in mDNSPosix/PosixDaemon.c:Reconfigure()
+        // Failing to connect to it with EADDRNOTAVAIL is a common situation, especially on boot up.
+        if (dst->type == mDNSAddrType_IPv4 && dst->ip.v4.NotAnInteger == dummy.NotAnInteger && errno == EADDRNOTAVAIL)
+            LogInfo("mDNSPlatformSourceAddrForDest: connect %#a failed errno %d (%s)", dst, errno, strerror(errno));
+        else
+            LogMsg("mDNSPlatformSourceAddrForDest: connect %#a failed errno %d (%s)", dst, errno, strerror(errno));
+        goto exit;
     }
 
     if ((getsockname(sock, &addr.s, &len)) < 0)



Home | Main Index | Thread Index | Old Index