mdnsresponder: update to 561.1.1

Signed-off-by: Steven Barth <steven@midlink.org>
This commit is contained in:
Steven Barth 2014-12-17 10:48:09 +01:00
parent f0e61a423c
commit d2164b89cb
3 changed files with 63 additions and 76 deletions

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mDNSResponder PKG_NAME:=mDNSResponder
PKG_VERSION:=544 PKG_VERSION:=561.1.1
PKG_RELEASE:=4 PKG_RELEASE:=1
PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://opensource.apple.com/tarballs/mDNSResponder/ PKG_SOURCE_URL:=http://opensource.apple.com/tarballs/mDNSResponder/
PKG_MD5SUM:=39142ab70bd82a096801ce346f86cbab PKG_MD5SUM:=d4b56e22798d6f45e29b42cd6720ab6e
PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org> PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
PKG_LICENSE:=Apache-2.0 PKG_LICENSE:=Apache-2.0

View file

@ -1,6 +1,3 @@
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..920cdfc
--- /dev/null --- /dev/null
+++ b/.gitignore +++ b/.gitignore
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
@ -8,8 +5,6 @@ index 0000000..920cdfc
+mDNSPosix/build +mDNSPosix/build
+mDNSPosix/objects +mDNSPosix/objects
+ +
diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c
index 88b3292..e86a6c7 100644
--- a/mDNSPosix/PosixDaemon.c --- a/mDNSPosix/PosixDaemon.c
+++ b/mDNSPosix/PosixDaemon.c +++ b/mDNSPosix/PosixDaemon.c
@@ -37,6 +37,11 @@ @@ -37,6 +37,11 @@
@ -75,11 +70,9 @@ index 88b3292..e86a6c7 100644
if (mStatus_NoError == err) if (mStatus_NoError == err)
err = MainLoop(&mDNSStorage); err = MainLoop(&mDNSStorage);
diff --git a/mDNSPosix/Responder.c b/mDNSPosix/Responder.c
index 3996b7b..e58d8eb 100755
--- a/mDNSPosix/Responder.c --- a/mDNSPosix/Responder.c
+++ b/mDNSPosix/Responder.c +++ b/mDNSPosix/Responder.c
@@ -603,7 +603,8 @@ static mStatus RegisterServicesInFile(const char *filePath) @@ -603,7 +603,8 @@ static mStatus RegisterServicesInFile(co
status = mStatus_UnknownErr; status = mStatus_UnknownErr;
} }
@ -89,11 +82,9 @@ index 3996b7b..e58d8eb 100755
return status; return status;
} }
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
index 953bf64..4e481ea 100755
--- a/mDNSPosix/mDNSPosix.c --- a/mDNSPosix/mDNSPosix.c
+++ b/mDNSPosix/mDNSPosix.c +++ b/mDNSPosix/mDNSPosix.c
@@ -136,7 +136,7 @@ mDNSlocal void SockAddrTomDNSAddr(const struct sockaddr *const sa, mDNSAddr *ipA @@ -136,7 +136,7 @@ mDNSlocal void SockAddrTomDNSAddr(const
// mDNS core calls this routine when it needs to send a packet. // mDNS core calls this routine when it needs to send a packet.
mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const msg, const mDNSu8 *const end, mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const msg, const mDNSu8 *const end,
@ -102,7 +93,7 @@ index 953bf64..4e481ea 100755
mDNSIPPort dstPort, mDNSBool useBackgroundTrafficClass) mDNSIPPort dstPort, mDNSBool useBackgroundTrafficClass)
{ {
int err = 0; int err = 0;
@@ -574,9 +574,17 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) @@ -574,9 +574,17 @@ mDNSlocal void FreePosixNetworkInterface
{ {
assert(intf != NULL); assert(intf != NULL);
if (intf->intfName != NULL) free((void *)intf->intfName); if (intf->intfName != NULL) free((void *)intf->intfName);
@ -122,7 +113,7 @@ index 953bf64..4e481ea 100755
#endif #endif
free(intf); free(intf);
} }
@@ -703,6 +711,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf @@ -703,6 +711,29 @@ mDNSlocal int SetupSocket(struct sockadd
if (err < 0) { err = errno; perror("setsockopt - IP_MULTICAST_TTL"); } if (err < 0) { err = errno; perror("setsockopt - IP_MULTICAST_TTL"); }
} }
@ -152,7 +143,7 @@ index 953bf64..4e481ea 100755
// And start listening for packets // And start listening for packets
if (err == 0) if (err == 0)
{ {
@@ -784,6 +815,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf @@ -784,6 +815,29 @@ mDNSlocal int SetupSocket(struct sockadd
if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); } if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); }
} }
@ -182,7 +173,7 @@ index 953bf64..4e481ea 100755
// And start listening for packets // And start listening for packets
if (err == 0) if (err == 0)
{ {
@@ -815,7 +869,12 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf @@ -815,7 +869,12 @@ mDNSlocal int SetupSocket(struct sockadd
} }
// Clean up // Clean up
@ -196,7 +187,7 @@ index 953bf64..4e481ea 100755
assert((err == 0) == (*sktPtr != -1)); assert((err == 0) == (*sktPtr != -1));
return err; return err;
} }
@@ -994,7 +1053,7 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) @@ -994,7 +1053,7 @@ mDNSlocal mStatus OpenIfNotifySocket(int
/* Subscribe the socket to Link & IP addr notifications. */ /* Subscribe the socket to Link & IP addr notifications. */
mDNSPlatformMemZero(&snl, sizeof snl); mDNSPlatformMemZero(&snl, sizeof snl);
snl.nl_family = AF_NETLINK; snl.nl_family = AF_NETLINK;
@ -205,7 +196,7 @@ index 953bf64..4e481ea 100755
ret = bind(sock, (struct sockaddr *) &snl, sizeof snl); ret = bind(sock, (struct sockaddr *) &snl, sizeof snl);
if (0 == ret) if (0 == ret)
*pFD = sock; *pFD = sock;
@@ -1072,11 +1131,18 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) @@ -1072,11 +1131,18 @@ mDNSlocal mDNSu32 ProcessRoutingNo
PrintNetLinkMsg(pNLMsg); PrintNetLinkMsg(pNLMsg);
#endif #endif
@ -226,7 +217,7 @@ index 953bf64..4e481ea 100755
// Advance pNLMsg to the next message in the buffer // Advance pNLMsg to the next message in the buffer
if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE)
@@ -1247,8 +1313,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS *const m) @@ -1247,8 +1313,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS
if (err == mStatus_NoError) err = SetupSocket(&sa, zeroIPPort, 0, &m->p->unicastSocket6); if (err == mStatus_NoError) err = SetupSocket(&sa, zeroIPPort, 0, &m->p->unicastSocket6);
#endif #endif
@ -239,7 +230,7 @@ index 953bf64..4e481ea 100755
// Tell mDNS core about DNS Servers // Tell mDNS core about DNS Servers
mDNS_Lock(m); mDNS_Lock(m);
@@ -1281,9 +1351,17 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) @@ -1281,9 +1351,17 @@ mDNSexport void mDNSPlatformClose(mDNS *
{ {
assert(m != NULL); assert(m != NULL);
ClearInterfaceList(m); ClearInterfaceList(m);
@ -259,7 +250,7 @@ index 953bf64..4e481ea 100755
#endif #endif
} }
@@ -1533,14 +1611,14 @@ mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void) @@ -1533,14 +1611,14 @@ mDNSexport mStatus mDNSPlatformClearS
mDNSexport mDNSu16 mDNSPlatformGetUDPPort(UDPSocket *sock) mDNSexport mDNSu16 mDNSPlatformGetUDPPort(UDPSocket *sock)
{ {
(void) sock; // unused (void) sock; // unused
@ -276,8 +267,6 @@ index 953bf64..4e481ea 100755
return mDNSfalse; return mDNSfalse;
} }
diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c
index b392fc7..9f85e0e 100755
--- a/mDNSPosix/mDNSUNP.c --- a/mDNSPosix/mDNSUNP.c
+++ b/mDNSPosix/mDNSUNP.c +++ b/mDNSPosix/mDNSUNP.c
@@ -61,154 +61,86 @@ @@ -61,154 +61,86 @@
@ -286,7 +275,9 @@ index b392fc7..9f85e0e 100755
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
-#include <netdb.h> -#include <netdb.h>
-#include <arpa/inet.h> -#include <arpa/inet.h>
- +#include <sys/types.h>
+#include <ifaddrs.h>
-/* Converts a prefix length to IPv6 network mask */ -/* Converts a prefix length to IPv6 network mask */
-void plen_to_mask(int plen, char *addr) { -void plen_to_mask(int plen, char *addr) {
- int i; - int i;
@ -301,9 +292,6 @@ index b392fc7..9f85e0e 100755
- plen -= ones_in_block; - plen -= ones_in_block;
- } - }
-} -}
+#include <sys/types.h>
+#include <ifaddrs.h>
+
-/* Gets IPv6 interface information from the /proc filesystem in linux*/ -/* Gets IPv6 interface information from the /proc filesystem in linux*/
-struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) -struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
@ -330,45 +318,12 @@ index b392fc7..9f85e0e 100755
- ifihead = NULL; - ifihead = NULL;
- ifipnext = &ifihead; - ifipnext = &ifihead;
- lastname[0] = 0; - lastname[0] = 0;
+ struct ifaddrs *ifap, *ifa; -
+ struct ifi_info *ifi = NULL, *head = NULL;
- if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) { - if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) {
- sockfd = socket(AF_INET6, SOCK_DGRAM, 0); - sockfd = socket(AF_INET6, SOCK_DGRAM, 0);
- if (sockfd < 0) { - if (sockfd < 0) {
- goto gotError; - goto gotError;
+ /* doaliases seems always true in the calls in current code */ - }
+ assert(doaliases);
+
+ if (getifaddrs(&ifap) < 0)
+ {
+ return NULL;
+ }
+ for (ifa = ifap ; ifa ; ifa = ifa->ifa_next)
+ {
+ /* Care only about IPv6 addresses on non-point-to-point links. */
+ if (!ifa->ifa_addr
+ || ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
+ ifi = calloc(1, sizeof(*ifi));
+ if (!ifi)
+ break;
+ strncpy(ifi->ifi_name, ifa->ifa_name, IFI_NAME);
+ /* We ignore ifi_{haddr,hlen}, everyone else does too */
+ ifi->ifi_flags = ifa->ifa_flags;
+ /* We ignore ifi_myflags; IFI_ALIAS isn't used anywhere */
+ ifi->ifi_index = if_nametoindex(ifa->ifa_name);
+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6))))
+ break;
+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
+
+ if (ifa->ifa_netmask)
+ {
+ if (!(ifi->ifi_netmask = malloc(sizeof(struct sockaddr_in6))))
+ break;
+ memcpy(ifi->ifi_netmask, ifa->ifa_netmask,
+ sizeof(struct sockaddr_in6));
}
- while (fscanf(fp, - while (fscanf(fp,
- "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n", - "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n",
- addr[0],addr[1],addr[2],addr[3], - addr[0],addr[1],addr[2],addr[3],
@ -386,7 +341,7 @@ index b392fc7..9f85e0e 100755
- if (ifi == NULL) { - if (ifi == NULL) {
- goto gotError; - goto gotError;
- } - }
-
- ifipold = *ifipnext; /* need this later */ - ifipold = *ifipnext; /* need this later */
- ifiptr = ifipnext; - ifiptr = ifipnext;
- *ifipnext = ifi; /* prev points to this new one */ - *ifipnext = ifi; /* prev points to this new one */
@ -409,10 +364,7 @@ index b392fc7..9f85e0e 100755
- goto gotError; - goto gotError;
- } - }
- memcpy(ifi->ifi_addr, res0->ai_addr, sizeof(struct sockaddr_in6)); - memcpy(ifi->ifi_addr, res0->ai_addr, sizeof(struct sockaddr_in6));
+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6)))) -
+ break;
+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
- /* Add netmask of the interface */ - /* Add netmask of the interface */
- char ipv6addr[INET6_ADDRSTRLEN]; - char ipv6addr[INET6_ADDRSTRLEN];
- plen_to_mask(plen, ipv6addr); - plen_to_mask(plen, ipv6addr);
@ -460,6 +412,8 @@ index b392fc7..9f85e0e 100755
- } - }
- } - }
- goto done; - goto done;
+ struct ifaddrs *ifap, *ifa;
+ struct ifi_info *ifi = NULL, *head = NULL;
-gotError: -gotError:
- if (ifihead != NULL) { - if (ifihead != NULL) {
@ -469,10 +423,47 @@ index b392fc7..9f85e0e 100755
- if (res0 != NULL) { - if (res0 != NULL) {
- freeaddrinfo(res0); - freeaddrinfo(res0);
- res0=NULL; - res0=NULL;
- } + /* doaliases seems always true in the calls in current code */
+ assert(doaliases);
+
+ if (getifaddrs(&ifap) < 0)
+ {
+ return NULL;
}
-done: -done:
- if (sockfd != -1) { - if (sockfd != -1) {
- assert(close(sockfd) == 0); - assert(close(sockfd) == 0);
+ for (ifa = ifap ; ifa ; ifa = ifa->ifa_next)
+ {
+ /* Care only about IPv6 addresses on non-point-to-point links. */
+ if (!ifa->ifa_addr
+ || ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
+ ifi = calloc(1, sizeof(*ifi));
+ if (!ifi)
+ break;
+ strncpy(ifi->ifi_name, ifa->ifa_name, IFI_NAME);
+ /* We ignore ifi_{haddr,hlen}, everyone else does too */
+ ifi->ifi_flags = ifa->ifa_flags;
+ /* We ignore ifi_myflags; IFI_ALIAS isn't used anywhere */
+ ifi->ifi_index = if_nametoindex(ifa->ifa_name);
+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6))))
+ break;
+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
+
+ if (ifa->ifa_netmask)
+ {
+ if (!(ifi->ifi_netmask = malloc(sizeof(struct sockaddr_in6))))
+ break;
+ memcpy(ifi->ifi_netmask, ifa->ifa_netmask,
+ sizeof(struct sockaddr_in6));
+ }
+
+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6))))
+ break;
+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
+
+
+ if (ifa->ifa_flags & IFF_POINTOPOINT && ifa->ifa_dstaddr) + if (ifa->ifa_flags & IFF_POINTOPOINT && ifa->ifa_dstaddr)
+ { + {
+ if (!(ifi->ifi_dstaddr = malloc(sizeof(struct sockaddr_in6)))) + if (!(ifi->ifi_dstaddr = malloc(sizeof(struct sockaddr_in6))))
@ -506,7 +497,7 @@ index b392fc7..9f85e0e 100755
#endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX #endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
struct ifi_info *get_ifi_info(int family, int doaliases) struct ifi_info *get_ifi_info(int family, int doaliases)
@@ -229,7 +161,7 @@ struct ifi_info *get_ifi_info(int family, int doaliases) @@ -229,7 +161,7 @@ struct ifi_info *get_ifi_info(int family
#endif #endif
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
@ -515,8 +506,6 @@ index b392fc7..9f85e0e 100755
#endif #endif
sockfd = -1; sockfd = -1;
diff --git a/mDNSPosix/mDNSUNP.h b/mDNSPosix/mDNSUNP.h
index cc81b7d..e710087 100755
--- a/mDNSPosix/mDNSUNP.h --- a/mDNSPosix/mDNSUNP.h
+++ b/mDNSPosix/mDNSUNP.h +++ b/mDNSPosix/mDNSUNP.h
@@ -97,8 +97,7 @@ struct ifi_info { @@ -97,8 +97,7 @@ struct ifi_info {
@ -529,8 +518,6 @@ index cc81b7d..e710087 100755
#endif #endif
#if defined(AF_INET6) && HAVE_IPV6 #if defined(AF_INET6) && HAVE_IPV6
diff --git a/mDNSShared/dnsextd_parser.y b/mDNSShared/dnsextd_parser.y
index 18c5990..d4b63ce 100644
--- a/mDNSShared/dnsextd_parser.y --- a/mDNSShared/dnsextd_parser.y
+++ b/mDNSShared/dnsextd_parser.y +++ b/mDNSShared/dnsextd_parser.y
@@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@