CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2020-07-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jul 22 19:05:14 UTC 2020

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

Log Message:
mdnsd: Make the unable to parse resolv.conf message informative

resovconf will SIGHUP mdnsd when resolv.conf changes so this message
should not be an error.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
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.13 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.14
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.13	Tue Jul 21 14:11:39 2020
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Wed Jul 22 19:05:14 2020
@@ -92,7 +92,7 @@ static void Reconfigure(mDNS *m)
 mDNS_SetPrimaryInterfaceInfo(m, NULL, NULL, NULL);
 mDNS_Lock(m);
 if (ParseDNSServers(m, uDNS_SERVERS_FILE) < 0)
-LogMsg("Unable to parse DNS server list. Unicast DNS-SD unavailable");
+LogInfo("Unable to parse DNS server list. Unicast DNS-SD unavailable");
 mDNS_Unlock(m);
 ReadDDNSSettingsFromConfFile(m, CONFIG_FILE, &DynDNSHostname, &DynDNSZone, NULL);
 mDNSPlatformSourceAddrForDest(&DynDNSIP, &dummy);



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2020-07-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Jul 21 14:11:39 UTC 2020

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

Log Message:
mdnsd: starting and stopping are informational messages


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
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.12 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.13
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.12	Wed Apr 11 18:34:18 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Tue Jul 21 14:11:39 2020
@@ -177,7 +177,7 @@ int main(int argc, char **argv)
 
 ParseCmdLinArgs(argc, argv);
 
-LogMsg("%s starting", mDNSResponderVersionString);
+LogInfo("%s starting", mDNSResponderVersionString);
 
 err = mDNS_Init(&mDNSStorage, &PlatformStorage, gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses,
 mDNS_StatusCallback, mDNS_Init_NoInitCallbackContext);
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
 if (mStatus_NoError == err)
 err = MainLoop(&mDNSStorage);
 
-LogMsg("%s stopping", mDNSResponderVersionString);
+LogInfo("%s stopping", mDNSResponderVersionString);
 
 mDNS_Close(&mDNSStorage);
 



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 19 08:14:28 UTC 2018

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

