CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist/mDNSPosix

2023-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 14 17:24:42 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
mDNSPosix.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #493):

external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.20

mDNSPlatformInit(): If we fail to create an IPv6 socket, ignore the
error and just continue without IPv6 support.

PR bin/57769


To generate a diff of this commit:
cvs rdiff -u -r1.17.6.1 -r1.17.6.2 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.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/mDNSPosix.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17.6.1 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17.6.2
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17.6.1	Wed Sep 13 09:46:49 2023
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Thu Dec 14 17:24:42 2023
@@ -1324,7 +1324,16 @@ mDNSexport mStatus mDNSPlatformInit(mDNS
 #if HAVE_IPV6
 sa.sa_family = AF_INET6;
 m->p->unicastSocket6 = -1;
-if (err == mStatus_NoError) err = SetupSocket(, zeroIPPort, 0, >p->unicastSocket6);
+if (err == mStatus_NoError)
+{
+	err = SetupSocket(, zeroIPPort, 0, >p->unicastSocket6);
+	if (err != mStatus_NoError)
+	{
+	// Ignore errors configuring IPv6.
+	m->p->unicastSocket6 = -1;
+	err = mStatus_NoError;
+	}
+}
 #endif
 
 // Tell mDNS core about the network interfaces on this machine.



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist/mDNSPosix

2023-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec 14 17:24:42 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
mDNSPosix.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #493):

external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.20

mDNSPlatformInit(): If we fail to create an IPv6 socket, ignore the
error and just continue without IPv6 support.

PR bin/57769


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

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



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist

2023-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 13 09:46:49 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSCore [netbsd-10]:
DNSCommon.c
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
mDNSPosix.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #372):

external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.19
external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c: revision 1.11

mDNSPosix.c: free very large struct on error path

DNSCommon.c: fix punctuation in a comment

This has very little value in itself; it's intended to make a material
change to this file to facilitate rebuilds. Otherwise, people running
update builds on branches will run into mismatches and build failures
after our switch to use arc4random(3). (That is, this change is
intended to be pulled up.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.12.1 \
src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c
cvs rdiff -u -r1.17 -r1.17.6.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.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/mDNSCore/DNSCommon.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c:1.9 src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c:1.9.12.1
--- src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c:1.9	Wed Apr 11 18:33:48 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c	Wed Sep 13 09:46:49 2023
@@ -3754,7 +3754,7 @@ mDNSexport mStatus mDNSSendDNSMessage(mD
 m->UnicastPacketsSent++;
 #endif // APPLE_OSX_mDNSResponder
 
-// Zero-length message data is okay (e.g. for a DNS Update ack, where all we need is an ID and an error code
+// Zero-length message data is okay (e.g. for a DNS Update ack, where all we need is an ID and an error code)
 if (end < msg->data || end - msg->data > AbsoluteMaxDNSMessageData)
 {
 LogMsg("mDNSSendDNSMessage: invalid message %p %p %d", msg->data, end, end - msg->data);

Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17.6.1
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.17	Tue Jul 21 14:04:07 2020
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Wed Sep 13 09:46:49 2023
@@ -1266,6 +1266,8 @@ mDNSlocal mStatus WatchForInterfaceChang
 err = OpenIfNotifySocket(>NotifySD);
 if (err == 0)
 err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec);
+if (err)
+mDNSPlatformMemFree(pChgRec);
 
 return err;
 }



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist

2023-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 13 09:46:49 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSCore [netbsd-10]:
DNSCommon.c
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
mDNSPosix.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #372):

external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.19
external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c: revision 1.11

mDNSPosix.c: free very large struct on error path

DNSCommon.c: fix punctuation in a comment

This has very little value in itself; it's intended to make a material
change to this file to facilitate rebuilds. Otherwise, people running
update builds on branches will run into mismatches and build failures
after our switch to use arc4random(3). (That is, this change is
intended to be pulled up.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.12.1 \
src/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c
cvs rdiff -u -r1.17 -r1.17.6.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c

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



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist

2023-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  3 15:32:01 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
PosixDaemon.c
src/external/apache2/mDNSResponder/dist/mDNSShared [netbsd-10]:
PlatformCommon.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #193):

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."


To generate a diff of this commit:
cvs rdiff -u -r1.14.6.1 -r1.14.6.2 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
cvs rdiff -u -r1.6 -r1.6.6.1 \
src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.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.14.6.1 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.14.6.2
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.14.6.1	Sun May 28 10:20:08 2023
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Sat Jun  3 15:32:01 2023
@@ -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)

Index: src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.6 src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.6.6.1
--- src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c:1.6	Tue Jul 21 14:04:07 2020
+++ src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c	Sat Jun  3 15:32:01 2023
@@ -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*)>ip.v6;
 addr.a6.sin6_scope_id = 0;
 }
