diff options
Diffstat (limited to 'meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch')
-rw-r--r-- | meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch | 59 |
1 files changed, 59 insertions, 0 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 new file mode 100644 index 000000000..f8efc1044 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From 6d90f9fdaf008f5c3b8fd8d91594fa1461437888 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 | --- | ||
13 | mDNSPosix/mDNSPosix.c | 23 ++++++++++++++--------- | ||
14 | 1 file changed, 14 insertions(+), 9 deletions(-) | ||
15 | |||
16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
17 | index a63cd19..7aeee7b 100755 | ||
18 | --- a/mDNSPosix/mDNSPosix.c | ||
19 | +++ b/mDNSPosix/mDNSPosix.c | ||
20 | @@ -1199,6 +1199,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf | ||
21 | return err; | ||
22 | } | ||
23 | |||
24 | +// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | ||
25 | +mDNSlocal void CleanRecentInterfaces(void) | ||
26 | +{ | ||
27 | + PosixNetworkInterface **ri = &gRecentInterfaces; | ||
28 | + const mDNSs32 utc = mDNSPlatformUTC(); | ||
29 | + while (*ri) | ||
30 | + { | ||
31 | + PosixNetworkInterface *pi = *ri; | ||
32 | + if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | ||
33 | + else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } | ||
34 | + } | ||
35 | +} | ||
36 | + | ||
37 | // Creates a PosixNetworkInterface for the interface whose IP address is | ||
38 | // intfAddr and whose name is intfName and registers it with mDNS core. | ||
39 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, const char *intfName, int intfIndex) | ||
40 | @@ -1388,15 +1401,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
41 | // Clean up. | ||
42 | if (intfList != NULL) freeifaddrs(intfList); | ||
43 | |||
44 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | ||
45 | - PosixNetworkInterface **ri = &gRecentInterfaces; | ||
46 | - const mDNSs32 utc = mDNSPlatformUTC(); | ||
47 | - while (*ri) | ||
48 | - { | ||
49 | - PosixNetworkInterface *pi = *ri; | ||
50 | - if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | ||
51 | - else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } | ||
52 | - } | ||
53 | + CleanRecentInterfaces(); | ||
54 | |||
55 | return err; | ||
56 | } | ||
57 | -- | ||
58 | 2.20.1 | ||
59 | |||