meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch
Mikko Rapeli 21afab4609 mdns: update to version 1096.40.7
Refresh Makefile patch (build.patch) to properly cross compile
mdns. Then try refresh patches which still apply. Following patches
don't apply anymore due to refactoring done on mdns side so thus
dropping patches:

 * 0005-Handle-noisy-netlink-sockets.patch
 * 0007-Indicate-loopback-interface-to-mDNS-core.patch

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2020-09-08 11:53:53 -07:00

60 lines
2.2 KiB
Diff

From 6d90f9fdaf008f5c3b8fd8d91594fa1461437888 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] 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 | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
index a63cd19..7aeee7b 100755
--- a/mDNSPosix/mDNSPosix.c
+++ b/mDNSPosix/mDNSPosix.c
@@ -1199,6 +1199,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)
@@ -1388,15 +1401,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m)
// 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; free(pi); }
- }
+ CleanRecentInterfaces();
return err;
}
--
2.20.1