@@ -71,9 +71,17 @@ mDNSexport void mDNSPlatformSourceAddrFo
 
 if ((connect(sock, , 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, , )) < 0)



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist

2023-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  3 15:32:01 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
PosixDaemon.c
src/external/apache2/mDNSResponder/dist/mDNSShared [netbsd-10]:
PlatformCommon.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #193):

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."


To generate a diff of this commit:
cvs rdiff -u -r1.14.6.1 -r1.14.6.2 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c
cvs rdiff -u -r1.6 -r1.6.6.1 \
src/external/apache2/mDNSResponder/dist/mDNSShared/PlatformCommon.c

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



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist/mDNSPosix

2023-05-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 28 10:20:08 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
PosixDaemon.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #183):

external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 
1.15

reapply changes for the built-in drop-privs support by tsarna.

this commit doesn't reapply "dumping of the unicast server list
to the DumpStateLog debugging output" enhancement.
It doesn't build anymore, no idea how to rewrite.

Should fix PR 57442. Needs pull-ups for netbsd-9, netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.6.1 \
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.14 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.14.6.1
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.14	Wed Jul 22 19:05:14 2020
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Sun May 28 10:20:08 2023
@@ -50,6 +50,10 @@ extern int daemon(int, int);
 #include "PlatformCommon.h"
 #include "DNSCommon.h"
 
+#ifndef MDNSD_USER
+#define MDNSD_USER "nobody"
+#endif
+
 #define CONFIG_FILE "/etc/mdnsd.conf"
 static domainname DynDNSZone;// Default wide-area zone for service registration
 static domainname DynDNSHostname;
@@ -190,11 +194,21 @@ int main(int argc, char **argv)
 // Now that we're finished with anything privileged, switch over to running as "nobody"
 if (mStatus_NoError == err)
 {
-const struct passwd *pw = getpwnam("nobody");
+const struct passwd *pw = getpwnam(MDNSD_USER);
 if (pw != NULL)
+	{
+setgid(pw->pw_gid);
 setuid(pw->pw_uid);
+	}
 else
-LogMsg("WARNING: mdnsd continuing as root because user \"nobody\" does not exist");
+#ifdef MDNSD_NOROOT
+{
+LogMsg("WARNING: mdnsd exiting because user \""MDNSD_USER"\" does not exist");
+err = mStatus_Invalid;
+}
+#else
+LogMsg("WARNING: mdnsd continuing as root because user \""MDNSD_USER"\" does not exist");
+#endif
 }
 
 if (mStatus_NoError == err)



CVS commit: [netbsd-10] src/external/apache2/mDNSResponder/dist/mDNSPosix

2023-05-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 28 10:20:08 UTC 2023

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix [netbsd-10]:
PosixDaemon.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #183):

external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c: revision 
1.15

reapply changes for the built-in drop-privs support by tsarna.

this commit doesn't reapply "dumping of the unicast server list
to the DumpStateLog debugging output" enhancement.
It doesn't build anymore, no idea how to rewrite.

Should fix PR 57442. Needs pull-ups for netbsd-9, netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.6.1 \
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.