From d2164b89cbe1299e09a4a5dee49481a3e80892e2 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 17 Dec 2014 10:48:09 +0100 Subject: [PATCH] mdnsresponder: update to 561.1.1 Signed-off-by: Steven Barth --- net/mdnsresponder/Makefile | 6 +- .../patches/001-cross_compile.patch | 2 +- .../patches/100-linux_fixes.patch | 131 ++++++++---------- 3 files changed, 63 insertions(+), 76 deletions(-) diff --git a/net/mdnsresponder/Makefile b/net/mdnsresponder/Makefile index 50a3c4280..98967a34c 100644 --- a/net/mdnsresponder/Makefile +++ b/net/mdnsresponder/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mDNSResponder -PKG_VERSION:=544 -PKG_RELEASE:=4 +PKG_VERSION:=561.1.1 +PKG_RELEASE:=1 PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://opensource.apple.com/tarballs/mDNSResponder/ -PKG_MD5SUM:=39142ab70bd82a096801ce346f86cbab +PKG_MD5SUM:=d4b56e22798d6f45e29b42cd6720ab6e PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=Apache-2.0 diff --git a/net/mdnsresponder/patches/001-cross_compile.patch b/net/mdnsresponder/patches/001-cross_compile.patch index f824d5e26..ad4eaee44 100644 --- a/net/mdnsresponder/patches/001-cross_compile.patch +++ b/net/mdnsresponder/patches/001-cross_compile.patch @@ -56,7 +56,7 @@ LINKOPTS = -lsocket -lnsl -lresolv JAVACFLAGS_OS += -I$(JDK)/include/solaris ifneq ($(DEBUG),1) -@@ -147,7 +148,8 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp +@@ -147,7 +148,8 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -D__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4 \ -D__APPLE_USE_RFC_2292 #-Wunreachable-code CC = gcc diff --git a/net/mdnsresponder/patches/100-linux_fixes.patch b/net/mdnsresponder/patches/100-linux_fixes.patch index 851dd31df..ea598a75d 100644 --- a/net/mdnsresponder/patches/100-linux_fixes.patch +++ b/net/mdnsresponder/patches/100-linux_fixes.patch @@ -1,6 +1,3 @@ -diff --git a/.gitignore b/.gitignore -new file mode 100644 -index 0000000..920cdfc --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ @@ -8,8 +5,6 @@ index 0000000..920cdfc +mDNSPosix/build +mDNSPosix/objects + -diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c -index 88b3292..e86a6c7 100644 --- a/mDNSPosix/PosixDaemon.c +++ b/mDNSPosix/PosixDaemon.c @@ -37,6 +37,11 @@ @@ -75,11 +70,9 @@ index 88b3292..e86a6c7 100644 if (mStatus_NoError == err) err = MainLoop(&mDNSStorage); -diff --git a/mDNSPosix/Responder.c b/mDNSPosix/Responder.c -index 3996b7b..e58d8eb 100755 --- a/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; } @@ -89,11 +82,9 @@ index 3996b7b..e58d8eb 100755 return status; } -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 953bf64..4e481ea 100755 --- a/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. 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) { int err = 0; -@@ -574,9 +574,17 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) +@@ -574,9 +574,17 @@ mDNSlocal void FreePosixNetworkInterface { assert(intf != NULL); if (intf->intfName != NULL) free((void *)intf->intfName); @@ -122,7 +113,7 @@ index 953bf64..4e481ea 100755 #endif 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"); } } @@ -152,7 +143,7 @@ index 953bf64..4e481ea 100755 // And start listening for packets 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"); } } @@ -182,7 +173,7 @@ index 953bf64..4e481ea 100755 // And start listening for packets 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 @@ -196,7 +187,7 @@ index 953bf64..4e481ea 100755 assert((err == 0) == (*sktPtr != -1)); 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. */ mDNSPlatformMemZero(&snl, sizeof snl); snl.nl_family = AF_NETLINK; @@ -205,7 +196,7 @@ index 953bf64..4e481ea 100755 ret = bind(sock, (struct sockaddr *) &snl, sizeof snl); if (0 == ret) *pFD = sock; -@@ -1072,11 +1131,18 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) +@@ -1072,11 +1131,18 @@ mDNSlocal mDNSu32 ProcessRoutingNo PrintNetLinkMsg(pNLMsg); #endif @@ -226,7 +217,7 @@ index 953bf64..4e481ea 100755 // Advance pNLMsg to the next message in the buffer 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); #endif @@ -239,7 +230,7 @@ index 953bf64..4e481ea 100755 // Tell mDNS core about DNS Servers mDNS_Lock(m); -@@ -1281,9 +1351,17 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) +@@ -1281,9 +1351,17 @@ mDNSexport void mDNSPlatformClose(mDNS * { assert(m != NULL); ClearInterfaceList(m); @@ -259,7 +250,7 @@ index 953bf64..4e481ea 100755 #endif } -@@ -1533,14 +1611,14 @@ mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void) +@@ -1533,14 +1611,14 @@ mDNSexport mStatus mDNSPlatformClearS mDNSexport mDNSu16 mDNSPlatformGetUDPPort(UDPSocket *sock) { (void) sock; // unused @@ -276,8 +267,6 @@ index 953bf64..4e481ea 100755 return mDNSfalse; } -diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c -index b392fc7..9f85e0e 100755 --- a/mDNSPosix/mDNSUNP.c +++ b/mDNSPosix/mDNSUNP.c @@ -61,154 +61,86 @@ @@ -286,7 +275,9 @@ index b392fc7..9f85e0e 100755 #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX -#include -#include -- ++#include ++#include + -/* Converts a prefix length to IPv6 network mask */ -void plen_to_mask(int plen, char *addr) { - int i; @@ -301,9 +292,6 @@ index b392fc7..9f85e0e 100755 - plen -= ones_in_block; - } -} -+#include -+#include -+ -/* Gets IPv6 interface information from the /proc filesystem in linux*/ -struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases) @@ -330,45 +318,12 @@ index b392fc7..9f85e0e 100755 - ifihead = NULL; - ifipnext = &ifihead; - lastname[0] = 0; -+ struct ifaddrs *ifap, *ifa; -+ struct ifi_info *ifi = NULL, *head = NULL; - +- - if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) { - sockfd = socket(AF_INET6, SOCK_DGRAM, 0); - if (sockfd < 0) { - 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, - "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n", - addr[0],addr[1],addr[2],addr[3], @@ -386,7 +341,7 @@ index b392fc7..9f85e0e 100755 - if (ifi == NULL) { - goto gotError; - } - +- - ifipold = *ifipnext; /* need this later */ - ifiptr = ifipnext; - *ifipnext = ifi; /* prev points to this new one */ @@ -409,10 +364,7 @@ index b392fc7..9f85e0e 100755 - goto gotError; - } - 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 */ - char ipv6addr[INET6_ADDRSTRLEN]; - plen_to_mask(plen, ipv6addr); @@ -460,6 +412,8 @@ index b392fc7..9f85e0e 100755 - } - } - goto done; ++ struct ifaddrs *ifap, *ifa; ++ struct ifi_info *ifi = NULL, *head = NULL; -gotError: - if (ifihead != NULL) { @@ -469,10 +423,47 @@ index b392fc7..9f85e0e 100755 - if (res0 != NULL) { - freeaddrinfo(res0); - res0=NULL; -- } ++ /* doaliases seems always true in the calls in current code */ ++ assert(doaliases); ++ ++ if (getifaddrs(&ifap) < 0) ++ { ++ return NULL; + } -done: - if (sockfd != -1) { - 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 (!(ifi->ifi_dstaddr = malloc(sizeof(struct sockaddr_in6)))) @@ -506,7 +497,7 @@ index b392fc7..9f85e0e 100755 #endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX 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 #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX @@ -515,8 +506,6 @@ index b392fc7..9f85e0e 100755 #endif sockfd = -1; -diff --git a/mDNSPosix/mDNSUNP.h b/mDNSPosix/mDNSUNP.h -index cc81b7d..e710087 100755 --- a/mDNSPosix/mDNSUNP.h +++ b/mDNSPosix/mDNSUNP.h @@ -97,8 +97,7 @@ struct ifi_info { @@ -529,8 +518,6 @@ index cc81b7d..e710087 100755 #endif #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 +++ b/mDNSShared/dnsextd_parser.y @@ -15,6 +15,8 @@