mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-16 04:17:25 +00:00
a44430fe91
Apple's default implementation of the Posix backend for mDNSResponder has a number of weaknesses. Address several of them, most notably: * Improve interface tracking, preventing confusion to mdns's state machine. Prevents spurious removal/republication cycles whenever network interfaces are added or removed. * Support network interfaces whose indeces are great than 31. Indices grow past that range surprisingly quickly, especially with multi- homed, mobile, wifi, Bluetooth, VPN, VLANs, or other interfaces present. * Correctly handle edge cases during removal of a network interface. The fixes are kept as a patch series for clarity. Signed-off-by: Matt Hoosier <matt.hoosier@garmin.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
61 lines
2.2 KiB
Diff
61 lines
2.2 KiB
Diff
From 89ea6ac4a8840e8c2be0140a9805c6522c6c5280 Mon Sep 17 00:00:00 2001
|
|
From: Nate Karstens <nate.karstens@garmin.com>
|
|
Date: Wed, 28 Jun 2017 17:30:00 -0500
|
|
Subject: [PATCH 01/11] 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 <nate.karstens@garmin.com>
|
|
---
|
|
mDNSPosix/mDNSPosix.c | 24 ++++++++++++++----------
|
|
1 file changed, 14 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
|
|
index 0e10bd5..ffc9696 100644
|
|
--- a/mDNSPosix/mDNSPosix.c
|
|
+++ b/mDNSPosix/mDNSPosix.c
|
|
@@ -856,6 +856,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
|
|
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; 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, const char *intfName, int intfIndex)
|
|
@@ -1010,16 +1023,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m)
|
|
|
|
// Clean up.
|
|
if (intfList != NULL) free_ifi_info(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; free(pi); }
|
|
- }
|
|
+ CleanRecentInterfaces();
|
|
|
|
return err;
|
|
}
|
|
--
|
|
2.17.1
|
|
|