Log Message:
It is not an error if we did not find any IPv4 interfaces. It could
be the case we never have V4 interfaces (in a V6 system) so this
is bogus. The code was recently changed to ignore loopback interfaces.
If mdnsd was started too early, this means that no interfaces would
be found (since interfaces down, with no addresses, or tentative
are ignored). I put back the loopback interfaces yesterday to avoid
this error, but this seems like the left hand not knowing what the
right hand does because whoever removed the loopback interfaces
from the list, did not read the 'self discovery' comment and the
special code that deals with loopback in this file. Nevertheless,
I think it is better to ignore the loopback interfaces in the long
run, but it is ok to keep them around since the code is handling
them just fine (and works both with and without them).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
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.15 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.16
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.15	Sun Feb 25 15:04:56 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Mon Nov 19 03:14:28 2018
@@ -977,7 +977,9 @@ mDNSlocal int SetupInterfaceList(mDNS *c
 assert(m != NULL);
 debugf("SetupInterfaceList");
 
+#if 0
 if (intfList == NULL) err = ENOENT;
+#endif
 
 #if HAVE_IPV6
 if (err == 0)   /* Link the IPv6 list to the end of the IPv4 list */



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-11-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 18 18:57:12 UTC 2018

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

Log Message:
NFC: Fix commit message: Include the loopback so that we don't return an
empty address list before addresses are configured.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.11 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.12
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.11	Sun Nov 18 13:55:49 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Sun Nov 18 13:57:12 2018
@@ -304,7 +304,7 @@ struct ifi_info *get_ifi_info(int family
 continue;   /* ignore if interface not up */
 
 
-#if 0
+#ifdef notdef
 	/*
 	 * Include the loopback so that we return at least one
 	 * address, so that mdnsd does not exit before we get



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-11-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 18 18:55:49 UTC 2018

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSUNP.c
Added Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSBSD.c

Log Message:
Add a simpler version to do interface enumeration that uses getifaddrs(3)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSBSD.c
cvs rdiff -u -r1.10 -r1.11 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.10 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.11
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.10	Sat Apr  7 15:18:16 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Sun Nov 18 13:55:49 2018
@@ -303,8 +303,16 @@ struct ifi_info *get_ifi_info(int family
 if ((flags & IFF_UP) == 0)
 continue;   /* ignore if interface not up */
 
+
+#if 0
+	/*
+	 * Include the loopback so that we return at least one
+	 * address, so that mdnsd does not exit before we get
+	 * a dhcp address
+	 */
 	if ((flags & IFF_LOOPBACK))
 	continue;	/* ignore loopback interfaces */
+#endif
 
 	/* Skip addresses we can't use */
 #ifdef SIOCGIFAFLAG_IN

Added files:

Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSBSD.c
diff -u /dev/null src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSBSD.c:1.1
--- /dev/null	Sun Nov 18 13:55:49 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSBSD.c	Sun Nov 18 13:55:49 2018
@@ -0,0 +1,314 @@
+/* -*- Mode: C; tab-width: 4 -*-
+ *
+ * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mDNSUNP.h"
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int
+copyaddr(struct sockaddr **dst, const struct sockaddr *src, socklen_t len)
+{
+	if (src == NULL)
+		return 1;
+
+	*dst = calloc(1, len);
+	if (*dst == NULL)
+		return 0;
+
+	memcpy(*dst, src, len);
+	return 1;
+}
+
+struct ifi_info *
+get_ifi_info(int family, int doaliases)
+{
+	struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
+	struct ifaddrs *ifal, *ifa;
+
+	if (getifaddrs(&ifal) == -1) {
+		warn("getifaddrs");
+		return NULL;
+	}
+
+	ifihead = NULL;
+	ifipnext = &ifihead;
+
+	for (ifa = ifal; ifa; ifa = ifa->ifa_next) {
+		struct sockaddr *sa = ifa->ifa_addr;
+		int flags = ifa->ifa_flags;
+		int addrflags = ifa->ifa_addrflags;
+
+#if 0
+		/*
+		 * Include the loopback so that we return at least one
+		 * address, so that mdnsd does not exit before we get
+		 * a dhcp address
+		 */
+		if (flags & IFF_LOOPBACK)
+			continue;	/* ignore loopback interfaces */
+#endif
+
+		if ((flags & IFF_UP) == 0)
+			continue;	/* ignore if interface not up */
+
+		if (sa == NULL || sa->sa_family != family)
+			continue; 	/* ignore if not the desired family */
+
+		switch (sa->sa_family) {
+		case AF_INET:
+			if (addrflags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
+continue;
+
+			break;
+#if defined(AF_INET6) && HAVE_IPV6
+		case AF_INET6:
+			if (addrflags & (IN6_IFF_NOTREADY | IN6_IFF_DETACHED))
+continue;
+#endif
+			break;
+		default:
+			continue;
+		}
+
+		ifi = calloc(1, sizeof(*ifi));
+		if (ifi == NULL)
+			goto gotError;
+
+		ifipold   = *ifipnext;		/* need this later */
+		ifiptr= ifipnext;
+		*ifipnext = ifi;		/* prev points to new one */
+		ifipnext  = &ifi->ifi_next;	/* pointer to next one */
+
+		ifi->ifi_flags = flags;		/* IFF_xxx values */
+		ifi->ifi_myflags = 0;		/* IFI_xxx values */
+		ifi->ifi_index = if_nametoindex(ifa->ifa_name);
+		memcpy(ifi->ifi_name, ifa->ifa_name, IFI_NAME);
+		ifi->ifi_name[IFI_NAME-1] = '\0';
+		if (!copyaddr(&ifi->ifi_addr, ifa->ifa_addr, sa->sa_len))
+			goto gotError;
+		if (!copyaddr(&ifi->ifi_netmask, ifa->ifa_netmask, sa->sa_len))
+			goto gotError;
+
+		if ((flags & IFF_BROADCAST) && !copyaddr(&ifi->ifi_brdaddr,
+		ifa->ifa_broadaddr, sa->sa_len))
+			goto gotError;
+		if ((flags & IFF_POINTOPOINT) && !copyaddr(&ifi->ifi_dstaddr,
+		ifa->ifa_dstaddr, sa->sa_len))
+			goto gotError;
+	}
+
+	goto done;

CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 11 18:34:18 UTC 2018

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

Log Message:
Add the missing lock.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
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.11 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.12
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.11	Sat Mar  3 11:09:56 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Wed Apr 11 14:34:18 2018
@@ -48,6 +48,7 @@ extern int daemon(int, int);
 #include "mDNSUNP.h"// For daemon()
 #include "uds_daemon.h"
 #include "PlatformCommon.h"
+#include "DNSCommon.h"
 
 #define CONFIG_FILE "/etc/mdnsd.conf"
 static domainname DynDNSZone;// Default wide-area zone for service registration
@@ -89,8 +90,10 @@ static void Reconfigure(mDNS *m)
 mDNSAddr DynDNSIP;
 const mDNSAddr dummy = { mDNSAddrType_IPv4, { { { 1, 1, 1, 1 } } } };;
 mDNS_SetPrimaryInterfaceInfo(m, NULL, NULL, NULL);
+mDNS_Lock(m);
 if (ParseDNSServers(m, uDNS_SERVERS_FILE) < 0)
 LogMsg("Unable to parse DNS server list. Unicast DNS-SD unavailable");
+mDNS_Unlock(m);
 ReadDDNSSettingsFromConfFile(m, CONFIG_FILE, &DynDNSHostname, &DynDNSZone, NULL);
 mDNSPlatformSourceAddrForDest(&DynDNSIP, &dummy);
 if (DynDNSHostname.c[0]) mDNS_AddDynDNSHostName(m, &DynDNSHostname, NULL, NULL);



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  7 19:18:16 UTC 2018

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

Log Message:
put back handling for SIOCGIFAFLAG_IN -- should not matter.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.9 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.10
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.9	Sun Jan 14 15:04:56 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Sat Apr  7 15:18:16 2018
@@ -303,6 +303,36 @@ struct ifi_info *get_ifi_info(int family
 if ((flags & IFF_UP) == 0)
 continue;   /* ignore if interface not up */
 
+	if ((flags & IFF_LOOPBACK))
+	continue;	/* ignore loopback interfaces */
+
+	/* Skip addresses we can't use */
+#ifdef SIOCGIFAFLAG_IN
+	if (ifr->ifr_addr.sa_family == AF_INET) {
+		ifrcopy = *ifr;
+		if (ioctl(sockfd, SIOCGIFAFLAG_IN, &ifrcopy) < 0)
+			goto gotError;
+		if (ifrcopy.ifr_addrflags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
+			continue;
+	}
+#endif
+#ifdef SIOCGIFAFLAG_IN6
+if (ifr->ifr_addr.sa_family == AF_INET6) {
+		struct in6_ifreq ifr6;
+
+		if (sockf6 == -1)
+			sockf6 = socket(AF_INET6, SOCK_DGRAM, 0);
+		memset(&ifr6, 0, sizeof(ifr6));
+		memcpy(&ifr6.ifr_name, &ifr->ifr_name, sizeof(ifr6.ifr_name));
+		memcpy(&ifr6.ifr_addr, &ifr->ifr_addr, sizeof(ifr6.ifr_addr));
+		if (ioctl(sockf6, SIOCGIFAFLAG_IN6, &ifr6) < 0)
+			goto gotError;
+		if (ifr6.ifr_ifru.ifru_flags6 &
+		(IN6_IFF_NOTREADY | IN6_IFF_DETACHED))
+			continue;
+	}
+#endif
+
 ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info));
 if (ifi == NULL) {
 goto gotError;



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 25 19:22:42 UTC 2018

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

Log Message:
zero out socket structures before bind.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
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.13 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.14
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.13	Wed Jan 17 01:10:27 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Sun Feb 25 14:22:41 2018
@@ -745,6 +745,10 @@ mDNSlocal int SetupSocket(struct sockadd
 // And start listening for packets
 if (err == 0)
 {
+	mDNSPlatformMemZero(&bindAddr, sizeof(bindAddr));
+#ifndef NOT_HAVE_SA_LEN
+	bindAddr.sin_len = sizeof(bindAddr);
+#endif
 bindAddr.sin_family  = AF_INET;
 bindAddr.sin_port= port.NotAnInteger;
 bindAddr.sin_addr.s_addr = INADDR_ANY; // Want to receive multicasts AND unicasts on this socket
@@ -1054,6 +1058,9 @@ mDNSlocal mStatus OpenIfNotifySocket(int
 
 /* Subscribe the socket to Link & IP addr notifications. */
 mDNSPlatformMemZero(&snl, sizeof snl);
+#ifndef NOT_HAVE_SA_LEN
+snl.nl_len= sizeof(snl);
+#endif
 snl.nl_family = AF_NETLINK;
 snl.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR;
 ret = bind(sock, (struct sockaddr *) &snl, sizeof snl);
@@ -1266,6 +1273,11 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanR
 int err;
 int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
 struct sockaddr_in s5353;
+
+mDNSPlatformMemZero(&s5353, sizeof(s5353));
+#ifndef NOT_HAVE_SA_LEN
+s5353.sin_len = sizeof(s5353);
+#endif
 s5353.sin_family  = AF_INET;
 s5353.sin_port= MulticastDNSPort.NotAnInteger;
 s5353.sin_addr.s_addr = 0;



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-10-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 15 16:14:40 UTC 2015

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

Log Message:
Add support for parsing IPv6 nameservers found in resolv.conf.
Fixes PR bin/42196.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
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.9 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.10
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.9	Mon Oct 12 09:29:25 2015
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Thu Oct 15 16:14:40 2015
@@ -494,10 +494,11 @@ mDNSexport int ParseDNSServers(mDNS *m, 
 	while (fgets(line,sizeof(line),fp))
 		{
 		struct in_addr ina;
+		struct in6_addr ina6;
 		line[255]='\0';		// just to be safe
 		if (sscanf(line,"%10s %15s", keyword, nameserver) != 2) continue;	// it will skip whitespaces
 		if (strncasecmp(keyword,"nameserver",10)) continue;
-		if (inet_aton(nameserver, (struct in_addr *)&ina) != 0)
+		if (inet_pton(AF_INET, nameserver, &ina) == 1)
 			{
 			mDNSAddr DNSAddr;
 			DNSAddr.type = mDNSAddrType_IPv4;
@@ -505,7 +506,15 @@ mDNSexport int ParseDNSServers(mDNS *m, 
 			mDNS_AddDNSServer(m, NULL, mDNSInterface_Any, &DNSAddr, UnicastDNSPort, mDNSfalse, 0);
 			numOfServers++;
 			}
-		}  
+		else if (inet_pton(AF_INET6, nameserver, &ina6) == 1)
+			{
+			mDNSAddr DNSAddr;
+			DNSAddr.type = mDNSAddrType_IPv6;
+			DNSAddr.ip.v6 = *(mDNSv6Addr *)&ina6;
+			mDNS_AddDNSServer(m, NULL, mDNSInterface_Any, &DNSAddr, UnicastDNSPort, mDNSfalse, 0);
+			numOfServers++;
+			}
+		}
 	fclose(fp);
 	return (numOfServers > 0) ? 0 : -1;
 	}



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-10-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 15 10:15:19 UTC 2015

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

Log Message:
Starting and stopping should be informational messages to avoid console
spam.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
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.6 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.7
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.6	Mon Mar 24 00:31:13 2014
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Thu Oct 15 10:15:18 2015
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
 
 	ParseCmdLinArgs(argc, argv);
 
-	LogMsg("%s starting", mDNSResponderVersionString);
+	LogInfo("%s starting", mDNSResponderVersionString);
 
 	err = mDNS_Init(&mDNSStorage, &PlatformStorage, gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses, 
 	mDNS_StatusCallback, mDNS_Init_NoInitCallbackContext); 
@@ -265,7 +265,7 @@ int main(int argc, char **argv)
 	if (mStatus_NoError == err)
 		err = MainLoop(&mDNSStorage);
  
-	LogMsg("%s stopping", mDNSResponderVersionString);
+	LogInfo("%s stopping", mDNSResponderVersionString);
 
 	mDNS_Close(&mDNSStorage);
 



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 09:29:25 UTC 2015

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

Log Message:
A lack of useable addresses on any interfaces is not an error.
More interfaces and/or useable addresses could be added later.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
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.8 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.9
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.8	Mon Oct 12 09:26:38 2015
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Mon Oct 12 09:29:25 2015
@@ -921,7 +921,9 @@ mDNSlocal int SetupInterfaceList(mDNS *c
 	assert(m != NULL);
 	debugf("SetupInterfaceList");
 
-	if (intfList == NULL) err = ENOENT;
+	/* More interfaces, or usableable addresses to existing interfaces
+	 * could be added later. */
+	if (intfList == NULL) return 0;
 
 #if HAVE_IPV6
 	if (err == 0)		/* Link the IPv6 list to the end of the IPv4 list */



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 09:28:15 UTC 2015

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

Log Message:
Ignore loopback interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.6 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.7
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.6	Wed Jun 10 16:32:42 2015
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Mon Oct 12 09:28:15 2015
@@ -277,6 +277,8 @@ struct ifi_info *get_ifi_info(int family
 flags = ifrcopy.ifr_flags;
 if ((flags & IFF_UP) == 0)
 continue;   /* ignore if interface not up */
+	if ((flags & IFF_LOOPBACK))
+	continue;	/* ignore loopback interfaces */
 
 	/* Skip addresses we can't use */
 #ifdef SIOCGIFAFLAG_IN



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Oct 12 09:26:38 UTC 2015

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

Log Message:
Use clock_gettime as a more accurate time source.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
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.7 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.8
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.7	Sat Dec 20 13:15:48 2014
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Mon Oct 12 09:26:38 2015
@@ -1411,6 +1411,11 @@ mDNSexport mStatus mDNSPlatformTimeInit(
 
 mDNSexport mDNSs32  mDNSPlatformRawTime()
 	{
+#ifdef CLOCK_MONOTONIC
+	struct timespec tv;
+	clock_gettime(CLOCK_MONOTONIC, &tv);
+	return((tv.tv_sec << 10) | ((tv.tv_nsec / 1000) * 16 / 15625));
+#else
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	// tv.tv_sec is seconds since 1st January 1970 (GMT, with no adjustment for daylight savings time)
@@ -1420,6 +1425,7 @@ mDNSexport mDNSs32  mDNSPlatformRawTime(
 	// This gives us a proper modular (cyclic) counter that has a resolution of roughly 1ms (actually 1/1024 second)
 	// and correctly cycles every 2^22 seconds (4194304 seconds = approx 48 days).
 	return((tv.tv_sec << 10) | (tv.tv_usec * 16 / 15625));
+#endif
 	}
 
 mDNSexport mDNSs32 mDNSPlatformUTC(void)



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-06-10 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 10 16:32:43 UTC 2015

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

Log Message:
Teach mdnsd about IN_IFF_NOTREADY and IN_IFF_DETACHED.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.5 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.6
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.5	Fri Jan 16 20:16:36 2015
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Wed Jun 10 16:32:42 2015
@@ -279,6 +279,15 @@ struct ifi_info *get_ifi_info(int family
 continue;   /* ignore if interface not up */
 
 	/* Skip addresses we can't use */
+#ifdef SIOCGIFAFLAG_IN
+	if (ifr->ifr_addr.sa_family == AF_INET) {
+		ifrcopy = *ifr;
+		if (ioctl(sockfd, SIOCGIFAFLAG_IN, &ifrcopy) < 0)
+			goto gotError;
+		if (ifrcopy.ifr_addrflags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
+			continue;
+	}
+#endif
 #ifdef SIOCGIFAFLAG_IN6
 if (ifr->ifr_addr.sa_family == AF_INET6) {
 		struct in6_ifreq ifr6;



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2015-01-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 16 20:16:37 UTC 2015

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

Log Message:
use calloc, remove cast.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.4 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.5
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.4	Sun Mar 23 20:31:13 2014
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Fri Jan 16 15:16:36 2015
@@ -221,7 +221,7 @@ struct ifi_info *get_ifi_info(int family
 lastlen = 0;
 len = 100 * sizeof(struct ifreq);   /* initial buffer size guess */
 for ( ; ; ) {
-buf = (char*)malloc(len);
+buf = calloc(len, 1);
 if (buf == NULL) {
 goto gotError;
 }



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2014-01-18 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Jan 18 16:51:44 UTC 2014

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

Log Message:
Don't try and use an address we can't use.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.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/mDNSUNP.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.2 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.3
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c:1.2	Tue Sep 29 23:56:28 2009
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSUNP.c	Sat Jan 18 16:51:44 2014
@@ -411,6 +411,24 @@ struct ifi_info *get_ifi_info(int family
 if ((flags & IFF_UP) == 0)
 continue;   /* ignore if interface not up */
 
+	/* Skip addresses we can't use */
+#ifdef SIOCGIFAFLAG_IN6
+if (ifr->ifr_addr.sa_family == AF_INET6) {
+		struct in6_ifreq ifr6;
+
+		if (sockf6 == -1)
+			sockf6 = socket(AF_INET6, SOCK_DGRAM, 0);
+		memset(&ifr6, 0, sizeof(ifr6));
+		memcpy(&ifr6.ifr_name, &ifr->ifr_name, sizeof(ifr6.ifr_name));
+		memcpy(&ifr6.ifr_addr, &ifr->ifr_addr, sizeof(ifr6.ifr_addr));
+		if (ioctl(sockf6, SIOCGIFAFLAG_IN6, &ifr6) < 0)
+			goto gotError;
+		if (ifr6.ifr_ifru.ifru_flags6 &
+		(IN6_IFF_NOTREADY | IN6_IFF_DETACHED))
+			continue;
+	}
+#endif
+
 ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info));
 if (ifi == NULL) {
 goto gotError;



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2009-10-23 Thread Ty Sarna
Module Name:src
Committed By:   tsarna
Date:   Sat Oct 24 04:04:40 UTC 2009

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

Log Message:
Add interface list dump to debugging output.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
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.3 src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.4
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c:1.3	Sat Oct  3 00:03:05 2009
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/PosixDaemon.c	Sat Oct 24 04:04:40 2009
@@ -183,10 +183,24 @@
 // Dump a little log of what we've been up to.
 	{
 	DNSServer *s;
+PosixNetworkInterface *i;
 
 	LogMsg(" BEGIN STATE LOG ");
 	udsserver_info(m);
 
+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 (!mDNSStorage.DNSServers) LogMsgNoIdent("");
 else



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2009-10-18 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Sun Oct 18 11:54:37 UTC 2009

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

Log Message:
Fix off by one in parser for "/etc/resolv.conf" found by SSP.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
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.3 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.4
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.3	Thu Oct  1 16:36:20 2009
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Sun Oct 18 11:54:37 2009
@@ -581,7 +581,7 @@
 	{
 	char line[256];
 	char nameserver[16];
-	char keyword[10];
+	char keyword[11];
 	int  numOfServers = 0;
 	FILE *fp = fopen(filePath, "r");
 	if (fp == NULL) return -1;