summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch
diff options
context:
space:
mode:
authorMatt Hoosier <matt.hoosier@garmin.com>2020-02-05 16:04:49 -0600
committerKhem Raj <raj.khem@gmail.com>2020-02-06 07:20:03 -0800
commita44430fe9115f58aa72f211cb114a2e1f63bf4c5 (patch)
tree8e7fe886e280dfe9e92a554b474fa32924ec85ef /meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch
parentfd2765bb16d6a895d3d6d4886add4b8b6a1baa20 (diff)
downloadmeta-openembedded-a44430fe9115f58aa72f211cb114a2e1f63bf4c5.tar.gz
mdns: improve numerous aspects of Posix backend
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>
Diffstat (limited to 'meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch')
-rw-r--r--meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch b/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch
new file mode 100644
index 0000000000..21ba318499
--- /dev/null
+++ b/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch
@@ -0,0 +1,58 @@
1From a2148df99ddcd122247f95c4cbcce5c4118581a1 Mon Sep 17 00:00:00 2001
2From: Nate Karstens <nate.karstens@garmin.com>
3Date: Wed, 28 Jun 2017 17:30:00 -0500
4Subject: [PATCH 02/11] Create subroutine for tearing down an interface
5
6Creates a subroutine for tearing down an interface.
7
8Upstream-Status: Submitted [dts@apple.com]
9
10Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
11---
12 mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------
13 1 file changed, 16 insertions(+), 6 deletions(-)
14
15diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
16index ffc9696..5e5b2cd 100644
17--- a/mDNSPosix/mDNSPosix.c
18+++ b/mDNSPosix/mDNSPosix.c
19@@ -591,6 +591,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
20 gRecentInterfaces = intf;
21 }
22
23+mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf)
24+{
25+ mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation);
26+ if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
27+ FreePosixNetworkInterface(intf);
28+
29+ num_registered_interfaces--;
30+ if (num_registered_interfaces == 0) {
31+ num_pkts_accepted = 0;
32+ num_pkts_rejected = 0;
33+ }
34+}
35+
36 // Grab the first interface, deregister it, free it, and repeat until done.
37 mDNSlocal void ClearInterfaceList(mDNS *const m)
38 {
39@@ -599,13 +612,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m)
40 while (m->HostInterfaces)
41 {
42 PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
43- mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation);
44- if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
45- FreePosixNetworkInterface(intf);
46+ TearDownInterface(m, intf);
47 }
48- num_registered_interfaces = 0;
49- num_pkts_accepted = 0;
50- num_pkts_rejected = 0;
51+
52+ assert(num_registered_interfaces == 0);
53 }
54
55 // Sets up a send/receive socket.
56--
572.17.1
58