diff options
20 files changed, 23 insertions, 855 deletions
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch deleted file mode 100644 index 68a395d69e..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | From 1fefe289d0c907392382eb2fa2f1f0ecac02f85d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | ||
| 4 | Subject: [PATCH] Create subroutine for cleaning recent interfaces | ||
| 5 | |||
| 6 | Moves functionality for cleaning the list of recent | ||
| 7 | interfaces into its own subroutine. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [dts@apple.com] | ||
| 10 | |||
| 11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 13 | --- | ||
| 14 | mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- | ||
| 15 | 1 file changed, 14 insertions(+), 10 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 18 | index 3b761d04e3c4..5aa220cf694e 100644 | ||
| 19 | --- a/mDNSPosix/mDNSPosix.c | ||
| 20 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 21 | @@ -1322,6 +1322,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf | ||
| 22 | return err; | ||
| 23 | } | ||
| 24 | |||
| 25 | +// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | ||
| 26 | +mDNSlocal void CleanRecentInterfaces(void) | ||
| 27 | +{ | ||
| 28 | + PosixNetworkInterface **ri = &gRecentInterfaces; | ||
| 29 | + const mDNSs32 utc = mDNSPlatformUTC(); | ||
| 30 | + while (*ri) | ||
| 31 | + { | ||
| 32 | + PosixNetworkInterface *pi = *ri; | ||
| 33 | + if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | ||
| 34 | + else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | // Creates a PosixNetworkInterface for the interface whose IP address is | ||
| 39 | // intfAddr and whose name is intfName and registers it with mDNS core. | ||
| 40 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, | ||
| 41 | @@ -1559,16 +1572,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
| 42 | |||
| 43 | // Clean up. | ||
| 44 | if (intfList != NULL) freeifaddrs(intfList); | ||
| 45 | - | ||
| 46 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | ||
| 47 | - PosixNetworkInterface **ri = &gRecentInterfaces; | ||
| 48 | - const mDNSs32 utc = mDNSPlatformUTC(); | ||
| 49 | - while (*ri) | ||
| 50 | - { | ||
| 51 | - PosixNetworkInterface *pi = *ri; | ||
| 52 | - if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | ||
| 53 | - else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } | ||
| 54 | - } | ||
| 55 | + CleanRecentInterfaces(); | ||
| 56 | |||
| 57 | return err; | ||
| 58 | } | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-SIGSEGV-during-DumpStateLog.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-SIGSEGV-during-DumpStateLog.patch deleted file mode 100644 index d74c031ab3..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-SIGSEGV-during-DumpStateLog.patch +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | From 3138d70ce8f521d03120e7789e93ebe290ece101 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 3 | Date: Thu, 1 Feb 2024 14:07:03 +0000 | ||
| 4 | Subject: [PATCH] Fix SIGSEGV during DumpStateLog() | ||
| 5 | |||
| 6 | DumpStateLog() calls LogMsgWithLevelv() with category == NULL, avoid | ||
| 7 | crashing in this case. | ||
| 8 | |||
| 9 | Upstream-Status: Inactive-Upstream [Upstream does not take patches] | ||
| 10 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 11 | --- | ||
| 12 | mDNSShared/mDNSDebug.c | 2 +- | ||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/mDNSShared/mDNSDebug.c b/mDNSShared/mDNSDebug.c | ||
| 16 | index b531fcea2bb9..1e8d9b10afbc 100644 | ||
| 17 | --- a/mDNSShared/mDNSDebug.c | ||
| 18 | +++ b/mDNSShared/mDNSDebug.c | ||
| 19 | @@ -72,7 +72,7 @@ mDNSlocal void LogMsgWithLevelv(os_log_t category, os_log_type_t level, const ch | ||
| 20 | mDNSlocal void LogMsgWithLevelv(const char *category, mDNSLogLevel_t level, const char *format, va_list args) | ||
| 21 | { | ||
| 22 | // Do not print the logs if the log category is MDNS_LOG_CATEGORY_DISABLED. | ||
| 23 | - if (strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) | ||
| 24 | + if (category && strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) | ||
| 25 | { | ||
| 26 | return; | ||
| 27 | } | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-build-with-gcc-15.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-build-with-gcc-15.patch index 22a9c27aad..af33d5444c 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-build-with-gcc-15.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0001-Fix-build-with-gcc-15.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 189f0d8e9913f4eaca9189f710155ffba9035f7e Mon Sep 17 00:00:00 2001 | 1 | From c84f185f29d0839b97177aecb0a78b9717947973 Mon Sep 17 00:00:00 2001 |
| 2 | From: Nguyen Dat Tho <tho3.nguyen@lge.com> | 2 | From: Nguyen Dat Tho <tho3.nguyen@lge.com> |
| 3 | Date: Wed, 9 Apr 2025 13:05:24 +0900 | 3 | Date: Wed, 9 Apr 2025 13:05:24 +0900 |
| 4 | Subject: [PATCH] Fix build with gcc-15 | 4 | Subject: [PATCH] Fix build with gcc-15 |
| @@ -19,7 +19,7 @@ Signed-off-by: Nguyen Dat Tho <tho3.nguyen@lge.com> | |||
| 19 | 1 file changed, 3 insertions(+) | 19 | 1 file changed, 3 insertions(+) |
| 20 | 20 | ||
| 21 | diff --git a/mDNSShared/CommonServices.h b/mDNSShared/CommonServices.h | 21 | diff --git a/mDNSShared/CommonServices.h b/mDNSShared/CommonServices.h |
| 22 | index 7efb077..f0f3a8b 100644 | 22 | index 7efb077f3b04..f0f3a8b3157e 100644 |
| 23 | --- a/mDNSShared/CommonServices.h | 23 | --- a/mDNSShared/CommonServices.h |
| 24 | +++ b/mDNSShared/CommonServices.h | 24 | +++ b/mDNSShared/CommonServices.h |
| 25 | @@ -192,6 +192,9 @@ extern "C" { | 25 | @@ -192,6 +192,9 @@ extern "C" { |
| @@ -32,6 +32,3 @@ index 7efb077..f0f3a8b 100644 | |||
| 32 | 32 | ||
| 33 | #elif ( TARGET_OS_SOLARIS ) | 33 | #elif ( TARGET_OS_SOLARIS ) |
| 34 | 34 | ||
| 35 | -- | ||
| 36 | 2.34.1 | ||
| 37 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-Handle-interface-without-ifa_addr.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-Handle-interface-without-ifa_addr.patch deleted file mode 100644 index a531884afc..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0001-Handle-interface-without-ifa_addr.patch +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | From 199b376e585d5362a1f51ea20e45dcc3bdb7d6aa Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Stefan Agner <stefan@agner.ch> | ||
| 3 | Date: Fri, 23 Jun 2023 10:10:00 +0200 | ||
| 4 | Subject: [PATCH] Handle interface without `ifa_addr` | ||
| 5 | |||
| 6 | It seems that certain interface types may have `ifa_addr` set to null. | ||
| 7 | Handle this case gracefully. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/apple-oss-distributions/mDNSResponder/pull/2/commits/11b410d4d683c90e693c40315997bb3e8ec90e9a] | ||
| 10 | |||
| 11 | Signed-off-by: Stefan Agner <stefan@agner.ch> | ||
| 12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 13 | --- | ||
| 14 | mDNSPosix/mDNSPosix.c | 4 +++- | ||
| 15 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 18 | index 4c835a8c253c..e1e27b1de3b2 100644 | ||
| 19 | --- a/mDNSPosix/mDNSPosix.c | ||
| 20 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 21 | @@ -1927,6 +1927,7 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 22 | continue; | ||
| 23 | |||
| 24 | if ((ifa_loop4 == NULL) && | ||
| 25 | + ((*ifi)->ifa_addr != NULL) && | ||
| 26 | ((*ifi)->ifa_addr->sa_family == AF_INET) && | ||
| 27 | ((*ifi)->ifa_flags & IFF_UP) && | ||
| 28 | ((*ifi)->ifa_flags & IFF_LOOPBACK)) | ||
| 29 | @@ -1935,7 +1936,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 30 | continue; | ||
| 31 | } | ||
| 32 | |||
| 33 | - if ( (((*ifi)->ifa_addr->sa_family == AF_INET) | ||
| 34 | + if ( ((*ifi)->ifa_addr != NULL) && | ||
| 35 | + (((*ifi)->ifa_addr->sa_family == AF_INET) | ||
| 36 | #if HAVE_IPV6 | ||
| 37 | || ((*ifi)->ifa_addr->sa_family == AF_INET6) | ||
| 38 | #endif | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch index 0dc36ae1d4..651879ea86 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From a5fe20fa00088683136a09a4da3c36d9b20fe1b9 Mon Sep 17 00:00:00 2001 | 1 | From cdbc28c668dd627906f833f9a8e32ac53b0b0139 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 4 Nov 2021 07:31:32 -0700 | 3 | Date: Thu, 4 Nov 2021 07:31:32 -0700 |
| 4 | Subject: [PATCH] dns-sd: Include missing headers | 4 | Subject: [PATCH] dns-sd: Include missing headers |
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch b/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch deleted file mode 100644 index 5ce7eb1015..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | From d265ac9346d3dcbcf1187134318baafcfa75c054 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | ||
| 4 | Subject: [PATCH] Create subroutine for tearing down an interface | ||
| 5 | |||
| 6 | Creates a subroutine for tearing down an interface. | ||
| 7 | |||
| 8 | Upstream-Status: Submitted [dts@apple.com] | ||
| 9 | |||
| 10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 12 | --- | ||
| 13 | mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ | ||
| 14 | 1 file changed, 16 insertions(+), 6 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 17 | index 5aa220cf694e..a6041b04a21e 100644 | ||
| 18 | --- a/mDNSPosix/mDNSPosix.c | ||
| 19 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 20 | @@ -1043,6 +1043,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) | ||
| 21 | gRecentInterfaces = intf; | ||
| 22 | } | ||
| 23 | |||
| 24 | +mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf) | ||
| 25 | +{ | ||
| 26 | + mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); | ||
| 27 | + if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); | ||
| 28 | + FreePosixNetworkInterface(intf); | ||
| 29 | + | ||
| 30 | + num_registered_interfaces--; | ||
| 31 | + if (num_registered_interfaces == 0) { | ||
| 32 | + num_pkts_accepted = 0; | ||
| 33 | + num_pkts_rejected = 0; | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | // Grab the first interface, deregister it, free it, and repeat until done. | ||
| 38 | mDNSlocal void ClearInterfaceList(mDNS *const m) | ||
| 39 | { | ||
| 40 | @@ -1051,13 +1064,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) | ||
| 41 | while (m->HostInterfaces) | ||
| 42 | { | ||
| 43 | PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); | ||
| 44 | - mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); | ||
| 45 | - if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); | ||
| 46 | - FreePosixNetworkInterface(intf); | ||
| 47 | + TearDownInterface(m, intf); | ||
| 48 | } | ||
| 49 | - num_registered_interfaces = 0; | ||
| 50 | - num_pkts_accepted = 0; | ||
| 51 | - num_pkts_rejected = 0; | ||
| 52 | + | ||
| 53 | + assert(num_registered_interfaces == 0); | ||
| 54 | } | ||
| 55 | |||
| 56 | mDNSlocal int SetupIPv6Socket(int fd) | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch b/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch index 86b659f8a1..abe8178f63 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From dfa9e2c494d1a834f5bdfe4dc24e8329dd8720eb Mon Sep 17 00:00:00 2001 | 1 | From dcc1f39a0918cdebf53ac7c105b3d33df960ed14 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Mon, 5 Dec 2022 15:14:12 +0000 | 3 | Date: Mon, 5 Dec 2022 15:14:12 +0000 |
| 4 | Subject: [PATCH] make: Set libdns_sd.so soname correctly | 4 | Subject: [PATCH] make: Set libdns_sd.so soname correctly |
| @@ -10,7 +10,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | |||
| 10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 11 | 11 | ||
| 12 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | 12 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile |
| 13 | index 041706523139..c877c8bb19e6 100755 | 13 | index e05ba10b4340..7c510317f1b6 100755 |
| 14 | --- a/mDNSPosix/Makefile | 14 | --- a/mDNSPosix/Makefile |
| 15 | +++ b/mDNSPosix/Makefile | 15 | +++ b/mDNSPosix/Makefile |
| 16 | @@ -276,7 +276,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | 16 | @@ -276,7 +276,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) |
| @@ -21,4 +21,4 @@ index 041706523139..c877c8bb19e6 100755 | |||
| 21 | + $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ | 21 | + $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ |
| 22 | $(STRIP) $@ | 22 | $(STRIP) $@ |
| 23 | 23 | ||
| 24 | Clients: setup libdns_sd ../Clients/build/dns-sd | 24 | Clients: setup ../Clients/build/dns-sd |
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch b/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch deleted file mode 100644 index 59871eb66a..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | From 5f58e5671cd6dbd4cb49bd30fb606d430b626361 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | ||
| 4 | Subject: [PATCH] Track interface socket family | ||
| 5 | |||
| 6 | Tracks the socket family associated with the interface. | ||
| 7 | |||
| 8 | Upstream-Status: Submitted [dts@apple.com] | ||
| 9 | |||
| 10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 12 | --- | ||
| 13 | mDNSPosix/mDNSPosix.c | 1 + | ||
| 14 | mDNSPosix/mDNSPosix.h | 2 ++ | ||
| 15 | 2 files changed, 3 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 18 | index a6041b04a21e..15bbecee04a4 100644 | ||
| 19 | --- a/mDNSPosix/mDNSPosix.c | ||
| 20 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 21 | @@ -1415,6 +1415,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
| 22 | // Set up the extra fields in PosixNetworkInterface. | ||
| 23 | assert(intf->intfName != NULL); // intf->intfName already set up above | ||
| 24 | intf->index = intfIndex; | ||
| 25 | + intf->sa_family = intfAddr->sa_family; | ||
| 26 | intf->multicastSocket4 = -1; | ||
| 27 | #if HAVE_IPV6 | ||
| 28 | intf->multicastSocket6 = -1; | ||
| 29 | diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h | ||
| 30 | index 9675591b0434..dd7864cd0d5e 100644 | ||
| 31 | --- a/mDNSPosix/mDNSPosix.h | ||
| 32 | +++ b/mDNSPosix/mDNSPosix.h | ||
| 33 | @@ -19,6 +19,7 @@ | ||
| 34 | #define __mDNSPlatformPosix_h | ||
| 35 | |||
| 36 | #include <signal.h> | ||
| 37 | +#include <sys/socket.h> | ||
| 38 | #include <sys/time.h> | ||
| 39 | |||
| 40 | #ifdef __cplusplus | ||
| 41 | @@ -40,6 +41,7 @@ struct PosixNetworkInterface | ||
| 42 | char * intfName; | ||
| 43 | PosixNetworkInterface * aliasIntf; | ||
| 44 | int index; | ||
| 45 | + sa_family_t sa_family; | ||
| 46 | int multicastSocket4; | ||
| 47 | #if HAVE_IPV6 | ||
| 48 | int multicastSocket6; | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0004-Add-definition-for-MAX.patch b/meta-networking/recipes-protocols/mdns/mdns/0004-Add-definition-for-MAX.patch deleted file mode 100644 index 82d7ceca30..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0004-Add-definition-for-MAX.patch +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | From f0adca77472c9c1df6db14f2b03e66d78a577649 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 3 | Date: Sat, 26 Oct 2024 13:24:45 +0000 | ||
| 4 | Subject: [PATCH] Add definition for MAX() | ||
| 5 | |||
| 6 | Upstream-Status: Inactive-Upstream [Upstream does not take patches] | ||
| 7 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 8 | --- | ||
| 9 | mDNSShared/uds_daemon.c | 2 ++ | ||
| 10 | 1 file changed, 2 insertions(+) | ||
| 11 | |||
| 12 | diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c | ||
| 13 | index e73bc1181b73..1d590a6a3580 100644 | ||
| 14 | --- a/mDNSShared/uds_daemon.c | ||
| 15 | +++ b/mDNSShared/uds_daemon.c | ||
| 16 | @@ -89,6 +89,8 @@ | ||
| 17 | |||
| 18 | #include "mdns_strict.h" | ||
| 19 | |||
| 20 | +#define MAX(A, B) (((A) > (B)) ? (A) : (B)) | ||
| 21 | + | ||
| 22 | // User IDs 0-500 are system-wide processes, not actual users in the usual sense | ||
| 23 | // User IDs for real user accounts start at 501 and count up from there | ||
| 24 | #define SystemUID(X) ((X) <= 500) | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch b/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch deleted file mode 100644 index bf2b85c2ab..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | From 935033dd40772240c9bcc6b9610d78eb3753bfaf Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Tue, 1 Aug 2017 17:06:01 -0500 | ||
| 4 | Subject: [PATCH] Indicate loopback interface to mDNS core | ||
| 5 | |||
| 6 | Tells the mDNS core if an interface is a loopback interface, | ||
| 7 | similar to AddInterfaceToList() in the MacOS implementation. | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [dts@apple.com] | ||
| 10 | |||
| 11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 13 | --- | ||
| 14 | mDNSPosix/mDNSPosix.c | 7 ++++--- | ||
| 15 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 18 | index 15bbecee04a4..f4c31a07d587 100644 | ||
| 19 | --- a/mDNSPosix/mDNSPosix.c | ||
| 20 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 21 | @@ -1348,7 +1348,7 @@ mDNSlocal void CleanRecentInterfaces(void) | ||
| 22 | // Creates a PosixNetworkInterface for the interface whose IP address is | ||
| 23 | // intfAddr and whose name is intfName and registers it with mDNS core. | ||
| 24 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, | ||
| 25 | - const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex) | ||
| 26 | + const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex, int intfFlags) | ||
| 27 | { | ||
| 28 | int err = 0; | ||
| 29 | PosixNetworkInterface *intf; | ||
| 30 | @@ -1411,6 +1411,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
| 31 | |||
| 32 | intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; | ||
| 33 | intf->coreIntf.McastTxRx = mDNStrue; | ||
| 34 | + intf->coreIntf.Loopback = ((intfFlags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; | ||
| 35 | |||
| 36 | // Set up the extra fields in PosixNetworkInterface. | ||
| 37 | assert(intf->intfName != NULL); // intf->intfName already set up above | ||
| 38 | @@ -1561,7 +1562,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
| 39 | } | ||
| 40 | #endif | ||
| 41 | if (SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, | ||
| 42 | - hwaddr, hwaddr_len, i->ifa_name, ifIndex) == 0) | ||
| 43 | + hwaddr, hwaddr_len, i->ifa_name, ifIndex, i->ifa_flags) == 0) | ||
| 44 | { | ||
| 45 | if (i->ifa_addr->sa_family == AF_INET) | ||
| 46 | foundav4 = mDNStrue; | ||
| 47 | @@ -1578,7 +1579,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
| 48 | // if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) | ||
| 49 | if (!foundav4 && firstLoopback) | ||
| 50 | (void) SetupOneInterface(m, firstLoopback->ifa_addr, firstLoopback->ifa_netmask, | ||
| 51 | - NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex); | ||
| 52 | + NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex, firstLoopback->ifa_flags); | ||
| 53 | } | ||
| 54 | |||
| 55 | // Clean up. | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch b/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch index 8d1915de8c..af27a89f4c 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From f871ac42165c29f763785aa0199dfc76f1731f4d Mon Sep 17 00:00:00 2001 | 1 | From f7ee12c1f8e85b9d2fe4023b6539c8051dc710c3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Mon, 5 Dec 2022 15:14:26 +0000 | 3 | Date: Mon, 5 Dec 2022 15:14:26 +0000 |
| 4 | Subject: [PATCH] make: Separate TLS targets from libraries | 4 | Subject: [PATCH] make: Separate TLS targets from libraries |
| @@ -13,7 +13,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | |||
| 13 | 1 file changed, 8 insertions(+), 6 deletions(-) | 13 | 1 file changed, 8 insertions(+), 6 deletions(-) |
| 14 | 14 | ||
| 15 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | 15 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile |
| 16 | index c877c8bb19e6..3a5897c4dbee 100755 | 16 | index 7c510317f1b6..8dd5984020ee 100755 |
| 17 | --- a/mDNSPosix/Makefile | 17 | --- a/mDNSPosix/Makefile |
| 18 | +++ b/mDNSPosix/Makefile | 18 | +++ b/mDNSPosix/Makefile |
| 19 | @@ -112,9 +112,11 @@ ifeq ($(findstring linux,$(os)),linux) | 19 | @@ -112,9 +112,11 @@ ifeq ($(findstring linux,$(os)),linux) |
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0005-Fix-missing-limit-declarations.patch b/meta-networking/recipes-protocols/mdns/mdns/0005-Fix-missing-limit-declarations.patch index 4d4a8cf9b7..41b8985e27 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0005-Fix-missing-limit-declarations.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0005-Fix-missing-limit-declarations.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From cf216a6872139e435d5712787359b03022b51d2b Mon Sep 17 00:00:00 2001 | 1 | From 34285024531adbbc7b67506c9fc2e60f3b36b73b Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alexk@zuma.ai> | 2 | From: Alex Kiernan <alexk@zuma.ai> |
| 3 | Date: Sat, 26 Oct 2024 13:26:09 +0000 | 3 | Date: Sat, 26 Oct 2024 13:26:09 +0000 |
| 4 | Subject: [PATCH] Fix missing `limit` declarations | 4 | Subject: [PATCH] Fix missing `limit` declarations |
| @@ -12,10 +12,10 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | |||
| 12 | 1 file changed, 4 insertions(+) | 12 | 1 file changed, 4 insertions(+) |
| 13 | 13 | ||
| 14 | diff --git a/mDNSShared/dnssd_clientstub.c b/mDNSShared/dnssd_clientstub.c | 14 | diff --git a/mDNSShared/dnssd_clientstub.c b/mDNSShared/dnssd_clientstub.c |
| 15 | index fc93d162446a..a6cf45fa9856 100644 | 15 | index 89cb90d947c7..316fc49ab078 100644 |
| 16 | --- a/mDNSShared/dnssd_clientstub.c | 16 | --- a/mDNSShared/dnssd_clientstub.c |
| 17 | +++ b/mDNSShared/dnssd_clientstub.c | 17 | +++ b/mDNSShared/dnssd_clientstub.c |
| 18 | @@ -2022,6 +2022,7 @@ DNSServiceErrorType DNSServiceRegisterInternal | 18 | @@ -2026,6 +2026,7 @@ DNSServiceErrorType DNSServiceRegisterInternal |
| 19 | ipc_msg_hdr *hdr; | 19 | ipc_msg_hdr *hdr; |
| 20 | DNSServiceErrorType err; | 20 | DNSServiceErrorType err; |
| 21 | union { uint16_t s; u_char b[2]; } port = { portInNetworkByteOrder }; | 21 | union { uint16_t s; u_char b[2]; } port = { portInNetworkByteOrder }; |
| @@ -23,7 +23,7 @@ index fc93d162446a..a6cf45fa9856 100644 | |||
| 23 | (void)attr; | 23 | (void)attr; |
| 24 | 24 | ||
| 25 | if (!sdRef || !regtype) return kDNSServiceErr_BadParam; | 25 | if (!sdRef || !regtype) return kDNSServiceErr_BadParam; |
| 26 | @@ -2054,6 +2055,7 @@ DNSServiceErrorType DNSServiceRegisterInternal | 26 | @@ -2050,6 +2051,7 @@ DNSServiceErrorType DNSServiceRegisterInternal |
| 27 | if (!hdr) { DNSServiceRefDeallocate(*sdRef); *sdRef = NULL; return kDNSServiceErr_NoMemory; } | 27 | if (!hdr) { DNSServiceRefDeallocate(*sdRef); *sdRef = NULL; return kDNSServiceErr_NoMemory; } |
| 28 | if (!callBack) hdr->ipc_flags |= IPC_FLAGS_NOREPLY; | 28 | if (!callBack) hdr->ipc_flags |= IPC_FLAGS_NOREPLY; |
| 29 | 29 | ||
| @@ -31,7 +31,7 @@ index fc93d162446a..a6cf45fa9856 100644 | |||
| 31 | put_flags(flags, &ptr); | 31 | put_flags(flags, &ptr); |
| 32 | put_uint32(interfaceIndex, &ptr); | 32 | put_uint32(interfaceIndex, &ptr); |
| 33 | put_string(name, &ptr); | 33 | put_string(name, &ptr); |
| 34 | @@ -2334,6 +2336,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal | 34 | @@ -2326,6 +2328,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal |
| 35 | ipc_msg_hdr *hdr = NULL; | 35 | ipc_msg_hdr *hdr = NULL; |
| 36 | DNSRecordRef rref = NULL; | 36 | DNSRecordRef rref = NULL; |
| 37 | DNSRecord **p; | 37 | DNSRecord **p; |
| @@ -39,7 +39,7 @@ index fc93d162446a..a6cf45fa9856 100644 | |||
| 39 | (void)attr; | 39 | (void)attr; |
| 40 | 40 | ||
| 41 | // Verify that only one of the following flags is set. | 41 | // Verify that only one of the following flags is set. |
| 42 | @@ -2389,6 +2392,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal | 42 | @@ -2375,6 +2378,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal |
| 43 | hdr = create_hdr(reg_record_request, &len, &ptr, !(flags & kDNSServiceFlagsQueueRequest), sdRef); | 43 | hdr = create_hdr(reg_record_request, &len, &ptr, !(flags & kDNSServiceFlagsQueueRequest), sdRef); |
| 44 | if (!hdr) return kDNSServiceErr_NoMemory; | 44 | if (!hdr) return kDNSServiceErr_NoMemory; |
| 45 | 45 | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch b/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch deleted file mode 100644 index ebdfe8c783..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch +++ /dev/null | |||
| @@ -1,166 +0,0 @@ | |||
| 1 | From 47118760466b74939cec9f5233062236a12bb3f4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Thu, 13 Jul 2017 09:00:00 -0500 | ||
| 4 | Subject: [PATCH] Use list for changed interfaces | ||
| 5 | |||
| 6 | Uses a linked list to store the index of changed network interfaces | ||
| 7 | instead of a bitfield. This allows for network interfaces with an | ||
| 8 | index greater than 31 (an index of 36 was seen on Android). | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [dts@apple.com] | ||
| 11 | |||
| 12 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 13 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 14 | --- | ||
| 15 | mDNSPosix/mDNSPosix.c | 58 ++++++++++++++++++++++++++++++++----------- | ||
| 16 | 1 file changed, 43 insertions(+), 15 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 19 | index f4c31a07d587..6b2fe76d4b66 100644 | ||
| 20 | --- a/mDNSPosix/mDNSPosix.c | ||
| 21 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 22 | @@ -74,6 +74,14 @@ struct IfChangeRec | ||
| 23 | }; | ||
| 24 | typedef struct IfChangeRec IfChangeRec; | ||
| 25 | |||
| 26 | +// Used to build a list of network interface indices | ||
| 27 | +struct NetworkInterfaceIndex | ||
| 28 | +{ | ||
| 29 | + int if_index; | ||
| 30 | + struct NetworkInterfaceIndex *Next; | ||
| 31 | +}; | ||
| 32 | +typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; | ||
| 33 | + | ||
| 34 | // Note that static data is initialized to zero in (modern) C. | ||
| 35 | static PosixEventSource *gEventSources; // linked list of PosixEventSource's | ||
| 36 | static sigset_t gEventSignalSet; // Signals which event loop listens for | ||
| 37 | @@ -1621,6 +1629,23 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) | ||
| 38 | return err; | ||
| 39 | } | ||
| 40 | |||
| 41 | +mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) | ||
| 42 | +{ | ||
| 43 | + NetworkInterfaceIndex *item; | ||
| 44 | + | ||
| 45 | + for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) | ||
| 46 | + { | ||
| 47 | + if (if_index == item->if_index) return; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + item = mdns_malloc(sizeof *item); | ||
| 51 | + if (item == NULL) return; | ||
| 52 | + | ||
| 53 | + item->if_index = if_index; | ||
| 54 | + item->Next = NULL; | ||
| 55 | + AddToTail(list, item); | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | #if MDNS_DEBUGMSGS | ||
| 59 | mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | ||
| 60 | { | ||
| 61 | @@ -1648,14 +1673,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | ||
| 62 | } | ||
| 63 | #endif | ||
| 64 | |||
| 65 | -mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | ||
| 66 | +mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) | ||
| 67 | // Read through the messages on sd and if any indicate that any interface records should | ||
| 68 | // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. | ||
| 69 | { | ||
| 70 | ssize_t readCount; | ||
| 71 | char buff[4096]; | ||
| 72 | struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; | ||
| 73 | - mDNSu32 result = 0; | ||
| 74 | |||
| 75 | // The structure here is more complex than it really ought to be because, | ||
| 76 | // unfortunately, there's no good way to size a buffer in advance large | ||
| 77 | @@ -1691,9 +1715,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | ||
| 78 | |||
| 79 | // Process the NetLink message | ||
| 80 | if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) | ||
| 81 | - result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; | ||
| 82 | + AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); | ||
| 83 | else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) | ||
| 84 | - result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; | ||
| 85 | + AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); | ||
| 86 | |||
| 87 | // Advance pNLMsg to the next message in the buffer | ||
| 88 | if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) | ||
| 89 | @@ -1704,8 +1728,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | ||
| 90 | else | ||
| 91 | break; // all done! | ||
| 92 | } | ||
| 93 | - | ||
| 94 | - return result; | ||
| 95 | } | ||
| 96 | |||
| 97 | #else // USES_NETLINK | ||
| 98 | @@ -1737,14 +1759,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | |||
| 102 | -mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | ||
| 103 | +mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) | ||
| 104 | // Read through the messages on sd and if any indicate that any interface records should | ||
| 105 | // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. | ||
| 106 | { | ||
| 107 | ssize_t readCount; | ||
| 108 | char buff[4096]; | ||
| 109 | struct ifa_msghdr *pRSMsg = (struct ifa_msghdr*) buff; | ||
| 110 | - mDNSu32 result = 0; | ||
| 111 | |||
| 112 | readCount = read(sd, buff, sizeof buff); | ||
| 113 | if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) | ||
| 114 | @@ -1759,12 +1780,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | ||
| 115 | pRSMsg->ifam_type == RTM_IFINFO) | ||
| 116 | { | ||
| 117 | if (pRSMsg->ifam_type == RTM_IFINFO) | ||
| 118 | - result |= 1 << ((struct if_msghdr*) pRSMsg)->ifm_index; | ||
| 119 | + AddInterfaceIndexToList(changedInterfaces, ((struct if_msghdr*) pRSMsg)->ifm_index); | ||
| 120 | else | ||
| 121 | - result |= 1 << pRSMsg->ifam_index; | ||
| 122 | + AddInterfaceIndexToList(changedInterfaces, pRSMsg->ifam_index); | ||
| 123 | } | ||
| 124 | - | ||
| 125 | - return result; | ||
| 126 | } | ||
| 127 | |||
| 128 | #endif // USES_NETLINK | ||
| 129 | @@ -1774,7 +1793,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 130 | { | ||
| 131 | IfChangeRec *pChgRec = (IfChangeRec*) context; | ||
| 132 | fd_set readFDs; | ||
| 133 | - mDNSu32 changedInterfaces = 0; | ||
| 134 | + GenLinkedList changedInterfaces; | ||
| 135 | + NetworkInterfaceIndex *changedInterface; | ||
| 136 | struct timeval zeroTimeout = { 0, 0 }; | ||
| 137 | |||
| 138 | (void)fd; // Unused | ||
| 139 | @@ -1782,17 +1802,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 140 | FD_ZERO(&readFDs); | ||
| 141 | FD_SET(pChgRec->NotifySD, &readFDs); | ||
| 142 | |||
| 143 | + InitLinkedList(&changedInterfaces, offsetof(NetworkInterfaceIndex, Next)); | ||
| 144 | + | ||
| 145 | do | ||
| 146 | { | ||
| 147 | - changedInterfaces |= ProcessRoutingNotification(pChgRec->NotifySD); | ||
| 148 | + ProcessRoutingNotification(pChgRec->NotifySD, &changedInterfaces); | ||
| 149 | } | ||
| 150 | while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); | ||
| 151 | |||
| 152 | // Currently we rebuild the entire interface list whenever any interface change is | ||
| 153 | // detected. If this ever proves to be a performance issue in a multi-homed | ||
| 154 | // configuration, more care should be paid to changedInterfaces. | ||
| 155 | - if (changedInterfaces) | ||
| 156 | + if (changedInterfaces.Head != NULL) | ||
| 157 | mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); | ||
| 158 | + | ||
| 159 | + while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) | ||
| 160 | + { | ||
| 161 | + RemoveFromList(&changedInterfaces, changedInterface); | ||
| 162 | + mdns_free(changedInterface); | ||
| 163 | + } | ||
| 164 | } | ||
| 165 | |||
| 166 | // Register with either a Routing Socket or RtNetLink to listen for interface changes. | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch b/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch index 3c46d599c1..7d8f04c902 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 0b3953dfdeef8dc9b8a23820659feee9e15b5bad Mon Sep 17 00:00:00 2001 | 1 | From e79f75487e32f87677519ec40c021b1623395bde Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Mon, 5 Dec 2022 22:49:49 +0000 | 3 | Date: Mon, 5 Dec 2022 22:49:49 +0000 |
| 4 | Subject: [PATCH] mDNSCore: Fix broken debug parameter | 4 | Subject: [PATCH] mDNSCore: Fix broken debug parameter |
| @@ -10,10 +10,10 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | |||
| 10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 11 | 11 | ||
| 12 | diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c | 12 | diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c |
| 13 | index d4519a7f62aa..3090edb2ac5d 100644 | 13 | index ad9eaa37a82a..fc51e1ad9bd4 100644 |
| 14 | --- a/mDNSCore/mDNS.c | 14 | --- a/mDNSCore/mDNS.c |
| 15 | +++ b/mDNSCore/mDNS.c | 15 | +++ b/mDNSCore/mDNS.c |
| 16 | @@ -10253,7 +10253,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage * | 16 | @@ -11046,7 +11046,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage * |
| 17 | #else | 17 | #else |
| 18 | const DNSServRef dnsserv = qptr->qDNSServer; | 18 | const DNSServRef dnsserv = qptr->qDNSServer; |
| 19 | #endif | 19 | #endif |
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch b/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch deleted file mode 100644 index be63471e64..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch +++ /dev/null | |||
| @@ -1,249 +0,0 @@ | |||
| 1 | From 105514b75df6d7abd052ec64d8106f5c07cc4782 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Mon, 24 Jul 2017 09:38:55 -0500 | ||
| 4 | Subject: [PATCH] Handle noisy netlink sockets | ||
| 5 | |||
| 6 | The POSIX implementation currently clears all network interfaces | ||
| 7 | when netlink indicates that there has been a change. This causes | ||
| 8 | the following problems: | ||
| 9 | |||
| 10 | 1) Applications are informed that all of the services they are | ||
| 11 | tracking have been removed. | ||
| 12 | 2) Increases network load because the client must re-query for | ||
| 13 | all records it is interested in. | ||
| 14 | |||
| 15 | This changes netlink notification handling by: | ||
| 16 | |||
| 17 | 1) Always comparing with the latest interface list returned | ||
| 18 | by the OS. | ||
| 19 | 2) Confirming that the interface has been changed in a way | ||
| 20 | that we care about. | ||
| 21 | |||
| 22 | Upstream-Status: Submitted [dts@apple.com] | ||
| 23 | |||
| 24 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 25 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 26 | --- | ||
| 27 | mDNSPosix/mDNSPosix.c | 182 +++++++++++++++++++++++++++++++++++++++--- | ||
| 28 | 1 file changed, 172 insertions(+), 10 deletions(-) | ||
| 29 | |||
| 30 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 31 | index 6b2fe76d4b66..ecd5741d038d 100644 | ||
| 32 | --- a/mDNSPosix/mDNSPosix.c | ||
| 33 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 34 | @@ -1788,14 +1788,43 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
| 35 | |||
| 36 | #endif // USES_NETLINK | ||
| 37 | |||
| 38 | +// Test whether the given PosixNetworkInterface matches the given struct ifaddrs | ||
| 39 | +mDNSlocal mDNSBool InterfacesMatch(PosixNetworkInterface *intf, struct ifaddrs *ifi) | ||
| 40 | +{ | ||
| 41 | + mDNSBool match = mDNSfalse; | ||
| 42 | + mDNSAddr ip, mask; | ||
| 43 | + unsigned int if_index; | ||
| 44 | + | ||
| 45 | + if_index = if_nametoindex(ifi->ifa_name); | ||
| 46 | + if (if_index == 0) | ||
| 47 | + return mDNSfalse; | ||
| 48 | + | ||
| 49 | + if((intf->index == if_index) && | ||
| 50 | + (intf->sa_family == ifi->ifa_addr->sa_family) && | ||
| 51 | + (strcmp(intf->coreIntf.ifname, ifi->ifa_name) == 0)) | ||
| 52 | + { | ||
| 53 | + SockAddrTomDNSAddr(ifi->ifa_addr, &ip, NULL); | ||
| 54 | + SockAddrTomDNSAddr(ifi->ifa_netmask, &mask, NULL); | ||
| 55 | + | ||
| 56 | + match = mDNSSameAddress(&intf->coreIntf.ip, &ip) && | ||
| 57 | + mDNSSameAddress(&intf->coreIntf.mask, &mask); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + return match; | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | // Called when data appears on interface change notification socket | ||
| 64 | mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 65 | { | ||
| 66 | IfChangeRec *pChgRec = (IfChangeRec*) context; | ||
| 67 | + mDNS *m = pChgRec->mDNS; | ||
| 68 | fd_set readFDs; | ||
| 69 | GenLinkedList changedInterfaces; | ||
| 70 | NetworkInterfaceIndex *changedInterface; | ||
| 71 | struct timeval zeroTimeout = { 0, 0 }; | ||
| 72 | + struct ifaddrs *ifa_list, **ifi, *ifa_loop4 = NULL; | ||
| 73 | + PosixNetworkInterface *intf, *intfNext; | ||
| 74 | + mDNSBool found, foundav4; | ||
| 75 | |||
| 76 | (void)fd; // Unused | ||
| 77 | |||
| 78 | @@ -1810,12 +1839,149 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
| 79 | } | ||
| 80 | while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); | ||
| 81 | |||
| 82 | - // Currently we rebuild the entire interface list whenever any interface change is | ||
| 83 | - // detected. If this ever proves to be a performance issue in a multi-homed | ||
| 84 | - // configuration, more care should be paid to changedInterfaces. | ||
| 85 | - if (changedInterfaces.Head != NULL) | ||
| 86 | - mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); | ||
| 87 | + CleanRecentInterfaces(); | ||
| 88 | + | ||
| 89 | + if (changedInterfaces.Head == NULL) goto cleanup; | ||
| 90 | + | ||
| 91 | + if (getifaddrs(&ifa_list) < 0) goto cleanup; | ||
| 92 | + | ||
| 93 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
| 94 | + { | ||
| 95 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
| 96 | + | ||
| 97 | + // Loopback interface(s) are handled later | ||
| 98 | + if (intf->coreIntf.Loopback) continue; | ||
| 99 | + | ||
| 100 | + found = mDNSfalse; | ||
| 101 | + for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) | ||
| 102 | + { | ||
| 103 | + if (InterfacesMatch(intf, *ifi)) | ||
| 104 | + { | ||
| 105 | + found = mDNStrue; | ||
| 106 | + break; | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + // Removes changed and old interfaces from m->HostInterfaces | ||
| 111 | + if (!found) TearDownInterface(m, intf); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + // Add new and changed interfaces in ifa_list | ||
| 115 | + // Save off loopback interface in case it is needed later | ||
| 116 | + for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) | ||
| 117 | + { | ||
| 118 | + found = mDNSfalse; | ||
| 119 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
| 120 | + { | ||
| 121 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
| 122 | + | ||
| 123 | + // Loopback interface(s) are handled later | ||
| 124 | + if (intf->coreIntf.Loopback) continue; | ||
| 125 | + | ||
| 126 | + if (InterfacesMatch(intf, *ifi)) | ||
| 127 | + { | ||
| 128 | + found = mDNStrue; | ||
| 129 | + break; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + // Removes changed and old interfaces from m->HostInterfaces | ||
| 133 | + } | ||
| 134 | + if (found) | ||
| 135 | + continue; | ||
| 136 | + | ||
| 137 | + if ((ifa_loop4 == NULL) && | ||
| 138 | + ((*ifi)->ifa_addr->sa_family == AF_INET) && | ||
| 139 | + ((*ifi)->ifa_flags & IFF_UP) && | ||
| 140 | + ((*ifi)->ifa_flags & IFF_LOOPBACK)) | ||
| 141 | + { | ||
| 142 | + ifa_loop4 = *ifi; | ||
| 143 | + continue; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + if ( (((*ifi)->ifa_addr->sa_family == AF_INET) | ||
| 147 | +#if HAVE_IPV6 | ||
| 148 | + || ((*ifi)->ifa_addr->sa_family == AF_INET6) | ||
| 149 | +#endif | ||
| 150 | + ) && ((*ifi)->ifa_flags & IFF_UP) | ||
| 151 | + && !((*ifi)->ifa_flags & IFF_POINTOPOINT) | ||
| 152 | + && !((*ifi)->ifa_flags & IFF_LOOPBACK)) | ||
| 153 | + { | ||
| 154 | + struct ifaddrs *i = *ifi; | ||
| 155 | + | ||
| 156 | +#define ethernet_addr_len 6 | ||
| 157 | + uint8_t hwaddr[ethernet_addr_len]; | ||
| 158 | + int hwaddr_len = 0; | ||
| 159 | + | ||
| 160 | +#if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX | ||
| 161 | + struct ifreq ifr; | ||
| 162 | + int sockfd = socket(AF_INET6, SOCK_DGRAM, 0); | ||
| 163 | + if (sockfd >= 0) | ||
| 164 | + { | ||
| 165 | + /* Add hardware address */ | ||
| 166 | + memcpy(ifr.ifr_name, i->ifa_name, IFNAMSIZ); | ||
| 167 | + if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) != -1) | ||
| 168 | + { | ||
| 169 | + if (ifr.ifr_hwaddr.sa_family == ARPHRD_ETHER) | ||
| 170 | + { | ||
| 171 | + memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ethernet_addr_len); | ||
| 172 | + hwaddr_len = ethernet_addr_len; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + close(sockfd); | ||
| 176 | + } | ||
| 177 | + else | ||
| 178 | + { | ||
| 179 | + memset(hwaddr, 0, sizeof(hwaddr)); | ||
| 180 | + } | ||
| 181 | +#endif // TARGET_OS_LINUX | ||
| 182 | + SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, | ||
| 183 | + hwaddr, hwaddr_len, i->ifa_name, if_nametoindex(i->ifa_name), i->ifa_flags); | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + // Determine if there is at least one non-loopback IPv4 interface. This is to work around issues | ||
| 188 | + // with multicast loopback on IPv6 interfaces -- see corresponding logic in SetupInterfaceList(). | ||
| 189 | + foundav4 = mDNSfalse; | ||
| 190 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
| 191 | + { | ||
| 192 | + if (intf->sa_family == AF_INET && !intf->coreIntf.Loopback) | ||
| 193 | + { | ||
| 194 | + foundav4 = mDNStrue; | ||
| 195 | + break; | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + if (foundav4) | ||
| 200 | + { | ||
| 201 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
| 202 | + { | ||
| 203 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
| 204 | + if (intf->coreIntf.Loopback) TearDownInterface(m, intf); | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + else | ||
| 208 | + { | ||
| 209 | + found = mDNSfalse; | ||
| 210 | + | ||
| 211 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
| 212 | + { | ||
| 213 | + if (intf->coreIntf.Loopback) | ||
| 214 | + { | ||
| 215 | + found = mDNStrue; | ||
| 216 | + break; | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + if (!found && (ifa_loop4 != NULL)) | ||
| 221 | + { | ||
| 222 | + SetupOneInterface(m, ifa_loop4->ifa_addr, ifa_loop4->ifa_netmask, | ||
| 223 | + NULL, 0, ifa_loop4->ifa_name, if_nametoindex(ifa_loop4->ifa_name), ifa_loop4->ifa_flags); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + if (ifa_list != NULL) freeifaddrs(ifa_list); | ||
| 228 | |||
| 229 | +cleanup: | ||
| 230 | while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) | ||
| 231 | { | ||
| 232 | RemoveFromList(&changedInterfaces, changedInterface); | ||
| 233 | @@ -1947,15 +2113,11 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) | ||
| 234 | #endif | ||
| 235 | } | ||
| 236 | |||
| 237 | -// This is used internally by InterfaceChangeCallback. | ||
| 238 | -// It's also exported so that the Standalone Responder (mDNSResponderPosix) | ||
| 239 | +// This is exported so that the Standalone Responder (mDNSResponderPosix) | ||
| 240 | // can call it in response to a SIGHUP (mainly for debugging purposes). | ||
| 241 | mDNSexport mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m) | ||
| 242 | { | ||
| 243 | int err; | ||
| 244 | - // This is a pretty heavyweight way to process interface changes -- | ||
| 245 | - // destroying the entire interface list and then making fresh one from scratch. | ||
| 246 | - // We should make it like the OS X version, which leaves unchanged interfaces alone. | ||
| 247 | ClearInterfaceList(m); | ||
| 248 | err = SetupInterfaceList(m); | ||
| 249 | return PosixErrorToStatus(err); | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch b/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch index ffa3fa3827..5f8f428302 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 626ccae85aab5b0902a8e3c05d9f0e3fbbe4fcd2 Mon Sep 17 00:00:00 2001 | 1 | From a1c982808ebfb71ba7e0f16040013b7127a6e2ab Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> | 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Tue, 6 Dec 2022 13:28:31 +0000 | 3 | Date: Tue, 6 Dec 2022 13:28:31 +0000 |
| 4 | Subject: [PATCH] make: Add top-level Makefile | 4 | Subject: [PATCH] make: Add top-level Makefile |
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch b/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch deleted file mode 100644 index 276f879df2..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | From 3715b3f4a0ba2d2cb05e5ba617b523c759c88d4b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Wed, 9 Aug 2017 09:16:58 -0500 | ||
| 4 | Subject: [PATCH] Mark deleted interfaces as being changed | ||
| 5 | |||
| 6 | Netlink notification handling ignores messages for deleted links, | ||
| 7 | RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- | ||
| 8 | mentation (http://www.infradead.org/~tgr/libnl/doc/route.html) | ||
| 9 | RTM_DELLINK can be sent by the kernel, but RTM_GETLINK cannot. | ||
| 10 | There was likely a mixup in the original implementation, so this | ||
| 11 | change replaces handling for RTM_GETLINK with RTM_DELLINK. | ||
| 12 | |||
| 13 | Testing and Verification Instructions: | ||
| 14 | 1. Use ip-link to add and remove a VLAN interface and verify | ||
| 15 | that mDNSResponder handles the deleted link. | ||
| 16 | |||
| 17 | Upstream-Status: Submitted [dts@apple.com] | ||
| 18 | |||
| 19 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 20 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 21 | --- | ||
| 22 | mDNSPosix/mDNSPosix.c | 2 +- | ||
| 23 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 24 | |||
| 25 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 26 | index ecd5741d038d..776531dbc8e8 100644 | ||
| 27 | --- a/mDNSPosix/mDNSPosix.c | ||
| 28 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 29 | @@ -1714,7 +1714,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
| 30 | #endif | ||
| 31 | |||
| 32 | // Process the NetLink message | ||
| 33 | - if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) | ||
| 34 | + if (pNLMsg->nlmsg_type == RTM_DELLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) | ||
| 35 | AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); | ||
| 36 | else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) | ||
| 37 | AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch b/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch deleted file mode 100644 index f3c7f62d3f..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | From 4e6621eee389e1cbb558fe268e02d5153a1d8f2d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
| 3 | Date: Thu, 10 Aug 2017 08:27:32 -0500 | ||
| 4 | Subject: [PATCH] Handle errors from socket calls | ||
| 5 | |||
| 6 | Adds handling for socket() or read() returning a | ||
| 7 | negative value (indicating an error has occurred). | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [dts@apple.com] | ||
| 10 | |||
| 11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
| 12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
| 13 | --- | ||
| 14 | mDNSPosix/mDNSPosix.c | 12 +++++++++--- | ||
| 15 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
| 18 | index 776531dbc8e8..0c9dd2582660 100644 | ||
| 19 | --- a/mDNSPosix/mDNSPosix.c | ||
| 20 | +++ b/mDNSPosix/mDNSPosix.c | ||
| 21 | @@ -1677,7 +1677,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
| 22 | // Read through the messages on sd and if any indicate that any interface records should | ||
| 23 | // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. | ||
| 24 | { | ||
| 25 | - ssize_t readCount; | ||
| 26 | + ssize_t readVal, readCount; | ||
| 27 | char buff[4096]; | ||
| 28 | struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; | ||
| 29 | |||
| 30 | @@ -1686,7 +1686,10 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
| 31 | // enough to hold all pending data and so avoid message fragmentation. | ||
| 32 | // (Note that FIONREAD is not supported on AF_NETLINK.) | ||
| 33 | |||
| 34 | - readCount = read(sd, buff, sizeof buff); | ||
| 35 | + readVal = read(sd, buff, sizeof buff); | ||
| 36 | + if (readVal < 0) return; | ||
| 37 | + readCount = readVal; | ||
| 38 | + | ||
| 39 | while (1) | ||
| 40 | { | ||
| 41 | // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. | ||
| 42 | @@ -1702,7 +1705,9 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
| 43 | pNLMsg = (struct nlmsghdr*) buff; | ||
| 44 | |||
| 45 | // read more data | ||
| 46 | - readCount += read(sd, buff + readCount, sizeof buff - readCount); | ||
| 47 | + readVal = read(sd, buff + readCount, sizeof buff - readCount); | ||
| 48 | + if (readVal < 0) return; | ||
| 49 | + readCount += readVal; | ||
| 50 | continue; // spin around and revalidate with new readCount | ||
| 51 | } | ||
| 52 | else | ||
| 53 | @@ -2017,6 +2022,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanReceiveUnicast(void) | ||
| 54 | int err; | ||
| 55 | int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | ||
| 56 | struct sockaddr_in s5353; | ||
| 57 | + if (s < 0) return mDNSfalse; | ||
| 58 | s5353.sin_family = AF_INET; | ||
| 59 | s5353.sin_port = MulticastDNSPort.NotAnInteger; | ||
| 60 | s5353.sin_addr.s_addr = 0; | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0009-remove-unneeded-headers.patch b/meta-networking/recipes-protocols/mdns/mdns/0009-remove-unneeded-headers.patch index 3784e3be81..e8785b1aa7 100644 --- a/meta-networking/recipes-protocols/mdns/mdns/0009-remove-unneeded-headers.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0009-remove-unneeded-headers.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From d15ee692af42163846be7517372f3ee098cdaf18 Mon Sep 17 00:00:00 2001 | 1 | From 8e32fb0876a073c23ab73047a2e0f6d011b3660c Mon Sep 17 00:00:00 2001 |
| 2 | From: Beniamin Sandu <beniaminsandu@gmail.com> | 2 | From: Beniamin Sandu <beniaminsandu@gmail.com> |
| 3 | Date: Thu, 15 Jun 2023 17:02:58 +0000 | 3 | Date: Thu, 15 Jun 2023 17:02:58 +0000 |
| 4 | Subject: [PATCH] remove unneeded headers | 4 | Subject: [PATCH] remove unneeded headers |
diff --git a/meta-networking/recipes-protocols/mdns/mdns_2559.80.8.bb b/meta-networking/recipes-protocols/mdns/mdns_2600.100.147.bb index fc5add6c12..af1400ca6e 100644 --- a/meta-networking/recipes-protocols/mdns/mdns_2559.80.8.bb +++ b/meta-networking/recipes-protocols/mdns/mdns_2600.100.147.bb | |||
| @@ -6,30 +6,19 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=31c50371921e0fb731003bbc665f29bf" | |||
| 6 | 6 | ||
| 7 | DEPENDS:append:libc-musl = " musl-nscd" | 7 | DEPENDS:append:libc-musl = " musl-nscd" |
| 8 | 8 | ||
| 9 | SRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=${BRANCH} \ | 9 | SRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=${BRANCH};tag=mDNSResponder-${PV} \ |
| 10 | file://0001-dns-sd-Include-missing-headers.patch \ | 10 | file://0001-dns-sd-Include-missing-headers.patch \ |
| 11 | file://0002-make-Set-libdns_sd.so-soname-correctly.patch \ | 11 | file://0002-make-Set-libdns_sd.so-soname-correctly.patch \ |
| 12 | file://0004-make-Separate-TLS-targets-from-libraries.patch \ | 12 | file://0004-make-Separate-TLS-targets-from-libraries.patch \ |
| 13 | file://0005-mDNSCore-Fix-broken-debug-parameter.patch \ | 13 | file://0005-mDNSCore-Fix-broken-debug-parameter.patch \ |
| 14 | file://0006-make-Add-top-level-Makefile.patch \ | 14 | file://0006-make-Add-top-level-Makefile.patch \ |
| 15 | file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch \ | ||
| 16 | file://0002-Create-subroutine-for-tearing-down-an-interface.patch \ | ||
| 17 | file://0003-Track-interface-socket-family.patch \ | ||
| 18 | file://0004-Indicate-loopback-interface-to-mDNS-core.patch \ | ||
| 19 | file://0005-Use-list-for-changed-interfaces.patch \ | ||
| 20 | file://0006-Handle-noisy-netlink-sockets.patch \ | ||
| 21 | file://0007-Mark-deleted-interfaces-as-being-changed.patch \ | ||
| 22 | file://0008-Handle-errors-from-socket-calls.patch \ | ||
| 23 | file://0009-remove-unneeded-headers.patch \ | 15 | file://0009-remove-unneeded-headers.patch \ |
| 24 | file://mdns.service \ | ||
| 25 | file://0001-Handle-interface-without-ifa_addr.patch \ | ||
| 26 | file://0001-Fix-SIGSEGV-during-DumpStateLog.patch \ | ||
| 27 | file://0005-Fix-missing-limit-declarations.patch \ | 16 | file://0005-Fix-missing-limit-declarations.patch \ |
| 28 | file://0004-Add-definition-for-MAX.patch \ | ||
| 29 | file://0001-Fix-build-with-gcc-15.patch \ | 17 | file://0001-Fix-build-with-gcc-15.patch \ |
| 18 | file://mdns.service \ | ||
| 30 | " | 19 | " |
| 31 | BRANCH = "rel/mDNSResponder-2559" | 20 | BRANCH = "main" |
| 32 | SRCREV = "ecc02274878b0a70dba229de642b081cd1c30927" | 21 | SRCREV = "d89f8d1d0e001b810d6c055aa2a57b768bcf9aa2" |
| 33 | 22 | ||
| 34 | # We install a stub Makefile in the top directory so that the various checks | 23 | # We install a stub Makefile in the top directory so that the various checks |
| 35 | # in base.bbclass pass their tests for a Makefile, this ensures (that amongst | 24 | # in base.bbclass pass their tests for a Makefile, this ensures (that amongst |
