-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mdns] update mDNSResponder to 1790.80.10 (#1919)
- Loading branch information
Showing
13 changed files
with
878 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From e136dcdcdd93ef32ada981e89c195905eb809eea Mon Sep 17 00:00:00 2001 | ||
Message-ID: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
From: Nate Karstens <[email protected]> | ||
Date: Thu, 23 Mar 2023 00:15:52 -0500 | ||
Subject: [PATCH] Fix Linux build | ||
|
||
The __block qualifier is not used in Linux builds. | ||
|
||
Signed-off-by: Nate Karstens <[email protected]> | ||
--- | ||
mDNSShared/uds_daemon.c | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c | ||
index 9ae5f78..5a00bb5 100644 | ||
--- a/mDNSShared/uds_daemon.c | ||
+++ b/mDNSShared/uds_daemon.c | ||
@@ -2912,7 +2912,11 @@ exit: | ||
mDNSlocal mStatus add_domain_to_browser(request_state *info, const domainname *d) | ||
{ | ||
browser_t *b, *p; | ||
+#if defined(TARGET_OS_MAC) && TARGET_OS_MAC | ||
__block mStatus err; | ||
+#else | ||
+ mStatus err; | ||
+#endif | ||
|
||
for (p = info->u.browser.browsers; p; p = p->next) | ||
{ | ||
-- | ||
2.41.0 | ||
|
64 changes: 64 additions & 0 deletions
64
third_party/mDNSResponder/0002-Create-subroutine-for-cleaning-recent-interfaces.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
From 4f7970ac1615aba7a39ae94c1ca14135265574e9 Mon Sep 17 00:00:00 2001 | ||
Message-ID: <4f7970ac1615aba7a39ae94c1ca14135265574e9.1687508149.git.stefan@agner.ch> | ||
In-Reply-To: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
References: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
From: Nate Karstens <[email protected]> | ||
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 [[email protected]] | ||
|
||
Signed-off-by: Nate Karstens <[email protected]> | ||
Signed-off-by: Alex Kiernan <[email protected]> | ||
--- | ||
mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- | ||
1 file changed, 14 insertions(+), 10 deletions(-) | ||
|
||
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
index 0a7c3df..fe7242d 100644 | ||
--- a/mDNSPosix/mDNSPosix.c | ||
+++ b/mDNSPosix/mDNSPosix.c | ||
@@ -1322,6 +1322,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; mdns_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, | ||
@@ -1559,16 +1572,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; mdns_free(pi); } | ||
- } | ||
+ CleanRecentInterfaces(); | ||
|
||
return err; | ||
} | ||
-- | ||
2.41.0 | ||
|
62 changes: 62 additions & 0 deletions
62
third_party/mDNSResponder/0003-Create-subroutine-for-tearing-down-an-interface.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
From f7ab91f739b936305ca56743adfb4673e3f2f4ba Mon Sep 17 00:00:00 2001 | ||
Message-ID: <f7ab91f739b936305ca56743adfb4673e3f2f4ba.1687508149.git.stefan@agner.ch> | ||
In-Reply-To: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
References: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
From: Nate Karstens <[email protected]> | ||
Date: Wed, 28 Jun 2017 17:30:00 -0500 | ||
Subject: [PATCH] Create subroutine for tearing down an interface | ||
|
||
Creates a subroutine for tearing down an interface. | ||
|
||
Upstream-Status: Submitted [[email protected]] | ||
|
||
Signed-off-by: Nate Karstens <[email protected]> | ||
Signed-off-by: Alex Kiernan <[email protected]> | ||
--- | ||
mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ | ||
1 file changed, 16 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
index fe7242d..a32a880 100644 | ||
--- a/mDNSPosix/mDNSPosix.c | ||
+++ b/mDNSPosix/mDNSPosix.c | ||
@@ -1043,6 +1043,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) | ||
gRecentInterfaces = intf; | ||
} | ||
|
||
+mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf) | ||
+{ | ||
+ mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); | ||
+ if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); | ||
+ FreePosixNetworkInterface(intf); | ||
+ | ||
+ num_registered_interfaces--; | ||
+ if (num_registered_interfaces == 0) { | ||
+ num_pkts_accepted = 0; | ||
+ num_pkts_rejected = 0; | ||
+ } | ||
+} | ||
+ | ||
// Grab the first interface, deregister it, free it, and repeat until done. | ||
mDNSlocal void ClearInterfaceList(mDNS *const m) | ||
{ | ||
@@ -1051,13 +1064,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) | ||
while (m->HostInterfaces) | ||
{ | ||
PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); | ||
- mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); | ||
- if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); | ||
- FreePosixNetworkInterface(intf); | ||
+ TearDownInterface(m, intf); | ||
} | ||
- num_registered_interfaces = 0; | ||
- num_pkts_accepted = 0; | ||
- num_pkts_rejected = 0; | ||
+ | ||
+ assert(num_registered_interfaces == 0); | ||
} | ||
|
||
mDNSlocal int SetupIPv6Socket(int fd) | ||
-- | ||
2.41.0 | ||
|
54 changes: 54 additions & 0 deletions
54
third_party/mDNSResponder/0004-Track-interface-socket-family.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 542c1b2ce1dcc069cf848d11978c8b6ae5982b6e Mon Sep 17 00:00:00 2001 | ||
Message-ID: <542c1b2ce1dcc069cf848d11978c8b6ae5982b6e.1687508149.git.stefan@agner.ch> | ||
In-Reply-To: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
References: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
From: Nate Karstens <[email protected]> | ||
Date: Wed, 28 Jun 2017 17:30:00 -0500 | ||
Subject: [PATCH] Track interface socket family | ||
|
||
Tracks the socket family associated with the interface. | ||
|
||
Upstream-Status: Submitted [[email protected]] | ||
|
||
Signed-off-by: Nate Karstens <[email protected]> | ||
Signed-off-by: Alex Kiernan <[email protected]> | ||
--- | ||
mDNSPosix/mDNSPosix.c | 1 + | ||
mDNSPosix/mDNSPosix.h | 2 ++ | ||
2 files changed, 3 insertions(+) | ||
|
||
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
index a32a880..9a5b4d7 100644 | ||
--- a/mDNSPosix/mDNSPosix.c | ||
+++ b/mDNSPosix/mDNSPosix.c | ||
@@ -1415,6 +1415,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 9675591..dd7864c 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 | ||
char * intfName; | ||
PosixNetworkInterface * aliasIntf; | ||
int index; | ||
+ sa_family_t sa_family; | ||
int multicastSocket4; | ||
#if HAVE_IPV6 | ||
int multicastSocket6; | ||
-- | ||
2.41.0 | ||
|
61 changes: 61 additions & 0 deletions
61
third_party/mDNSResponder/0005-Indicate-loopback-interface-to-mDNS-core.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
From 44385771ef63f081ed7e80eae6f24591046b4c7c Mon Sep 17 00:00:00 2001 | ||
Message-ID: <44385771ef63f081ed7e80eae6f24591046b4c7c.1687508149.git.stefan@agner.ch> | ||
In-Reply-To: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
References: <e136dcdcdd93ef32ada981e89c195905eb809eea.1687508149.git.stefan@agner.ch> | ||
From: Nate Karstens <[email protected]> | ||
Date: Tue, 1 Aug 2017 17:06:01 -0500 | ||
Subject: [PATCH] Indicate loopback interface to mDNS core | ||
|
||
Tells the mDNS core if an interface is a loopback interface, | ||
similar to AddInterfaceToList() in the MacOS implementation. | ||
|
||
Upstream-Status: Submitted [[email protected]] | ||
|
||
Signed-off-by: Nate Karstens <[email protected]> | ||
Signed-off-by: Alex Kiernan <[email protected]> | ||
--- | ||
mDNSPosix/mDNSPosix.c | 7 ++++--- | ||
1 file changed, 4 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
index 9a5b4d7..02a19b4 100644 | ||
--- a/mDNSPosix/mDNSPosix.c | ||
+++ b/mDNSPosix/mDNSPosix.c | ||
@@ -1348,7 +1348,7 @@ mDNSlocal void CleanRecentInterfaces(void) | ||
// 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 mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex) | ||
+ const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex, int intfFlags) | ||
{ | ||
int err = 0; | ||
PosixNetworkInterface *intf; | ||
@@ -1411,6 +1411,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
|
||
intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; | ||
intf->coreIntf.McastTxRx = mDNStrue; | ||
+ intf->coreIntf.Loopback = ((intfFlags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; | ||
|
||
// Set up the extra fields in PosixNetworkInterface. | ||
assert(intf->intfName != NULL); // intf->intfName already set up above | ||
@@ -1561,7 +1562,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
} | ||
#endif | ||
if (SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, | ||
- hwaddr, hwaddr_len, i->ifa_name, ifIndex) == 0) | ||
+ hwaddr, hwaddr_len, i->ifa_name, ifIndex, i->ifa_flags) == 0) | ||
{ | ||
if (i->ifa_addr->sa_family == AF_INET) | ||
foundav4 = mDNStrue; | ||
@@ -1578,7 +1579,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
// if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) | ||
if (!foundav4 && firstLoopback) | ||
(void) SetupOneInterface(m, firstLoopback->ifa_addr, firstLoopback->ifa_netmask, | ||
- NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex); | ||
+ NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex, firstLoopback->ifa_flags); | ||
} | ||
|
||
// Clean up. | ||
-- | ||
2.41.0 | ||
|
Oops, something went wrong.