meta-openembedded/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch
Matt Hoosier a44430fe91 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>
2020-02-06 07:20:03 -08:00

51 lines
1.6 KiB
Diff

From 71a7c728ae0d8143b66aa40decca74ebaa9aa2ce 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 03/11] Track interface socket family
Tracks the socket family associated with the interface.
Upstream-Status: Submitted [dts@apple.com]
Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
---
mDNSPosix/mDNSPosix.c | 1 +
mDNSPosix/mDNSPosix.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
index 5e5b2cd..8fe22be 100644
--- a/mDNSPosix/mDNSPosix.c
+++ b/mDNSPosix/mDNSPosix.c
@@ -918,6 +918,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct
// Set up the extra fields in PosixNetworkInterface.
assert(intf->intfName != NULL); // intf->intfName already set up above
intf->index = intfIndex;
+ intf->sa_family = intfAddr->sa_family;
intf->multicastSocket4 = -1;
#if HAVE_IPV6
intf->multicastSocket6 = -1;
diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h
index ca60d80..f77c185 100644
--- a/mDNSPosix/mDNSPosix.h
+++ b/mDNSPosix/mDNSPosix.h
@@ -19,6 +19,7 @@
#define __mDNSPlatformPosix_h
#include <signal.h>
+#include <sys/socket.h>
#include <sys/time.h>
#ifdef __cplusplus
@@ -40,6 +41,7 @@ struct PosixNetworkInterface
const char * intfName;
PosixNetworkInterface * aliasIntf;
int index;
+ sa_family_t sa_family;
int multicastSocket4;
#if HAVE_IPV6
int multicastSocket6;
--
2.17.1