From: Rosen Penev Date: Mon, 16 Mar 2026 01:04:24 +0000 (-0700) Subject: mdnsresponder: update to 2881.0.25 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=79ae772593d54b4e761b1550b612f6158e3f3170;p=openwrt-packages.git mdnsresponder: update to 2881.0.25 Remove upstreamed patches and rework based on current openembedded patches. mdnsd now supports a -foreground parameter, which enables proper procd handling. It also supports SIGHUP reloading. Signed-off-by: Rosen Penev --- diff --git a/net/mdnsresponder/Makefile b/net/mdnsresponder/Makefile index 477fcc579..61ab599fa 100644 --- a/net/mdnsresponder/Makefile +++ b/net/mdnsresponder/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mDNSResponder -PKG_VERSION:=2200.100.94.0.2 -PKG_RELEASE:=2 +PKG_VERSION:=2881.0.25 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/apple-oss-distributions/mDNSResponder -PKG_MIRROR_HASH:=6d019ca318d189233b10e7d4a51ec6952547a87c3b81646c094021490d5990a7 +PKG_MIRROR_HASH:=876c5f449c6cca11febaab26abb53b1ffa2846f2af3e36b4e15efb116c9b83fa PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=Apache-2.0 @@ -86,7 +86,7 @@ endef # not found: MAKE_FLAGS += \ LD="$(TARGET_CC)" \ - CFLAGS_DEBUG="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + CFLAGS_DEBUG="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DMDNS_VERSIONSTR_NODTS=1" \ LINKOPTS=-lc \ LDCONFIG= \ ETCBASE="$(PKG_INSTALL_DIR)/etc" \ diff --git a/net/mdnsresponder/files/mdnsd.init b/net/mdnsresponder/files/mdnsd.init index 8f7393755..97d3579da 100755 --- a/net/mdnsresponder/files/mdnsd.init +++ b/net/mdnsresponder/files/mdnsd.init @@ -3,13 +3,16 @@ START=60 STOP=10 +PROG=/usr/sbin/mdnsd USE_PROCD=1 start_service() { - procd_open_instance - procd_set_param command /usr/sbin/mdnsd -debug - procd_set_param respawn - procd_set_param stderr 1 - procd_close_instance + procd_open_instance + procd_set_param command $PROG -foreground + procd_set_param respawn + procd_close_instance } +reload_service() { + procd_send_signal $PROG +} diff --git a/net/mdnsresponder/patches/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/net/mdnsresponder/patches/0001-Create-subroutine-for-cleaning-recent-interfaces.patch deleted file mode 100644 index 720cc4978..000000000 --- a/net/mdnsresponder/patches/0001-Create-subroutine-for-cleaning-recent-interfaces.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c1f3e19d3cb0aa948248616eb1684a1e80aa39b4 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH 1/8] Create subroutine for cleaning recent interfaces - -Moves functionality for cleaning the list of recent -interfaces into its own subroutine. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- - 1 file changed, 14 insertions(+), 10 deletions(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1322,6 +1322,19 @@ mDNSlocal int SetupSocket(struct sockadd - return err; - } - -+// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute -+mDNSlocal void CleanRecentInterfaces(void) -+{ -+ PosixNetworkInterface **ri = &gRecentInterfaces; -+ const mDNSs32 utc = mDNSPlatformUTC(); -+ while (*ri) -+ { -+ PosixNetworkInterface *pi = *ri; -+ if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; -+ else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } -+ } -+} -+ - // Creates a PosixNetworkInterface for the interface whose IP address is - // intfAddr and whose name is intfName and registers it with mDNS core. - mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, -@@ -1559,16 +1572,7 @@ mDNSlocal int SetupInterfaceList(mDNS *c - - // Clean up. - if (intfList != NULL) freeifaddrs(intfList); -- -- // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute -- PosixNetworkInterface **ri = &gRecentInterfaces; -- const mDNSs32 utc = mDNSPlatformUTC(); -- while (*ri) -- { -- PosixNetworkInterface *pi = *ri; -- if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; -- else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } -- } -+ CleanRecentInterfaces(); - - return err; - } diff --git a/net/mdnsresponder/patches/0001-Fix-SIGSEGV-during-DumpStateLog.patch b/net/mdnsresponder/patches/0001-Fix-SIGSEGV-during-DumpStateLog.patch deleted file mode 100644 index ea0e4dd40..000000000 --- a/net/mdnsresponder/patches/0001-Fix-SIGSEGV-during-DumpStateLog.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 14cc53bb09a3d8adf301f3842c765598467e63e1 Mon Sep 17 00:00:00 2001 -From: Alex Kiernan -Date: Thu, 1 Feb 2024 14:07:03 +0000 -Subject: [PATCH] Fix SIGSEGV during DumpStateLog() - -DumpStateLog() calls LogMsgWithLevelv() with category == NULL, avoid -crashing in this case. - -Upstream-Status: Inactive-Upstream [Upstream does not take patches] -Signed-off-by: Alex Kiernan ---- - mDNSShared/mDNSDebug.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/mDNSShared/mDNSDebug.c -+++ b/mDNSShared/mDNSDebug.c -@@ -71,7 +71,7 @@ mDNSlocal void LogMsgWithLevelv(os_log_t - mDNSlocal void LogMsgWithLevelv(const char *category, mDNSLogLevel_t level, const char *format, va_list args) - { - // Do not print the logs if the log category is MDNS_LOG_CATEGORY_DISABLED. -- if (strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) -+ if (category && strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) - { - return; - } diff --git a/net/mdnsresponder/patches/0001-Fix-build-with-gcc-15.patch b/net/mdnsresponder/patches/0001-Fix-build-with-gcc-15.patch new file mode 100644 index 000000000..5df2d8aa4 --- /dev/null +++ b/net/mdnsresponder/patches/0001-Fix-build-with-gcc-15.patch @@ -0,0 +1,32 @@ +From c84f185f29d0839b97177aecb0a78b9717947973 Mon Sep 17 00:00:00 2001 +From: Nguyen Dat Tho +Date: Wed, 9 Apr 2025 13:05:24 +0900 +Subject: [PATCH] Fix build with gcc-15 + +To fix error: +In file included from ../mDNSCore/mDNS.c:76: +../mDNSShared/CommonServices.h:856:13: error: 'bool' cannot be defined via 'typedef' + 856 | typedef int bool; + | ^~~~ +../mDNSShared/CommonServices.h:856:13: note: 'bool' is a keyword with '-std=c23' onwards +../mDNSShared/CommonServices.h:856:1: warning: useless type name in empty declaration + +Upstream-Status: Pending (An owner of this repository has limited the ability to open a pull request to users that are collaborators on this repository.) + +Signed-off-by: Nguyen Dat Tho +--- + mDNSShared/CommonServices.h | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/mDNSShared/CommonServices.h ++++ b/mDNSShared/CommonServices.h +@@ -192,6 +192,9 @@ extern "C" { + + #include + #include ++#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L ++ #include ++#endif + + #elif ( TARGET_OS_SOLARIS ) + diff --git a/net/mdnsresponder/patches/0002-Create-subroutine-for-tearing-down-an-interface.patch b/net/mdnsresponder/patches/0002-Create-subroutine-for-tearing-down-an-interface.patch deleted file mode 100644 index b572a4a5c..000000000 --- a/net/mdnsresponder/patches/0002-Create-subroutine-for-tearing-down-an-interface.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 40ef0241afbb49f84e76afd65eb3ee17466bb582 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH 2/8] Create subroutine for tearing down an interface - -Creates a subroutine for tearing down an interface. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1043,6 +1043,19 @@ mDNSlocal void FreePosixNetworkInterface - gRecentInterfaces = intf; - } - -+mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf) -+{ -+ mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); -+ if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); -+ FreePosixNetworkInterface(intf); -+ -+ num_registered_interfaces--; -+ if (num_registered_interfaces == 0) { -+ num_pkts_accepted = 0; -+ num_pkts_rejected = 0; -+ } -+} -+ - // Grab the first interface, deregister it, free it, and repeat until done. - mDNSlocal void ClearInterfaceList(mDNS *const m) - { -@@ -1051,13 +1064,10 @@ mDNSlocal void ClearInterfaceList(mDNS * - while (m->HostInterfaces) - { - PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); -- mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); -- if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); -- FreePosixNetworkInterface(intf); -+ TearDownInterface(m, intf); - } -- num_registered_interfaces = 0; -- num_pkts_accepted = 0; -- num_pkts_rejected = 0; -+ -+ assert(num_registered_interfaces == 0); - } - - mDNSlocal int SetupIPv6Socket(int fd) diff --git a/net/mdnsresponder/patches/0002-make-Set-libdns_sd.so-soname-correctly.patch b/net/mdnsresponder/patches/0002-make-Set-libdns_sd.so-soname-correctly.patch index f8550b530..6df5bac3d 100644 --- a/net/mdnsresponder/patches/0002-make-Set-libdns_sd.so-soname-correctly.patch +++ b/net/mdnsresponder/patches/0002-make-Set-libdns_sd.so-soname-correctly.patch @@ -19,4 +19,4 @@ Signed-off-by: Alex Kiernan + $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ $(STRIP) $@ - Clients: setup libdns_sd ../Clients/build/dns-sd + Clients: setup ../Clients/build/dns-sd diff --git a/net/mdnsresponder/patches/0003-Track-interface-socket-family.patch b/net/mdnsresponder/patches/0003-Track-interface-socket-family.patch deleted file mode 100644 index ec0367d0f..000000000 --- a/net/mdnsresponder/patches/0003-Track-interface-socket-family.patch +++ /dev/null @@ -1,44 +0,0 @@ -From deb3a2c51f32e0d2741be11a492e727129f770e2 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH 3/8] Track interface socket family - -Tracks the socket family associated with the interface. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 1 + - mDNSPosix/mDNSPosix.h | 2 ++ - 2 files changed, 3 insertions(+) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1415,6 +1415,7 @@ mDNSlocal int SetupOneInterface(mDNS *co - // Set up the extra fields in PosixNetworkInterface. - assert(intf->intfName != NULL); // intf->intfName already set up above - intf->index = intfIndex; -+ intf->sa_family = intfAddr->sa_family; - intf->multicastSocket4 = -1; - #if HAVE_IPV6 - intf->multicastSocket6 = -1; ---- a/mDNSPosix/mDNSPosix.h -+++ b/mDNSPosix/mDNSPosix.h -@@ -19,6 +19,7 @@ - #define __mDNSPlatformPosix_h - - #include -+#include - #include - - #ifdef __cplusplus -@@ -40,6 +41,7 @@ struct PosixNetworkInterface - char * intfName; - PosixNetworkInterface * aliasIntf; - int index; -+ sa_family_t sa_family; - int multicastSocket4; - #if HAVE_IPV6 - int multicastSocket6; diff --git a/net/mdnsresponder/patches/0004-Indicate-loopback-interface-to-mDNS-core.patch b/net/mdnsresponder/patches/0004-Indicate-loopback-interface-to-mDNS-core.patch deleted file mode 100644 index 5c7f381a6..000000000 --- a/net/mdnsresponder/patches/0004-Indicate-loopback-interface-to-mDNS-core.patch +++ /dev/null @@ -1,53 +0,0 @@ -From beab76b5708862f44d9acbe7a92db45e2f99259f Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Tue, 1 Aug 2017 17:06:01 -0500 -Subject: [PATCH 4/8] Indicate loopback interface to mDNS core - -Tells the mDNS core if an interface is a loopback interface, -similar to AddInterfaceToList() in the MacOS implementation. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1348,7 +1348,7 @@ mDNSlocal void CleanRecentInterfaces(voi - // Creates a PosixNetworkInterface for the interface whose IP address is - // intfAddr and whose name is intfName and registers it with mDNS core. - mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, -- const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex) -+ const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex, int intfFlags) - { - int err = 0; - PosixNetworkInterface *intf; -@@ -1411,6 +1411,7 @@ mDNSlocal int SetupOneInterface(mDNS *co - - intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; - intf->coreIntf.McastTxRx = mDNStrue; -+ intf->coreIntf.Loopback = ((intfFlags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; - - // Set up the extra fields in PosixNetworkInterface. - assert(intf->intfName != NULL); // intf->intfName already set up above -@@ -1561,7 +1562,7 @@ mDNSlocal int SetupInterfaceList(mDNS *c - } - #endif - if (SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, -- hwaddr, hwaddr_len, i->ifa_name, ifIndex) == 0) -+ hwaddr, hwaddr_len, i->ifa_name, ifIndex, i->ifa_flags) == 0) - { - if (i->ifa_addr->sa_family == AF_INET) - foundav4 = mDNStrue; -@@ -1578,7 +1579,7 @@ mDNSlocal int SetupInterfaceList(mDNS *c - // if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) - if (!foundav4 && firstLoopback) - (void) SetupOneInterface(m, firstLoopback->ifa_addr, firstLoopback->ifa_netmask, -- NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex); -+ NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex, firstLoopback->ifa_flags); - } - - // Clean up. diff --git a/net/mdnsresponder/patches/0005-Use-list-for-changed-interfaces.patch b/net/mdnsresponder/patches/0005-Use-list-for-changed-interfaces.patch deleted file mode 100644 index 99d7a510f..000000000 --- a/net/mdnsresponder/patches/0005-Use-list-for-changed-interfaces.patch +++ /dev/null @@ -1,164 +0,0 @@ -From e79f81f5cd626ad77ec64de4325f6645cf253c5e Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 13 Jul 2017 09:00:00 -0500 -Subject: [PATCH 5/8] Use list for changed interfaces - -Uses a linked list to store the index of changed network interfaces -instead of a bitfield. This allows for network interfaces with an -index greater than 31 (an index of 36 was seen on Android). - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 58 ++++++++++++++++++++++++++++++++----------- - 1 file changed, 43 insertions(+), 15 deletions(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -74,6 +74,14 @@ struct IfChangeRec - }; - typedef struct IfChangeRec IfChangeRec; - -+// Used to build a list of network interface indices -+struct NetworkInterfaceIndex -+{ -+ int if_index; -+ struct NetworkInterfaceIndex *Next; -+}; -+typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; -+ - // Note that static data is initialized to zero in (modern) C. - static PosixEventSource *gEventSources; // linked list of PosixEventSource's - static sigset_t gEventSignalSet; // Signals which event loop listens for -@@ -1621,6 +1629,23 @@ mDNSlocal mStatus OpenIfNotifySocket(int - return err; - } - -+mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) -+{ -+ NetworkInterfaceIndex *item; -+ -+ for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) -+ { -+ if (if_index == item->if_index) return; -+ } -+ -+ item = mdns_malloc(sizeof *item); -+ if (item == NULL) return; -+ -+ item->if_index = if_index; -+ item->Next = NULL; -+ AddToTail(list, item); -+} -+ - #if MDNS_DEBUGMSGS - mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) - { -@@ -1648,14 +1673,13 @@ mDNSlocal void PrintNetLinkMsg(cons - } - #endif - --mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) -+mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { - ssize_t readCount; - char buff[4096]; - struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; -- mDNSu32 result = 0; - - // The structure here is more complex than it really ought to be because, - // unfortunately, there's no good way to size a buffer in advance large -@@ -1691,9 +1715,9 @@ mDNSlocal mDNSu32 ProcessRoutingNo - - // Process the NetLink message - if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) -- result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); - else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) -- result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); - - // Advance pNLMsg to the next message in the buffer - if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) -@@ -1704,8 +1728,6 @@ mDNSlocal mDNSu32 ProcessRoutingNo - else - break; // all done! - } -- -- return result; - } - - #else // USES_NETLINK -@@ -1737,14 +1759,13 @@ mDNSlocal void PrintRoutingSocketMs - } - #endif - --mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) -+mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { - ssize_t readCount; - char buff[4096]; - struct ifa_msghdr *pRSMsg = (struct ifa_msghdr*) buff; -- mDNSu32 result = 0; - - readCount = read(sd, buff, sizeof buff); - if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) -@@ -1759,12 +1780,10 @@ mDNSlocal mDNSu32 ProcessRoutingNo - pRSMsg->ifam_type == RTM_IFINFO) - { - if (pRSMsg->ifam_type == RTM_IFINFO) -- result |= 1 << ((struct if_msghdr*) pRSMsg)->ifm_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct if_msghdr*) pRSMsg)->ifm_index); - else -- result |= 1 << pRSMsg->ifam_index; -+ AddInterfaceIndexToList(changedInterfaces, pRSMsg->ifam_index); - } -- -- return result; - } - - #endif // USES_NETLINK -@@ -1774,7 +1793,8 @@ mDNSlocal void InterfaceChangeCallback(i - { - IfChangeRec *pChgRec = (IfChangeRec*) context; - fd_set readFDs; -- mDNSu32 changedInterfaces = 0; -+ GenLinkedList changedInterfaces; -+ NetworkInterfaceIndex *changedInterface; - struct timeval zeroTimeout = { 0, 0 }; - - (void)fd; // Unused -@@ -1782,17 +1802,25 @@ mDNSlocal void InterfaceChangeCallback(i - FD_ZERO(&readFDs); - FD_SET(pChgRec->NotifySD, &readFDs); - -+ InitLinkedList(&changedInterfaces, offsetof(NetworkInterfaceIndex, Next)); -+ - do - { -- changedInterfaces |= ProcessRoutingNotification(pChgRec->NotifySD); -+ ProcessRoutingNotification(pChgRec->NotifySD, &changedInterfaces); - } - while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); - - // Currently we rebuild the entire interface list whenever any interface change is - // detected. If this ever proves to be a performance issue in a multi-homed - // configuration, more care should be paid to changedInterfaces. -- if (changedInterfaces) -+ if (changedInterfaces.Head != NULL) - mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); -+ -+ while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) -+ { -+ RemoveFromList(&changedInterfaces, changedInterface); -+ mdns_free(changedInterface); -+ } - } - - // Register with either a Routing Socket or RtNetLink to listen for interface changes. diff --git a/net/mdnsresponder/patches/0005-mDNSCore-Fix-broken-debug-parameter.patch b/net/mdnsresponder/patches/0005-mDNSCore-Fix-broken-debug-parameter.patch index c1813d699..e7bdb2bfc 100644 --- a/net/mdnsresponder/patches/0005-mDNSCore-Fix-broken-debug-parameter.patch +++ b/net/mdnsresponder/patches/0005-mDNSCore-Fix-broken-debug-parameter.patch @@ -1,21 +1,20 @@ -From 764b6202402e9e5687ff873330e5ad6be6f69df7 Mon Sep 17 00:00:00 2001 +From e79f75487e32f87677519ec40c021b1623395bde Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Mon, 5 Dec 2022 22:49:49 +0000 Subject: [PATCH] mDNSCore: Fix broken debug parameter -Upstream-Status: Pending +Upstream-Status: Inactive-Upstream [Upstream does not take patches] Signed-off-by: Alex Kiernan - --- mDNSCore/mDNS.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mDNSCore/mDNS.c +++ b/mDNSCore/mDNS.c -@@ -10249,7 +10249,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastA - #else +@@ -9481,7 +9481,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastA + { + CacheRecord *negcr; const DNSServRef dnsserv = qptr->qDNSServer; - #endif - debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, currentQName, DNSTypeName(q.qtype)); + debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, currentQName->c, DNSTypeName(q.qtype)); // Create a negative record for the current name in the CNAME chain. diff --git a/net/mdnsresponder/patches/0007-Mark-deleted-interfaces-as-being-changed.patch b/net/mdnsresponder/patches/0007-Mark-deleted-interfaces-as-being-changed.patch deleted file mode 100644 index c0a6400c3..000000000 --- a/net/mdnsresponder/patches/0007-Mark-deleted-interfaces-as-being-changed.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a8accffb95267490b50401c8b65ec18db57b5ef5 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 9 Aug 2017 09:16:58 -0500 -Subject: [PATCH 7/8] Mark deleted interfaces as being changed - -Netlink notification handling ignores messages for deleted links, -RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- -mentation (http://www.infradead.org/~tgr/libnl/doc/route.html) -RTM_DELLINK can be sent by the kernel, but RTM_GETLINK cannot. -There was likely a mixup in the original implementation, so this -change replaces handling for RTM_GETLINK with RTM_DELLINK. - -Testing and Verification Instructions: - 1. Use ip-link to add and remove a VLAN interface and verify - that mDNSResponder handles the deleted link. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1714,7 +1714,7 @@ mDNSlocal void ProcessRoutingNo - #endif - - // Process the NetLink message -- if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) -+ if (pNLMsg->nlmsg_type == RTM_DELLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) - AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); - else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) - AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); diff --git a/net/mdnsresponder/patches/0008-Handle-errors-from-socket-calls.patch b/net/mdnsresponder/patches/0008-Handle-errors-from-socket-calls.patch deleted file mode 100644 index 97d8a7f68..000000000 --- a/net/mdnsresponder/patches/0008-Handle-errors-from-socket-calls.patch +++ /dev/null @@ -1,58 +0,0 @@ -From ed58146d3aeecdb9920fdc017f85c18b5b10f2db Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 10 Aug 2017 08:27:32 -0500 -Subject: [PATCH 8/8] Handle errors from socket calls - -Adds handling for socket() or read() returning a -negative value (indicating an error has occurred). - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens -Signed-off-by: Alex Kiernan ---- - mDNSPosix/mDNSPosix.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1677,7 +1677,7 @@ mDNSlocal void ProcessRoutingNo - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { -- ssize_t readCount; -+ ssize_t readVal, readCount; - char buff[4096]; - struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; - -@@ -1686,7 +1686,10 @@ mDNSlocal void ProcessRoutingNo - // enough to hold all pending data and so avoid message fragmentation. - // (Note that FIONREAD is not supported on AF_NETLINK.) - -- readCount = read(sd, buff, sizeof buff); -+ readVal = read(sd, buff, sizeof buff); -+ if (readVal < 0) return; -+ readCount = readVal; -+ - while (1) - { - // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. -@@ -1702,7 +1705,9 @@ mDNSlocal void ProcessRoutingNo - pNLMsg = (struct nlmsghdr*) buff; - - // read more data -- readCount += read(sd, buff + readCount, sizeof buff - readCount); -+ readVal = read(sd, buff + readCount, sizeof buff - readCount); -+ if (readVal < 0) return; -+ readCount += readVal; - continue; // spin around and revalidate with new readCount - } - else -@@ -1851,6 +1856,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanR - int err; - int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - struct sockaddr_in s5353; -+ if (s < 0) return mDNSfalse; - s5353.sin_family = AF_INET; - s5353.sin_port = MulticastDNSPort.NotAnInteger; - s5353.sin_addr.s_addr = 0; diff --git a/net/mdnsresponder/patches/0015-Add-missing-limits.h.patch b/net/mdnsresponder/patches/0015-Add-missing-limits.h.patch deleted file mode 100644 index 027d5c1ae..000000000 --- a/net/mdnsresponder/patches/0015-Add-missing-limits.h.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 9fc45a2cf3b78573a568abf538a6e6f4bd30b2d7 Mon Sep 17 00:00:00 2001 -From: Alex Kiernan -Date: Wed, 27 Sep 2023 11:45:26 +0100 -Subject: [PATCH] Add missing limits.h - -Upstream-Status: Pending -Signed-off-by: Alex Kiernan ---- - mDNSShared/PlatformCommon.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/mDNSShared/PlatformCommon.c -+++ b/mDNSShared/PlatformCommon.c -@@ -32,6 +32,7 @@ - #include - #include // Needed for #include (). - #include -+#include - - - #include "mDNSEmbeddedAPI.h" // Defines the interface provided to the client layer above diff --git a/net/mdnsresponder/patches/100-linux_fixes.patch b/net/mdnsresponder/patches/100-linux_fixes.patch index e775cfe4c..7302ec906 100644 --- a/net/mdnsresponder/patches/100-linux_fixes.patch +++ b/net/mdnsresponder/patches/100-linux_fixes.patch @@ -23,7 +23,7 @@ #if __APPLE__ #undef daemon -@@ -194,6 +199,18 @@ int main(int argc, char **argv) +@@ -210,6 +215,18 @@ int main(int argc, char **argv) Reconfigure(&mDNSStorage); @@ -42,7 +42,7 @@ // Now that we're finished with anything privileged, switch over to running as "nobody" if (mStatus_NoError == err) { -@@ -209,6 +226,21 @@ int main(int argc, char **argv) +@@ -225,6 +242,21 @@ int main(int argc, char **argv) { LogMsg("WARNING: mdnsd continuing as root because setuid to \"nobody\" failed with %s", strerror(errno)); } @@ -64,7 +64,7 @@ } else { -@@ -216,6 +248,11 @@ int main(int argc, char **argv) +@@ -232,6 +264,11 @@ int main(int argc, char **argv) } } @@ -78,7 +78,7 @@ --- a/mDNSPosix/mDNSPosix.c +++ b/mDNSPosix/mDNSPosix.c -@@ -1223,6 +1223,29 @@ mDNSlocal int SetupSocket(struct sockadd +@@ -1237,6 +1237,29 @@ mDNSlocal int SetupSocket(struct sockadd if (err < 0) { err = errno; perror("setsockopt - IP_MULTICAST_TTL"); } } @@ -108,7 +108,7 @@ // And start listening for packets if (err == 0) { -@@ -1298,6 +1321,29 @@ mDNSlocal int SetupSocket(struct sockadd +@@ -1312,6 +1335,29 @@ mDNSlocal int SetupSocket(struct sockadd if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); } } @@ -138,7 +138,7 @@ // And start listening for packets if (err == 0) { -@@ -1899,8 +1945,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS +@@ -1956,8 +2002,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS if (err == mStatus_NoError) err = SetupSocket(&sa, zeroIPPort, 0, &m->p->unicastSocket6); #endif @@ -149,8 +149,8 @@ if (err == mStatus_NoError) err = SetupInterfaceList(m); +#endif /* !__linux__ */ + #ifndef UNICAST_DISABLED // Tell mDNS core about DNS Servers - mDNS_Lock(m); --- a/mDNSShared/dnsextd_parser.y +++ b/mDNSShared/dnsextd_parser.y @@ -15,6 +15,8 @@ diff --git a/net/mdnsresponder/patches/120-reproducible-builds.patch b/net/mdnsresponder/patches/120-reproducible-builds.patch deleted file mode 100644 index d25972a0a..000000000 --- a/net/mdnsresponder/patches/120-reproducible-builds.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/Clients/dns-sd.c -+++ b/Clients/dns-sd.c -@@ -2463,7 +2463,7 @@ Fail: - // The "@(#) " pattern is a special prefix the "what" command looks for - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdate-time" -- const char VersionString_SCCS[] = "@(#) dns-sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; -+ const char VersionString_SCCS[] = "@(#) dns-sd " STRINGIFY(mDNSResponderVersion); - #pragma GCC diagnostic pop - - #if _BUILDING_XCODE_PROJECT_ ---- a/mDNSPosix/PosixDaemon.c -+++ b/mDNSPosix/PosixDaemon.c -@@ -308,9 +308,9 @@ asm (".desc ___crashreporter_info__, 0x1 - - // For convenience when using the "strings" command, this is the last thing in the file - #if mDNSResponderVersion > 1 --mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder-" STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; -+mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder-" STRINGIFY(mDNSResponderVersion); - #elif MDNS_VERSIONSTR_NODTS - mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder (Engineering Build)"; - #else --mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder (Engineering Build) (" __DATE__ " " __TIME__ ")"; -+mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder (Engineering Build)"; - #endif ---- a/mDNSShared/Java/JNISupport.c -+++ b/mDNSShared/Java/JNISupport.c -@@ -1069,4 +1069,4 @@ exit: - - // NOT static -- otherwise the compiler may optimize it out - // The "@(#) " pattern is a special prefix the "what" command looks for --const char VersionString_SCCS[] = "@(#) libjdns_sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; -+const char VersionString_SCCS[] = "@(#) libjdns_sd " STRINGIFY(mDNSResponderVersion); ---- a/mDNSShared/dnsextd.c -+++ b/mDNSShared/dnsextd.c -@@ -3132,7 +3132,7 @@ mDNS mDNSStorage; - - // For convenience when using the "strings" command, this is the last thing in the file - // The "@(#) " pattern is a special prefix the "what" command looks for --const char mDNSResponderVersionString_SCCS[] = "@(#) dnsextd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; -+const char mDNSResponderVersionString_SCCS[] = "@(#) dnsextd " STRINGIFY(mDNSResponderVersion); - - #if _BUILDING_XCODE_PROJECT_ - // If the process crashes, then this string will be magically included in the automatically-generated crash log ---- a/mDNSShared/dnssd_clientlib.c -+++ b/mDNSShared/dnssd_clientlib.c -@@ -372,7 +372,7 @@ DNSServiceErrorType DNSSD_API TXTRecordG - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdate-time" - #endif --const char VersionString_SCCS_libdnssd[] DNSSD_USED = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; -+const char VersionString_SCCS_libdnssd[] DNSSD_USED = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion); - #if defined(__GNUC__) - #pragma GCC diagnostic pop - #endif