diff options
23 files changed, 707 insertions, 557 deletions
diff --git a/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch b/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch deleted file mode 100644 index c743b3eddb..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | From ea442b57f7a9bcd41d5b5bd1cafde4dbe5685d41 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 4 Nov 2021 07:31:32 -0700 | ||
4 | Subject: [PATCH] dns-sd: Include missing headers | ||
5 | |||
6 | Fixes build on Musl | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Clients/dns-sd.c | 2 ++ | ||
12 | 1 file changed, 2 insertions(+) | ||
13 | |||
14 | --- a/Clients/dns-sd.c | ||
15 | +++ b/Clients/dns-sd.c | ||
16 | @@ -58,11 +58,13 @@ | ||
17 | //#define TEST_NEW_CLIENTSTUB 1 | ||
18 | |||
19 | #include <ctype.h> | ||
20 | +#include <stdarg.h> // For va_args | ||
21 | #include <stdio.h> // For stdout, stderr | ||
22 | #include <stdlib.h> // For exit() | ||
23 | #include <string.h> // For strlen(), strcpy() | ||
24 | #include <errno.h> // For errno, EINTR | ||
25 | #include <time.h> | ||
26 | +#include <sys/param.h> // For MIN | ||
27 | #include <sys/types.h> // For u_char | ||
28 | #ifdef APPLE_OSX_mDNSResponder | ||
29 | #include <inttypes.h> // For PRId64 | ||
30 | --- a/mDNSPosix/nss_mdns.c | ||
31 | +++ b/mDNSPosix/nss_mdns.c | ||
32 | @@ -89,6 +89,9 @@ | ||
33 | |||
34 | #include <dns_sd.h> | ||
35 | |||
36 | +#if !defined(NETDB_INTERNAL) | ||
37 | +# define NETDB_INTERNAL (-1) | ||
38 | +#endif | ||
39 | |||
40 | //---------- | ||
41 | // Public functions | ||
diff --git a/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch b/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch deleted file mode 100644 index c57ce8fa53..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | From d744609c56f9872e5aa71707f1f71feec9867f51 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mikko Rapeli <mikko.rapeli@bmw.de> | ||
3 | Date: Tue, 14 Jul 2020 16:36:29 +0000 | ||
4 | Subject: [PATCH 1/2] mdns: include <stddef.h> for NULL | ||
5 | |||
6 | Fixes build error with version 1096.40.7: | ||
7 | |||
8 | ../mDNSCore/mDNS.c:11385:26: error: 'NULL' undeclared (first use in this function) | ||
9 | 11385 | const char *reason = NULL; | ||
10 | | ^~~~ | ||
11 | ../mDNSCore/mDNS.c:56:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'? | ||
12 | 55 | #include "dns_sd_internal.h" | ||
13 | +++ |+#include <stddef.h> | ||
14 | 56 | | ||
15 | ../mDNSCore/mDNS.c:11385:26: note: each undeclared identifier is reported only once for each function it appears in | ||
16 | 11385 | const char *reason = NULL; | ||
17 | | ^~~~ | ||
18 | |||
19 | Upstream-Status: Pending | ||
20 | |||
21 | Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> | ||
22 | --- | ||
23 | mDNSCore/mDNS.c | 1 + | ||
24 | 1 file changed, 1 insertion(+) | ||
25 | |||
26 | diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c | ||
27 | index 2fbea04..d4b9af5 100755 | ||
28 | --- a/mDNSCore/mDNS.c | ||
29 | +++ b/mDNSCore/mDNS.c | ||
30 | @@ -23,6 +23,7 @@ | ||
31 | * routines, or types (which may or may not be present on any given platform). | ||
32 | */ | ||
33 | |||
34 | +#include <stddef.h> /* for NULL */ | ||
35 | #include "DNSCommon.h" // Defines general DNS utility routines | ||
36 | #include "uDNS.h" // Defines entry points into unicast-specific routines | ||
37 | |||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch b/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch deleted file mode 100644 index 33590ffc57..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | From 72405143f9d16514e70b88bc4843c9634b88036a Mon Sep 17 00:00:00 2001 | ||
2 | From: Brendan Le Foll <brendan.le.foll@intel.com> | ||
3 | Date: Tue, 3 Mar 2015 11:42:57 +0000 | ||
4 | Subject: [PATCH 2/2] mdns: cross compilation fixes for bitbake | ||
5 | |||
6 | Fixes several build errors when incorrect compiler or | ||
7 | compiler flags are used. | ||
8 | |||
9 | Upstream-Status: Inappropriate [OE-specific] | ||
10 | |||
11 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
12 | Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> | ||
13 | --- | ||
14 | mDNSPosix/Makefile | 44 ++++++++++++++++++++------------------------ | ||
15 | 1 file changed, 20 insertions(+), 24 deletions(-) | ||
16 | |||
17 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | ||
18 | index 78222e0..18a3af5 100755 | ||
19 | --- a/mDNSPosix/Makefile | ||
20 | +++ b/mDNSPosix/Makefile | ||
21 | @@ -50,6 +50,7 @@ | ||
22 | |||
23 | LIBVERS = 1 | ||
24 | |||
25 | +POSIXDIR = ../mDNSPosix | ||
26 | COREDIR = ../mDNSCore | ||
27 | SHAREDDIR ?= ../mDNSShared | ||
28 | DSODIR ?= ../DSO | ||
29 | @@ -62,16 +63,16 @@ else ifeq ($(SYSTEM), Linux) | ||
30 | os=linux | ||
31 | endif | ||
32 | |||
33 | -CC = cc | ||
34 | -BISON = bison | ||
35 | -FLEX = flex | ||
36 | -ST = strip | ||
37 | -LD = ld | ||
38 | +CC ?= cc | ||
39 | +BISON ?= bison | ||
40 | +FLEX ?= flex | ||
41 | +ST ?= strip | ||
42 | +LD ?= ld | ||
43 | SOOPTS = -shared | ||
44 | CP = cp | ||
45 | RM = rm | ||
46 | LN = ln -s -f | ||
47 | -CFLAGS_COMMON = -I$(COREDIR) -I$(SHAREDDIR) -I$(DSODIR) -I$(PROXYDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" | ||
48 | +CFLAGS_COMMON = -I$(POSIXDIR) -I$(COREDIR) -I$(SHAREDDIR) -I$(DSODIR) -I$(PROXYDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" | ||
49 | CFLAGS_PTHREAD = | ||
50 | LINKOPTS = | ||
51 | LINKOPTS_PTHREAD = -lpthread | ||
52 | @@ -85,6 +86,7 @@ CFLAGS_OPEN_SOURCE= | ||
53 | endif | ||
54 | |||
55 | # Set up diverging paths for debug vs. prod builds | ||
56 | +DEBUG ?= 1 | ||
57 | ifeq "$(DEBUG)" "1" | ||
58 | CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=2 | ||
59 | OBJDIR = objects/debug | ||
60 | @@ -101,8 +103,8 @@ else | ||
61 | # 1. We want to make small binaries, suitable for putting into hardware devices | ||
62 | # 2. Some of the code analysis warnings only work when some form of optimization is enabled | ||
63 | CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=0 | ||
64 | -OBJDIR ?= objects/prod | ||
65 | -BUILDDIR ?= build/prod | ||
66 | +OBJDIR = objects/prod | ||
67 | +BUILDDIR = build/prod | ||
68 | STRIP = $(ST) -S | ||
69 | endif | ||
70 | endif | ||
71 | @@ -125,7 +127,7 @@ else | ||
72 | # any target that contains the string "linux" | ||
73 | ifeq ($(findstring linux,$(os)),linux) | ||
74 | CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -ftabstop=4 | ||
75 | -LD = $(CC) | ||
76 | +LD ?= $(CC) | ||
77 | SOOPTS = -shared | ||
78 | FLEXFLAGS_OS = -l | ||
79 | JAVACFLAGS_OS += -I$(JDK)/include/linux | ||
80 | @@ -276,8 +278,7 @@ Daemon: setup $(BUILDDIR)/mdnsd | ||
81 | @echo "Responder daemon done" | ||
82 | |||
83 | $(BUILDDIR)/mdnsd: $(DAEMONOBJS) | ||
84 | - $(CC) -o $@ $+ $(LINKOPTS) | ||
85 | - $(STRIP) $@ | ||
86 | + $(LD) -o $@ $+ | ||
87 | |||
88 | # libdns_sd target builds the client library | ||
89 | libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | ||
90 | @@ -286,13 +287,9 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | ||
91 | CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o | ||
92 | |||
93 | $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) | ||
94 | - $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ | ||
95 | - $(STRIP) $@ | ||
96 | - | ||
97 | -Clients: setup libdns_sd ../Clients/build/dns-sd | ||
98 | - @echo "Clients done" | ||
99 | + $(LD) -shared $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ | ||
100 | |||
101 | -../Clients/build/dns-sd: ../Clients/dns-sd.c | ||
102 | +Clients: setup libdns_sd | ||
103 | $(MAKE) -C ../Clients DEBUG=$(DEBUG) SUPMAKE_CFLAGS="$(MDNSCFLAGS)" | ||
104 | |||
105 | # nss_mdns target builds the Name Service Switch module | ||
106 | @@ -300,8 +297,7 @@ nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE) | ||
107 | @echo "Name Service Switch module done" | ||
108 | |||
109 | $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o | ||
110 | - $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ | ||
111 | - $(STRIP) $@ | ||
112 | + $(LD) -shared $(LINKOPTS) -o $@ $+ | ||
113 | |||
114 | ############################################################################# | ||
115 | |||
116 | @@ -494,21 +490,21 @@ dnsextd: setup $(BUILDDIR)/dnsextd | ||
117 | @echo "dnsextd done" | ||
118 | |||
119 | $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(OBJDIR)/Client.c.o | ||
120 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
121 | + $(CC) $+ -o $@ | ||
122 | |||
123 | $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(OBJDIR)/Responder.c.o | ||
124 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
125 | + $(CC) $+ -o $@ | ||
126 | |||
127 | $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(OBJDIR)/ProxyResponder.c.o | ||
128 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
129 | + $(CC) $+ -o $@ | ||
130 | |||
131 | $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(OBJDIR)/NetMonitor.c.o | ||
132 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
133 | + $(CC) $+ -o $@ | ||
134 | |||
135 | $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c | ||
136 | |||
137 | $(BUILDDIR)/dnsextd: $(DNSEXTDOBJ) $(OBJDIR)/dnsextd.c.threadsafe.o | ||
138 | - $(CC) $+ -o $@ $(LINKOPTS) $(LINKOPTS_PTHREAD) | ||
139 | + $(CC) $+ -o $@ $(LINKOPTS_PTHREAD) | ||
140 | |||
141 | ############################################################################# | ||
142 | |||
143 | -- | ||
144 | 2.20.1 | ||
145 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch b/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch deleted file mode 100644 index b461a60df7..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | From 157d67f152777754c059ced7511352102f23ffae Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Mon, 24 Jul 2017 09:39:18 -0500 | ||
4 | Subject: [PATCH 06/11] Remove unneeded function | ||
5 | |||
6 | Removes a function we no longer need by integrating it into the only | ||
7 | function that calls it. This was originally separated so that we could | ||
8 | only process network interfaces that netlink indicated had been changed, | ||
9 | this has since been extended to test for all network intefaces. | ||
10 | |||
11 | Upstream-Status: Submitted [dts@apple.com] | ||
12 | |||
13 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
14 | --- | ||
15 | mDNSPosix/mDNSPosix.c | 13 ++----------- | ||
16 | 1 file changed, 2 insertions(+), 11 deletions(-) | ||
17 | |||
18 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
19 | index 59a8b8c..3fc5451 100644 | ||
20 | --- a/mDNSPosix/mDNSPosix.c | ||
21 | +++ b/mDNSPosix/mDNSPosix.c | ||
22 | @@ -1079,24 +1079,15 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) | ||
23 | return err; | ||
24 | } | ||
25 | |||
26 | -mDNSlocal mDNSBool ListContainsInterfaceIndex(GenLinkedList *list, int if_index) | ||
27 | +mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) | ||
28 | { | ||
29 | NetworkInterfaceIndex *item; | ||
30 | |||
31 | for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) | ||
32 | { | ||
33 | - if (if_index == item->if_index) return mDNStrue; | ||
34 | + if (if_index == item->if_index) return; | ||
35 | } | ||
36 | |||
37 | - return mDNSfalse; | ||
38 | -} | ||
39 | - | ||
40 | -mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) | ||
41 | -{ | ||
42 | - NetworkInterfaceIndex *item; | ||
43 | - | ||
44 | - if (ListContainsInterfaceIndex(list, if_index)) return; | ||
45 | - | ||
46 | item = malloc(sizeof *item); | ||
47 | if (item == NULL) return; | ||
48 | |||
49 | -- | ||
50 | 2.17.1 | ||
51 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch b/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch deleted file mode 100644 index 362d69768e..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | From 38cff19781f81586926b02f0fd1cb36c040395e0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Thu, 10 Aug 2017 08:21:53 -0500 | ||
4 | Subject: [PATCH 09/11] Fix possible NULL dereference | ||
5 | |||
6 | Fixes a possible NULL dereference if memory for | ||
7 | the PosixNetworkInterface could not be allocated. | ||
8 | Other logic seems to prevent dereferencing this | ||
9 | variable if NULL, but this instance seems to have | ||
10 | been overlooked. | ||
11 | |||
12 | Upstream-Status: Submitted [dts@apple.com] | ||
13 | |||
14 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
15 | --- | ||
16 | mDNSPosix/mDNSPosix.c | 11 +++++++---- | ||
17 | 1 file changed, 7 insertions(+), 4 deletions(-) | ||
18 | |||
19 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
20 | index a8a57df..3243ed4 100644 | ||
21 | --- a/mDNSPosix/mDNSPosix.c | ||
22 | +++ b/mDNSPosix/mDNSPosix.c | ||
23 | @@ -951,12 +951,15 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct ifi_info *const ifi) | ||
24 | |||
25 | // If interface is a direct link, address record will be marked as kDNSRecordTypeKnownUnique | ||
26 | // and skip the probe phase of the probe/announce packet sequence. | ||
27 | - intf->coreIntf.DirectLink = mDNSfalse; | ||
28 | + if (err == 0) | ||
29 | + { | ||
30 | + intf->coreIntf.DirectLink = mDNSfalse; | ||
31 | #ifdef DIRECTLINK_INTERFACE_NAME | ||
32 | - if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0) | ||
33 | - intf->coreIntf.DirectLink = mDNStrue; | ||
34 | + if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0) | ||
35 | + intf->coreIntf.DirectLink = mDNStrue; | ||
36 | #endif | ||
37 | - intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue; | ||
38 | + intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue; | ||
39 | + } | ||
40 | |||
41 | // The interface is all ready to go, let's register it with the mDNS core. | ||
42 | if (err == 0) | ||
43 | -- | ||
44 | 2.17.1 | ||
45 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch b/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch deleted file mode 100644 index d9adde04c2..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | From 9ff06108cd44e84ba6c68bfa6737e793f117e303 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Thu, 10 Aug 2017 08:46:03 -0500 | ||
4 | Subject: [PATCH] Change a dynamic allocation to file-scope variable | ||
5 | |||
6 | Changes a variable from being dynamically-allocated to being | ||
7 | statically-allocated at the file scope. Addresses a Coverity | ||
8 | issue where it appeared that the memory was being leaked. | ||
9 | |||
10 | Upstream-Status: Submitted [dts@apple.com] | ||
11 | |||
12 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
13 | --- | ||
14 | mDNSPosix/mDNSPosix.c | 14 ++++---------- | ||
15 | 1 file changed, 4 insertions(+), 10 deletions(-) | ||
16 | |||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
18 | index 7aeee7b..2d25016 100755 | ||
19 | --- a/mDNSPosix/mDNSPosix.c | ||
20 | +++ b/mDNSPosix/mDNSPosix.c | ||
21 | @@ -81,6 +81,7 @@ static sigset_t gEventSignalSet; // Signals which event loop list | ||
22 | static sigset_t gEventSignals; // Signals which were received while inside loop | ||
23 | |||
24 | static PosixNetworkInterface *gRecentInterfaces; | ||
25 | +static IfChangeRec gChgRec; | ||
26 | |||
27 | // *************************************************************************** | ||
28 | // Globals (for debugging) | ||
29 | @@ -1641,18 +1642,11 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
30 | mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m) | ||
31 | { | ||
32 | mStatus err; | ||
33 | - IfChangeRec *pChgRec; | ||
34 | |||
35 | - pChgRec = (IfChangeRec*) mDNSPlatformMemAllocateClear(sizeof *pChgRec); | ||
36 | - if (pChgRec == NULL) | ||
37 | - return mStatus_NoMemoryErr; | ||
38 | - | ||
39 | - pChgRec->mDNS = m; | ||
40 | - err = OpenIfNotifySocket(&pChgRec->NotifySD); | ||
41 | + gChgRec.mDNS = m; | ||
42 | + err = OpenIfNotifySocket(&gChgRec.NotifySD); | ||
43 | if (err == 0) | ||
44 | - err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec); | ||
45 | - if (err) | ||
46 | - mDNSPlatformMemFree(pChgRec); | ||
47 | + err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec); | ||
48 | |||
49 | return err; | ||
50 | } | ||
51 | -- | ||
52 | 2.20.1 | ||
53 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch index f8efc10448..91198dea73 100644 --- a/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 6d90f9fdaf008f5c3b8fd8d91594fa1461437888 Mon Sep 17 00:00:00 2001 | 1 | From c1f3e19d3cb0aa948248616eb1684a1e80aa39b4 Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 |
4 | Subject: [PATCH] Create subroutine for cleaning recent interfaces | 4 | Subject: [PATCH 1/8] Create subroutine for cleaning recent interfaces |
5 | 5 | ||
6 | Moves functionality for cleaning the list of recent | 6 | Moves functionality for cleaning the list of recent |
7 | interfaces into its own subroutine. | 7 | interfaces into its own subroutine. |
@@ -9,15 +9,16 @@ interfaces into its own subroutine. | |||
9 | Upstream-Status: Submitted [dts@apple.com] | 9 | Upstream-Status: Submitted [dts@apple.com] |
10 | 10 | ||
11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
12 | --- | 13 | --- |
13 | mDNSPosix/mDNSPosix.c | 23 ++++++++++++++--------- | 14 | mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- |
14 | 1 file changed, 14 insertions(+), 9 deletions(-) | 15 | 1 file changed, 14 insertions(+), 10 deletions(-) |
15 | 16 | ||
16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
17 | index a63cd19..7aeee7b 100755 | 18 | index 0a7c3dfa2475..fe7242d83599 100644 |
18 | --- a/mDNSPosix/mDNSPosix.c | 19 | --- a/mDNSPosix/mDNSPosix.c |
19 | +++ b/mDNSPosix/mDNSPosix.c | 20 | +++ b/mDNSPosix/mDNSPosix.c |
20 | @@ -1199,6 +1199,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf | 21 | @@ -1322,6 +1322,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf |
21 | return err; | 22 | return err; |
22 | } | 23 | } |
23 | 24 | ||
@@ -30,17 +31,18 @@ index a63cd19..7aeee7b 100755 | |||
30 | + { | 31 | + { |
31 | + PosixNetworkInterface *pi = *ri; | 32 | + PosixNetworkInterface *pi = *ri; |
32 | + if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | 33 | + if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; |
33 | + else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } | 34 | + else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } |
34 | + } | 35 | + } |
35 | +} | 36 | +} |
36 | + | 37 | + |
37 | // Creates a PosixNetworkInterface for the interface whose IP address is | 38 | // Creates a PosixNetworkInterface for the interface whose IP address is |
38 | // intfAddr and whose name is intfName and registers it with mDNS core. | 39 | // 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 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, |
40 | @@ -1388,15 +1401,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | 41 | @@ -1559,16 +1572,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) |
42 | |||
41 | // Clean up. | 43 | // Clean up. |
42 | if (intfList != NULL) freeifaddrs(intfList); | 44 | if (intfList != NULL) freeifaddrs(intfList); |
43 | 45 | - | |
44 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | 46 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute |
45 | - PosixNetworkInterface **ri = &gRecentInterfaces; | 47 | - PosixNetworkInterface **ri = &gRecentInterfaces; |
46 | - const mDNSs32 utc = mDNSPlatformUTC(); | 48 | - const mDNSs32 utc = mDNSPlatformUTC(); |
@@ -48,12 +50,12 @@ index a63cd19..7aeee7b 100755 | |||
48 | - { | 50 | - { |
49 | - PosixNetworkInterface *pi = *ri; | 51 | - PosixNetworkInterface *pi = *ri; |
50 | - if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; | 52 | - if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; |
51 | - else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } | 53 | - else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } |
52 | - } | 54 | - } |
53 | + CleanRecentInterfaces(); | 55 | + CleanRecentInterfaces(); |
54 | 56 | ||
55 | return err; | 57 | return err; |
56 | } | 58 | } |
57 | -- | 59 | -- |
58 | 2.20.1 | 60 | 2.35.1 |
59 | 61 | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch b/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch new file mode 100644 index 0000000000..4a60a95728 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From cea342c10731cb1c8c8b52f03d55f9d15fc3b091 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 4 Nov 2021 07:31:32 -0700 | ||
4 | Subject: [PATCH 1/6] dns-sd: Include missing headers | ||
5 | |||
6 | Fixes build on Musl | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | mDNSPosix/nss_mdns.c | 3 +++ | ||
12 | 1 file changed, 3 insertions(+) | ||
13 | |||
14 | diff --git a/mDNSPosix/nss_mdns.c b/mDNSPosix/nss_mdns.c | ||
15 | index afadb3c6c33b..84c312759463 100644 | ||
16 | --- a/mDNSPosix/nss_mdns.c | ||
17 | +++ b/mDNSPosix/nss_mdns.c | ||
18 | @@ -89,6 +89,9 @@ | ||
19 | |||
20 | #include <dns_sd.h> | ||
21 | |||
22 | +#if !defined(NETDB_INTERNAL) | ||
23 | +# define NETDB_INTERNAL (-1) | ||
24 | +#endif | ||
25 | |||
26 | //---------- | ||
27 | // Public functions | ||
28 | -- | ||
29 | 2.35.1 | ||
30 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch b/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch index 21ba318499..aa3dda8d55 100644 --- a/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch | |||
@@ -1,22 +1,23 @@ | |||
1 | From a2148df99ddcd122247f95c4cbcce5c4118581a1 Mon Sep 17 00:00:00 2001 | 1 | From 40ef0241afbb49f84e76afd65eb3ee17466bb582 Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 |
4 | Subject: [PATCH 02/11] Create subroutine for tearing down an interface | 4 | Subject: [PATCH 2/8] Create subroutine for tearing down an interface |
5 | 5 | ||
6 | Creates a subroutine for tearing down an interface. | 6 | Creates a subroutine for tearing down an interface. |
7 | 7 | ||
8 | Upstream-Status: Submitted [dts@apple.com] | 8 | Upstream-Status: Submitted [dts@apple.com] |
9 | 9 | ||
10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
11 | --- | 12 | --- |
12 | mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ | 13 | mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ |
13 | 1 file changed, 16 insertions(+), 6 deletions(-) | 14 | 1 file changed, 16 insertions(+), 6 deletions(-) |
14 | 15 | ||
15 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
16 | index ffc9696..5e5b2cd 100644 | 17 | index fe7242d83599..a32a880c0ce5 100644 |
17 | --- a/mDNSPosix/mDNSPosix.c | 18 | --- a/mDNSPosix/mDNSPosix.c |
18 | +++ b/mDNSPosix/mDNSPosix.c | 19 | +++ b/mDNSPosix/mDNSPosix.c |
19 | @@ -591,6 +591,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) | 20 | @@ -1043,6 +1043,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) |
20 | gRecentInterfaces = intf; | 21 | gRecentInterfaces = intf; |
21 | } | 22 | } |
22 | 23 | ||
@@ -36,7 +37,7 @@ index ffc9696..5e5b2cd 100644 | |||
36 | // Grab the first interface, deregister it, free it, and repeat until done. | 37 | // Grab the first interface, deregister it, free it, and repeat until done. |
37 | mDNSlocal void ClearInterfaceList(mDNS *const m) | 38 | mDNSlocal void ClearInterfaceList(mDNS *const m) |
38 | { | 39 | { |
39 | @@ -599,13 +612,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) | 40 | @@ -1051,13 +1064,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) |
40 | while (m->HostInterfaces) | 41 | while (m->HostInterfaces) |
41 | { | 42 | { |
42 | PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); | 43 | PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); |
@@ -52,7 +53,7 @@ index ffc9696..5e5b2cd 100644 | |||
52 | + assert(num_registered_interfaces == 0); | 53 | + assert(num_registered_interfaces == 0); |
53 | } | 54 | } |
54 | 55 | ||
55 | // Sets up a send/receive socket. | 56 | mDNSlocal int SetupIPv6Socket(int fd) |
56 | -- | 57 | -- |
57 | 2.17.1 | 58 | 2.35.1 |
58 | 59 | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch b/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch new file mode 100644 index 0000000000..7f660396b4 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | From a198bcd457abd04f2e22812ff3a37246aa564614 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
3 | Date: Mon, 5 Dec 2022 15:14:12 +0000 | ||
4 | Subject: [PATCH 2/6] make: Set libdns_sd.so soname correctly | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
8 | --- | ||
9 | mDNSPosix/Makefile | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | ||
13 | index 802a13dd70b6..5e74193c0e89 100755 | ||
14 | --- a/mDNSPosix/Makefile | ||
15 | +++ b/mDNSPosix/Makefile | ||
16 | @@ -276,7 +276,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | ||
17 | CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o $(OBJDIR)/dnssd_errstring.c.so.o | ||
18 | |||
19 | $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) | ||
20 | - $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ | ||
21 | + $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ | ||
22 | $(STRIP) $@ | ||
23 | |||
24 | Clients: setup libdns_sd ../Clients/build/dns-sd | ||
25 | -- | ||
26 | 2.35.1 | ||
27 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch b/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch index 8c0e6bf397..d2a9995ffa 100644 --- a/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch | |||
@@ -1,23 +1,24 @@ | |||
1 | From 71a7c728ae0d8143b66aa40decca74ebaa9aa2ce Mon Sep 17 00:00:00 2001 | 1 | From deb3a2c51f32e0d2741be11a492e727129f770e2 Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 | 3 | Date: Wed, 28 Jun 2017 17:30:00 -0500 |
4 | Subject: [PATCH 03/11] Track interface socket family | 4 | Subject: [PATCH 3/8] Track interface socket family |
5 | 5 | ||
6 | Tracks the socket family associated with the interface. | 6 | Tracks the socket family associated with the interface. |
7 | 7 | ||
8 | Upstream-Status: Submitted [dts@apple.com] | 8 | Upstream-Status: Submitted [dts@apple.com] |
9 | 9 | ||
10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 10 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
11 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
11 | --- | 12 | --- |
12 | mDNSPosix/mDNSPosix.c | 1 + | 13 | mDNSPosix/mDNSPosix.c | 1 + |
13 | mDNSPosix/mDNSPosix.h | 2 ++ | 14 | mDNSPosix/mDNSPosix.h | 2 ++ |
14 | 2 files changed, 3 insertions(+) | 15 | 2 files changed, 3 insertions(+) |
15 | 16 | ||
16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
17 | index 5e5b2cd..8fe22be 100644 | 18 | index a32a880c0ce5..9a5b4d7ea4cb 100644 |
18 | --- a/mDNSPosix/mDNSPosix.c | 19 | --- a/mDNSPosix/mDNSPosix.c |
19 | +++ b/mDNSPosix/mDNSPosix.c | 20 | +++ b/mDNSPosix/mDNSPosix.c |
20 | @@ -918,6 +918,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | 21 | @@ -1415,6 +1415,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct |
21 | // Set up the extra fields in PosixNetworkInterface. | 22 | // Set up the extra fields in PosixNetworkInterface. |
22 | assert(intf->intfName != NULL); // intf->intfName already set up above | 23 | assert(intf->intfName != NULL); // intf->intfName already set up above |
23 | intf->index = intfIndex; | 24 | intf->index = intfIndex; |
@@ -26,7 +27,7 @@ index 5e5b2cd..8fe22be 100644 | |||
26 | #if HAVE_IPV6 | 27 | #if HAVE_IPV6 |
27 | intf->multicastSocket6 = -1; | 28 | intf->multicastSocket6 = -1; |
28 | diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h | 29 | diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h |
29 | index ca60d80..f77c185 100644 | 30 | index 9675591b0434..dd7864cd0d5e 100644 |
30 | --- a/mDNSPosix/mDNSPosix.h | 31 | --- a/mDNSPosix/mDNSPosix.h |
31 | +++ b/mDNSPosix/mDNSPosix.h | 32 | +++ b/mDNSPosix/mDNSPosix.h |
32 | @@ -19,6 +19,7 @@ | 33 | @@ -19,6 +19,7 @@ |
@@ -38,7 +39,7 @@ index ca60d80..f77c185 100644 | |||
38 | 39 | ||
39 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |
40 | @@ -40,6 +41,7 @@ struct PosixNetworkInterface | 41 | @@ -40,6 +41,7 @@ struct PosixNetworkInterface |
41 | const char * intfName; | 42 | char * intfName; |
42 | PosixNetworkInterface * aliasIntf; | 43 | PosixNetworkInterface * aliasIntf; |
43 | int index; | 44 | int index; |
44 | + sa_family_t sa_family; | 45 | + sa_family_t sa_family; |
@@ -46,5 +47,5 @@ index ca60d80..f77c185 100644 | |||
46 | #if HAVE_IPV6 | 47 | #if HAVE_IPV6 |
47 | int multicastSocket6; | 48 | int multicastSocket6; |
48 | -- | 49 | -- |
49 | 2.17.1 | 50 | 2.35.1 |
50 | 51 | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch b/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch new file mode 100644 index 0000000000..0ac0bb6a45 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 4c0954f77ba05d77192ee1519929a39fbc978321 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
3 | Date: Mon, 5 Dec 2022 15:14:22 +0000 | ||
4 | Subject: [PATCH 3/6] mDNSShared: Drop MacOS specific __block qualifier | ||
5 | |||
6 | Support for this extension only exists in MacOS/Clang, also it's not | ||
7 | actually used here, so we can just drop it. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
11 | --- | ||
12 | mDNSShared/uds_daemon.c | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c | ||
16 | index 9ae5f78542d6..8c006b71a4ea 100644 | ||
17 | --- a/mDNSShared/uds_daemon.c | ||
18 | +++ b/mDNSShared/uds_daemon.c | ||
19 | @@ -2912,7 +2912,7 @@ exit: | ||
20 | mDNSlocal mStatus add_domain_to_browser(request_state *info, const domainname *d) | ||
21 | { | ||
22 | browser_t *b, *p; | ||
23 | - __block mStatus err; | ||
24 | + mStatus err; | ||
25 | |||
26 | for (p = info->u.browser.browsers; p; p = p->next) | ||
27 | { | ||
28 | -- | ||
29 | 2.35.1 | ||
30 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch b/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch new file mode 100644 index 0000000000..a5f7f0136b --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From beab76b5708862f44d9acbe7a92db45e2f99259f Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Tue, 1 Aug 2017 17:06:01 -0500 | ||
4 | Subject: [PATCH 4/8] Indicate loopback interface to mDNS core | ||
5 | |||
6 | Tells the mDNS core if an interface is a loopback interface, | ||
7 | similar to AddInterfaceToList() in the MacOS implementation. | ||
8 | |||
9 | Upstream-Status: Submitted [dts@apple.com] | ||
10 | |||
11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
13 | --- | ||
14 | mDNSPosix/mDNSPosix.c | 7 ++++--- | ||
15 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
18 | index 9a5b4d7ea4cb..02a19b438e03 100644 | ||
19 | --- a/mDNSPosix/mDNSPosix.c | ||
20 | +++ b/mDNSPosix/mDNSPosix.c | ||
21 | @@ -1348,7 +1348,7 @@ mDNSlocal void CleanRecentInterfaces(void) | ||
22 | // Creates a PosixNetworkInterface for the interface whose IP address is | ||
23 | // intfAddr and whose name is intfName and registers it with mDNS core. | ||
24 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, | ||
25 | - const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex) | ||
26 | + const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex, int intfFlags) | ||
27 | { | ||
28 | int err = 0; | ||
29 | PosixNetworkInterface *intf; | ||
30 | @@ -1411,6 +1411,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
31 | |||
32 | intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; | ||
33 | intf->coreIntf.McastTxRx = mDNStrue; | ||
34 | + intf->coreIntf.Loopback = ((intfFlags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; | ||
35 | |||
36 | // Set up the extra fields in PosixNetworkInterface. | ||
37 | assert(intf->intfName != NULL); // intf->intfName already set up above | ||
38 | @@ -1561,7 +1562,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
39 | } | ||
40 | #endif | ||
41 | if (SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, | ||
42 | - hwaddr, hwaddr_len, i->ifa_name, ifIndex) == 0) | ||
43 | + hwaddr, hwaddr_len, i->ifa_name, ifIndex, i->ifa_flags) == 0) | ||
44 | { | ||
45 | if (i->ifa_addr->sa_family == AF_INET) | ||
46 | foundav4 = mDNStrue; | ||
47 | @@ -1578,7 +1579,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
48 | // if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) | ||
49 | if (!foundav4 && firstLoopback) | ||
50 | (void) SetupOneInterface(m, firstLoopback->ifa_addr, firstLoopback->ifa_netmask, | ||
51 | - NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex); | ||
52 | + NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex, firstLoopback->ifa_flags); | ||
53 | } | ||
54 | |||
55 | // Clean up. | ||
56 | -- | ||
57 | 2.35.1 | ||
58 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch b/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch new file mode 100644 index 0000000000..a8e8dae60a --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From 22316f200803225f2d375ae5c36ffead59e2f6b8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
3 | Date: Mon, 5 Dec 2022 15:14:26 +0000 | ||
4 | Subject: [PATCH 4/6] make: Separate TLS targets from libraries | ||
5 | |||
6 | There are dependencies on TLSOBJS, which fails when `-lmbedtls` is | ||
7 | listed as a dependency, so separate it out. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
11 | --- | ||
12 | mDNSPosix/Makefile | 14 ++++++++------ | ||
13 | 1 file changed, 8 insertions(+), 6 deletions(-) | ||
14 | |||
15 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | ||
16 | index 5e74193c0e89..b4313c36b035 100755 | ||
17 | --- a/mDNSPosix/Makefile | ||
18 | +++ b/mDNSPosix/Makefile | ||
19 | @@ -112,9 +112,11 @@ ifeq ($(findstring linux,$(os)),linux) | ||
20 | ifeq ($(tls), no) | ||
21 | CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -ftabstop=4 -Wno-expansion-to-defined | ||
22 | TLSOBJS = | ||
23 | +TLSLIBS = | ||
24 | else | ||
25 | CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -DPOSIX_HAS_TLS -ftabstop=4 -Wno-expansion-to-defined | ||
26 | -TLSOBJS = $(OBJDIR)/mbedtls.c.o -lmbedtls -lmbedcrypto | ||
27 | +TLSOBJS = $(OBJDIR)/mbedtls.c.o | ||
28 | +TLSLIBS = -lmbedtls -lmbedcrypto | ||
29 | endif | ||
30 | LD = $(CC) | ||
31 | SOOPTS = -shared | ||
32 | @@ -266,7 +268,7 @@ Daemon: setup $(BUILDDIR)/mdnsd | ||
33 | @echo "Responder daemon done" | ||
34 | |||
35 | $(BUILDDIR)/mdnsd: $(DAEMONOBJS) | ||
36 | - $(CC) -o $@ $+ $(LINKOPTS) | ||
37 | + $(CC) -o $@ $+ $(LINKOPTS) $(TLSLIBS) | ||
38 | $(STRIP) $@ | ||
39 | |||
40 | # libdns_sd target builds the client library | ||
41 | @@ -485,16 +487,16 @@ dnsextd: setup $(BUILDDIR)/dnsextd | ||
42 | @echo "dnsextd done" | ||
43 | |||
44 | $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(TLSOBJS) $(OBJDIR)/Client.c.o | ||
45 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
46 | + $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) | ||
47 | |||
48 | $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(TLSOBJS) $(OBJDIR)/Responder.c.o | ||
49 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
50 | + $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) | ||
51 | |||
52 | $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(TLSOBJS) $(OBJDIR)/ProxyResponder.c.o | ||
53 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
54 | + $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) | ||
55 | |||
56 | $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(TLSOBJS) $(OBJDIR)/NetMonitor.c.o | ||
57 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
58 | + $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) | ||
59 | |||
60 | $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c | ||
61 | |||
62 | -- | ||
63 | 2.35.1 | ||
64 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch b/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch index db3a63ea48..1aec34f243 100644 --- a/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 798bfb5e984845a27874d1a244686db6e384d7b8 Mon Sep 17 00:00:00 2001 | 1 | From e79f81f5cd626ad77ec64de4325f6645cf253c5e Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Thu, 13 Jul 2017 09:00:00 -0500 | 3 | Date: Thu, 13 Jul 2017 09:00:00 -0500 |
4 | Subject: [PATCH 04/11] Use list for changed interfaces | 4 | Subject: [PATCH 5/8] Use list for changed interfaces |
5 | 5 | ||
6 | Uses a linked list to store the index of changed network interfaces | 6 | Uses a linked list to store the index of changed network interfaces |
7 | instead of a bitfield. This allows for network interfaces with an | 7 | instead of a bitfield. This allows for network interfaces with an |
@@ -10,15 +10,16 @@ index greater than 31 (an index of 36 was seen on Android). | |||
10 | Upstream-Status: Submitted [dts@apple.com] | 10 | Upstream-Status: Submitted [dts@apple.com] |
11 | 11 | ||
12 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 12 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
13 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
13 | --- | 14 | --- |
14 | mDNSPosix/mDNSPosix.c | 67 +++++++++++++++++++++++++++++++++---------- | 15 | mDNSPosix/mDNSPosix.c | 58 ++++++++++++++++++++++++++++++++----------- |
15 | 1 file changed, 52 insertions(+), 15 deletions(-) | 16 | 1 file changed, 43 insertions(+), 15 deletions(-) |
16 | 17 | ||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 18 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
18 | index 195d04b..bb883c1 100755 | 19 | index 02a19b438e03..e20adda92229 100644 |
19 | --- a/mDNSPosix/mDNSPosix.c | 20 | --- a/mDNSPosix/mDNSPosix.c |
20 | +++ b/mDNSPosix/mDNSPosix.c | 21 | +++ b/mDNSPosix/mDNSPosix.c |
21 | @@ -67,6 +67,14 @@ struct IfChangeRec | 22 | @@ -74,6 +74,14 @@ struct IfChangeRec |
22 | }; | 23 | }; |
23 | typedef struct IfChangeRec IfChangeRec; | 24 | typedef struct IfChangeRec IfChangeRec; |
24 | 25 | ||
@@ -33,29 +34,20 @@ index 195d04b..bb883c1 100755 | |||
33 | // Note that static data is initialized to zero in (modern) C. | 34 | // Note that static data is initialized to zero in (modern) C. |
34 | static PosixEventSource *gEventSources; // linked list of PosixEventSource's | 35 | static PosixEventSource *gEventSources; // linked list of PosixEventSource's |
35 | static sigset_t gEventSignalSet; // Signals which event loop listens for | 36 | static sigset_t gEventSignalSet; // Signals which event loop listens for |
36 | @@ -1458,6 +1466,32 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) | 37 | @@ -1621,6 +1629,23 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) |
37 | return err; | 38 | return err; |
38 | } | 39 | } |
39 | 40 | ||
40 | +mDNSlocal mDNSBool ListContainsInterfaceIndex(GenLinkedList *list, int if_index) | 41 | +mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) |
41 | +{ | 42 | +{ |
42 | + NetworkInterfaceIndex *item; | 43 | + NetworkInterfaceIndex *item; |
43 | + | 44 | + |
44 | + for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) | 45 | + for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) |
45 | + { | 46 | + { |
46 | + if (if_index == item->if_index) return mDNStrue; | 47 | + if (if_index == item->if_index) return; |
47 | + } | 48 | + } |
48 | + | 49 | + |
49 | + return mDNSfalse; | 50 | + item = mdns_malloc(sizeof *item); |
50 | +} | ||
51 | + | ||
52 | +mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) | ||
53 | +{ | ||
54 | + NetworkInterfaceIndex *item; | ||
55 | + | ||
56 | + if (ListContainsInterfaceIndex(list, if_index)) return; | ||
57 | + | ||
58 | + item = malloc(sizeof *item); | ||
59 | + if (item == NULL) return; | 51 | + if (item == NULL) return; |
60 | + | 52 | + |
61 | + item->if_index = if_index; | 53 | + item->if_index = if_index; |
@@ -66,7 +58,7 @@ index 195d04b..bb883c1 100755 | |||
66 | #if MDNS_DEBUGMSGS | 58 | #if MDNS_DEBUGMSGS |
67 | mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | 59 | mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) |
68 | { | 60 | { |
69 | @@ -1485,14 +1519,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | 61 | @@ -1648,14 +1673,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) |
70 | } | 62 | } |
71 | #endif | 63 | #endif |
72 | 64 | ||
@@ -82,7 +74,7 @@ index 195d04b..bb883c1 100755 | |||
82 | 74 | ||
83 | // The structure here is more complex than it really ought to be because, | 75 | // The structure here is more complex than it really ought to be because, |
84 | // unfortunately, there's no good way to size a buffer in advance large | 76 | // unfortunately, there's no good way to size a buffer in advance large |
85 | @@ -1528,9 +1561,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 77 | @@ -1691,9 +1715,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
86 | 78 | ||
87 | // Process the NetLink message | 79 | // Process the NetLink message |
88 | if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) | 80 | if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) |
@@ -94,7 +86,7 @@ index 195d04b..bb883c1 100755 | |||
94 | 86 | ||
95 | // Advance pNLMsg to the next message in the buffer | 87 | // Advance pNLMsg to the next message in the buffer |
96 | if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) | 88 | if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) |
97 | @@ -1541,8 +1574,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 89 | @@ -1704,8 +1728,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
98 | else | 90 | else |
99 | break; // all done! | 91 | break; // all done! |
100 | } | 92 | } |
@@ -103,7 +95,7 @@ index 195d04b..bb883c1 100755 | |||
103 | } | 95 | } |
104 | 96 | ||
105 | #else // USES_NETLINK | 97 | #else // USES_NETLINK |
106 | @@ -1574,14 +1605,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) | 98 | @@ -1737,14 +1759,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) |
107 | } | 99 | } |
108 | #endif | 100 | #endif |
109 | 101 | ||
@@ -119,7 +111,7 @@ index 195d04b..bb883c1 100755 | |||
119 | 111 | ||
120 | readCount = read(sd, buff, sizeof buff); | 112 | readCount = read(sd, buff, sizeof buff); |
121 | if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) | 113 | if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) |
122 | @@ -1596,12 +1626,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 114 | @@ -1759,12 +1780,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
123 | pRSMsg->ifam_type == RTM_IFINFO) | 115 | pRSMsg->ifam_type == RTM_IFINFO) |
124 | { | 116 | { |
125 | if (pRSMsg->ifam_type == RTM_IFINFO) | 117 | if (pRSMsg->ifam_type == RTM_IFINFO) |
@@ -134,7 +126,7 @@ index 195d04b..bb883c1 100755 | |||
134 | } | 126 | } |
135 | 127 | ||
136 | #endif // USES_NETLINK | 128 | #endif // USES_NETLINK |
137 | @@ -1611,7 +1639,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | 129 | @@ -1774,7 +1793,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) |
138 | { | 130 | { |
139 | IfChangeRec *pChgRec = (IfChangeRec*) context; | 131 | IfChangeRec *pChgRec = (IfChangeRec*) context; |
140 | fd_set readFDs; | 132 | fd_set readFDs; |
@@ -144,7 +136,7 @@ index 195d04b..bb883c1 100755 | |||
144 | struct timeval zeroTimeout = { 0, 0 }; | 136 | struct timeval zeroTimeout = { 0, 0 }; |
145 | 137 | ||
146 | (void)fd; // Unused | 138 | (void)fd; // Unused |
147 | @@ -1619,17 +1648,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | 139 | @@ -1782,17 +1802,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) |
148 | FD_ZERO(&readFDs); | 140 | FD_ZERO(&readFDs); |
149 | FD_SET(pChgRec->NotifySD, &readFDs); | 141 | FD_SET(pChgRec->NotifySD, &readFDs); |
150 | 142 | ||
@@ -167,11 +159,11 @@ index 195d04b..bb883c1 100755 | |||
167 | + while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) | 159 | + while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) |
168 | + { | 160 | + { |
169 | + RemoveFromList(&changedInterfaces, changedInterface); | 161 | + RemoveFromList(&changedInterfaces, changedInterface); |
170 | + free(changedInterface); | 162 | + mdns_free(changedInterface); |
171 | + } | 163 | + } |
172 | } | 164 | } |
173 | 165 | ||
174 | // Register with either a Routing Socket or RtNetLink to listen for interface changes. | 166 | // Register with either a Routing Socket or RtNetLink to listen for interface changes. |
175 | -- | 167 | -- |
176 | 2.20.1 | 168 | 2.35.1 |
177 | 169 | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch b/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch new file mode 100644 index 0000000000..6553f6b983 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From 60533a8947af714cc593bae6b20d47f3a4828589 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
3 | Date: Mon, 5 Dec 2022 22:49:49 +0000 | ||
4 | Subject: [PATCH 5/6] mDNSCore: Fix broken debug parameter | ||
5 | |||
6 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
7 | --- | ||
8 | mDNSCore/mDNS.c | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c | ||
12 | index 66979587ee82..e0a982fa1762 100644 | ||
13 | --- a/mDNSCore/mDNS.c | ||
14 | +++ b/mDNSCore/mDNS.c | ||
15 | @@ -9831,7 +9831,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage * | ||
16 | #else | ||
17 | const DNSServRef dnsserv = qptr->qDNSServer; | ||
18 | #endif | ||
19 | - debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, name->c, DNSTypeName(q.qtype)); | ||
20 | + debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, currentQName->c, DNSTypeName(q.qtype)); | ||
21 | // Create a negative record for the current name in the CNAME chain. | ||
22 | MakeNegativeCacheRecord(m, &m->rec.r, currentQName, currentQNameHash, q.qtype, q.qclass, negttl, mDNSInterface_Any, | ||
23 | dnsserv, response->h.flags); | ||
24 | -- | ||
25 | 2.35.1 | ||
26 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch b/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch new file mode 100644 index 0000000000..882d08e6c6 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch | |||
@@ -0,0 +1,252 @@ | |||
1 | From bfa1d68bed863e22c40a6d9a19ffbcc8694bbff6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Mon, 24 Jul 2017 09:38:55 -0500 | ||
4 | Subject: [PATCH 6/8] Handle noisy netlink sockets | ||
5 | |||
6 | The POSIX implementation currently clears all network interfaces | ||
7 | when netlink indicates that there has been a change. This causes | ||
8 | the following problems: | ||
9 | |||
10 | 1) Applications are informed that all of the services they are | ||
11 | tracking have been removed. | ||
12 | 2) Increases network load because the client must re-query for | ||
13 | all records it is interested in. | ||
14 | |||
15 | This changes netlink notification handling by: | ||
16 | |||
17 | 1) Always comparing with the latest interface list returned | ||
18 | by the OS. | ||
19 | 2) Confirming that the interface has been changed in a way | ||
20 | that we care about. | ||
21 | |||
22 | Upstream-Status: Submitted [dts@apple.com] | ||
23 | |||
24 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
25 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
26 | --- | ||
27 | mDNSPosix/mDNSPosix.c | 182 +++++++++++++++++++++++++++++++++++++++--- | ||
28 | 1 file changed, 172 insertions(+), 10 deletions(-) | ||
29 | |||
30 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
31 | index e20adda92229..5d52de31f79b 100644 | ||
32 | --- a/mDNSPosix/mDNSPosix.c | ||
33 | +++ b/mDNSPosix/mDNSPosix.c | ||
34 | @@ -1788,14 +1788,43 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
35 | |||
36 | #endif // USES_NETLINK | ||
37 | |||
38 | +// Test whether the given PosixNetworkInterface matches the given struct ifaddrs | ||
39 | +mDNSlocal mDNSBool InterfacesMatch(PosixNetworkInterface *intf, struct ifaddrs *ifi) | ||
40 | +{ | ||
41 | + mDNSBool match = mDNSfalse; | ||
42 | + mDNSAddr ip, mask; | ||
43 | + unsigned int if_index; | ||
44 | + | ||
45 | + if_index = if_nametoindex(ifi->ifa_name); | ||
46 | + if (if_index == 0) | ||
47 | + return mDNSfalse; | ||
48 | + | ||
49 | + if((intf->index == if_index) && | ||
50 | + (intf->sa_family == ifi->ifa_addr->sa_family) && | ||
51 | + (strcmp(intf->coreIntf.ifname, ifi->ifa_name) == 0)) | ||
52 | + { | ||
53 | + SockAddrTomDNSAddr(ifi->ifa_addr, &ip, NULL); | ||
54 | + SockAddrTomDNSAddr(ifi->ifa_netmask, &mask, NULL); | ||
55 | + | ||
56 | + match = mDNSSameAddress(&intf->coreIntf.ip, &ip) && | ||
57 | + mDNSSameAddress(&intf->coreIntf.mask, &mask); | ||
58 | + } | ||
59 | + | ||
60 | + return match; | ||
61 | +} | ||
62 | + | ||
63 | // Called when data appears on interface change notification socket | ||
64 | mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
65 | { | ||
66 | IfChangeRec *pChgRec = (IfChangeRec*) context; | ||
67 | + mDNS *m = pChgRec->mDNS; | ||
68 | fd_set readFDs; | ||
69 | GenLinkedList changedInterfaces; | ||
70 | NetworkInterfaceIndex *changedInterface; | ||
71 | struct timeval zeroTimeout = { 0, 0 }; | ||
72 | + struct ifaddrs *ifa_list, **ifi, *ifa_loop4 = NULL; | ||
73 | + PosixNetworkInterface *intf, *intfNext; | ||
74 | + mDNSBool found, foundav4; | ||
75 | |||
76 | (void)fd; // Unused | ||
77 | |||
78 | @@ -1810,12 +1839,149 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
79 | } | ||
80 | while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); | ||
81 | |||
82 | - // Currently we rebuild the entire interface list whenever any interface change is | ||
83 | - // detected. If this ever proves to be a performance issue in a multi-homed | ||
84 | - // configuration, more care should be paid to changedInterfaces. | ||
85 | - if (changedInterfaces.Head != NULL) | ||
86 | - mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); | ||
87 | + CleanRecentInterfaces(); | ||
88 | + | ||
89 | + if (changedInterfaces.Head == NULL) goto cleanup; | ||
90 | + | ||
91 | + if (getifaddrs(&ifa_list) < 0) goto cleanup; | ||
92 | + | ||
93 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
94 | + { | ||
95 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
96 | + | ||
97 | + // Loopback interface(s) are handled later | ||
98 | + if (intf->coreIntf.Loopback) continue; | ||
99 | + | ||
100 | + found = mDNSfalse; | ||
101 | + for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) | ||
102 | + { | ||
103 | + if (InterfacesMatch(intf, *ifi)) | ||
104 | + { | ||
105 | + found = mDNStrue; | ||
106 | + break; | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + // Removes changed and old interfaces from m->HostInterfaces | ||
111 | + if (!found) TearDownInterface(m, intf); | ||
112 | + } | ||
113 | + | ||
114 | + // Add new and changed interfaces in ifa_list | ||
115 | + // Save off loopback interface in case it is needed later | ||
116 | + for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) | ||
117 | + { | ||
118 | + found = mDNSfalse; | ||
119 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
120 | + { | ||
121 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
122 | + | ||
123 | + // Loopback interface(s) are handled later | ||
124 | + if (intf->coreIntf.Loopback) continue; | ||
125 | + | ||
126 | + if (InterfacesMatch(intf, *ifi)) | ||
127 | + { | ||
128 | + found = mDNStrue; | ||
129 | + break; | ||
130 | + } | ||
131 | + | ||
132 | + // Removes changed and old interfaces from m->HostInterfaces | ||
133 | + } | ||
134 | + if (found) | ||
135 | + continue; | ||
136 | + | ||
137 | + if ((ifa_loop4 == NULL) && | ||
138 | + ((*ifi)->ifa_addr->sa_family == AF_INET) && | ||
139 | + ((*ifi)->ifa_flags & IFF_UP) && | ||
140 | + ((*ifi)->ifa_flags & IFF_LOOPBACK)) | ||
141 | + { | ||
142 | + ifa_loop4 = *ifi; | ||
143 | + continue; | ||
144 | + } | ||
145 | + | ||
146 | + if ( (((*ifi)->ifa_addr->sa_family == AF_INET) | ||
147 | +#if HAVE_IPV6 | ||
148 | + || ((*ifi)->ifa_addr->sa_family == AF_INET6) | ||
149 | +#endif | ||
150 | + ) && ((*ifi)->ifa_flags & IFF_UP) | ||
151 | + && !((*ifi)->ifa_flags & IFF_POINTOPOINT) | ||
152 | + && !((*ifi)->ifa_flags & IFF_LOOPBACK)) | ||
153 | + { | ||
154 | + struct ifaddrs *i = *ifi; | ||
155 | + | ||
156 | +#define ethernet_addr_len 6 | ||
157 | + uint8_t hwaddr[ethernet_addr_len]; | ||
158 | + int hwaddr_len = 0; | ||
159 | + | ||
160 | +#if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX | ||
161 | + struct ifreq ifr; | ||
162 | + int sockfd = socket(AF_INET6, SOCK_DGRAM, 0); | ||
163 | + if (sockfd >= 0) | ||
164 | + { | ||
165 | + /* Add hardware address */ | ||
166 | + memcpy(ifr.ifr_name, i->ifa_name, IFNAMSIZ); | ||
167 | + if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) != -1) | ||
168 | + { | ||
169 | + if (ifr.ifr_hwaddr.sa_family == ARPHRD_ETHER) | ||
170 | + { | ||
171 | + memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ethernet_addr_len); | ||
172 | + hwaddr_len = ethernet_addr_len; | ||
173 | + } | ||
174 | + } | ||
175 | + close(sockfd); | ||
176 | + } | ||
177 | + else | ||
178 | + { | ||
179 | + memset(hwaddr, 0, sizeof(hwaddr)); | ||
180 | + } | ||
181 | +#endif // TARGET_OS_LINUX | ||
182 | + SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, | ||
183 | + hwaddr, hwaddr_len, i->ifa_name, if_nametoindex(i->ifa_name), i->ifa_flags); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + // Determine if there is at least one non-loopback IPv4 interface. This is to work around issues | ||
188 | + // with multicast loopback on IPv6 interfaces -- see corresponding logic in SetupInterfaceList(). | ||
189 | + foundav4 = mDNSfalse; | ||
190 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
191 | + { | ||
192 | + if (intf->sa_family == AF_INET && !intf->coreIntf.Loopback) | ||
193 | + { | ||
194 | + foundav4 = mDNStrue; | ||
195 | + break; | ||
196 | + } | ||
197 | + } | ||
198 | + | ||
199 | + if (foundav4) | ||
200 | + { | ||
201 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
202 | + { | ||
203 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
204 | + if (intf->coreIntf.Loopback) TearDownInterface(m, intf); | ||
205 | + } | ||
206 | + } | ||
207 | + else | ||
208 | + { | ||
209 | + found = mDNSfalse; | ||
210 | + | ||
211 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
212 | + { | ||
213 | + if (intf->coreIntf.Loopback) | ||
214 | + { | ||
215 | + found = mDNStrue; | ||
216 | + break; | ||
217 | + } | ||
218 | + } | ||
219 | + | ||
220 | + if (!found && (ifa_loop4 != NULL)) | ||
221 | + { | ||
222 | + SetupOneInterface(m, ifa_loop4->ifa_addr, ifa_loop4->ifa_netmask, | ||
223 | + NULL, 0, ifa_loop4->ifa_name, if_nametoindex(ifa_loop4->ifa_name), ifa_loop4->ifa_flags); | ||
224 | + } | ||
225 | + } | ||
226 | + | ||
227 | + if (ifa_list != NULL) freeifaddrs(ifa_list); | ||
228 | |||
229 | +cleanup: | ||
230 | while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) | ||
231 | { | ||
232 | RemoveFromList(&changedInterfaces, changedInterface); | ||
233 | @@ -1947,15 +2113,11 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) | ||
234 | #endif | ||
235 | } | ||
236 | |||
237 | -// This is used internally by InterfaceChangeCallback. | ||
238 | -// It's also exported so that the Standalone Responder (mDNSResponderPosix) | ||
239 | +// This is exported so that the Standalone Responder (mDNSResponderPosix) | ||
240 | // can call it in response to a SIGHUP (mainly for debugging purposes). | ||
241 | mDNSexport mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m) | ||
242 | { | ||
243 | int err; | ||
244 | - // This is a pretty heavyweight way to process interface changes -- | ||
245 | - // destroying the entire interface list and then making fresh one from scratch. | ||
246 | - // We should make it like the OS X version, which leaves unchanged interfaces alone. | ||
247 | ClearInterfaceList(m); | ||
248 | err = SetupInterfaceList(m); | ||
249 | return PosixErrorToStatus(err); | ||
250 | -- | ||
251 | 2.35.1 | ||
252 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch b/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch new file mode 100644 index 0000000000..268e574c50 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | From fa9ef50ab4c4225cf3ade4bafc38ddf93e6fe127 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alex Kiernan <alex.kiernan@gmail.com> | ||
3 | Date: Tue, 6 Dec 2022 13:28:31 +0000 | ||
4 | Subject: [PATCH 6/6] make: Add top-level Makefile | ||
5 | |||
6 | Simple top level Makefile that just delegates to mDNSPosix. | ||
7 | |||
8 | Upstream-Status: Inappropriate [oe-specific] | ||
9 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
10 | --- | ||
11 | Makefile | 2 ++ | ||
12 | 1 file changed, 2 insertions(+) | ||
13 | create mode 100644 Makefile | ||
14 | |||
15 | diff --git a/Makefile b/Makefile | ||
16 | new file mode 100644 | ||
17 | index 000000000000..feb6ac67ef47 | ||
18 | --- /dev/null | ||
19 | +++ b/Makefile | ||
20 | @@ -0,0 +1,2 @@ | ||
21 | +all clean: | ||
22 | + cd mDNSPosix && $(MAKE) $@ | ||
23 | -- | ||
24 | 2.35.1 | ||
25 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch b/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch index fdc5105cb9..e53b0fd3ae 100644 --- a/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 0fcc0f210f3a9310a1963de640b384ce866410fd Mon Sep 17 00:00:00 2001 | 1 | From a8accffb95267490b50401c8b65ec18db57b5ef5 Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Wed, 9 Aug 2017 09:16:58 -0500 | 3 | Date: Wed, 9 Aug 2017 09:16:58 -0500 |
4 | Subject: [PATCH 08/11] Mark deleted interfaces as being changed | 4 | Subject: [PATCH 7/8] Mark deleted interfaces as being changed |
5 | 5 | ||
6 | Netlink notification handling ignores messages for deleted links, | 6 | Netlink notification handling ignores messages for deleted links, |
7 | RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- | 7 | RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- |
@@ -17,15 +17,16 @@ Testing and Verification Instructions: | |||
17 | Upstream-Status: Submitted [dts@apple.com] | 17 | Upstream-Status: Submitted [dts@apple.com] |
18 | 18 | ||
19 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 19 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
20 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
20 | --- | 21 | --- |
21 | mDNSPosix/mDNSPosix.c | 2 +- | 22 | mDNSPosix/mDNSPosix.c | 2 +- |
22 | 1 file changed, 1 insertion(+), 1 deletion(-) | 23 | 1 file changed, 1 insertion(+), 1 deletion(-) |
23 | 24 | ||
24 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 25 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
25 | index 798ab10..a8a57df 100644 | 26 | index 5d52de31f79b..77d982f4c50b 100644 |
26 | --- a/mDNSPosix/mDNSPosix.c | 27 | --- a/mDNSPosix/mDNSPosix.c |
27 | +++ b/mDNSPosix/mDNSPosix.c | 28 | +++ b/mDNSPosix/mDNSPosix.c |
28 | @@ -1163,7 +1163,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | 29 | @@ -1714,7 +1714,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | // Process the NetLink message | 32 | // Process the NetLink message |
@@ -35,5 +36,5 @@ index 798ab10..a8a57df 100644 | |||
35 | else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) | 36 | else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) |
36 | AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); | 37 | AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); |
37 | -- | 38 | -- |
38 | 2.17.1 | 39 | 2.35.1 |
39 | 40 | ||
diff --git a/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch b/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch index b9b0157276..e689f8c267 100644 --- a/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch +++ b/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 382b3b924e43abd1bdc5792918161d0922666691 Mon Sep 17 00:00:00 2001 | 1 | From ed58146d3aeecdb9920fdc017f85c18b5b10f2db Mon Sep 17 00:00:00 2001 |
2 | From: Nate Karstens <nate.karstens@garmin.com> | 2 | From: Nate Karstens <nate.karstens@garmin.com> |
3 | Date: Thu, 10 Aug 2017 08:27:32 -0500 | 3 | Date: Thu, 10 Aug 2017 08:27:32 -0500 |
4 | Subject: [PATCH 10/11] Handle errors from socket calls | 4 | Subject: [PATCH 8/8] Handle errors from socket calls |
5 | 5 | ||
6 | Adds handling for socket() or read() returning a | 6 | Adds handling for socket() or read() returning a |
7 | negative value (indicating an error has occurred). | 7 | negative value (indicating an error has occurred). |
@@ -9,15 +9,16 @@ negative value (indicating an error has occurred). | |||
9 | Upstream-Status: Submitted [dts@apple.com] | 9 | Upstream-Status: Submitted [dts@apple.com] |
10 | 10 | ||
11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | 11 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> |
12 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> | ||
12 | --- | 13 | --- |
13 | mDNSPosix/mDNSPosix.c | 12 +++++++++--- | 14 | mDNSPosix/mDNSPosix.c | 12 +++++++++--- |
14 | 1 file changed, 9 insertions(+), 3 deletions(-) | 15 | 1 file changed, 9 insertions(+), 3 deletions(-) |
15 | 16 | ||
16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
17 | index 3243ed4..84af26b 100644 | 18 | index 77d982f4c50b..cab512160afb 100644 |
18 | --- a/mDNSPosix/mDNSPosix.c | 19 | --- a/mDNSPosix/mDNSPosix.c |
19 | +++ b/mDNSPosix/mDNSPosix.c | 20 | +++ b/mDNSPosix/mDNSPosix.c |
20 | @@ -1129,7 +1129,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | 21 | @@ -1677,7 +1677,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change |
21 | // Read through the messages on sd and if any indicate that any interface records should | 22 | // Read through the messages on sd and if any indicate that any interface records should |
22 | // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. | 23 | // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. |
23 | { | 24 | { |
@@ -26,7 +27,7 @@ index 3243ed4..84af26b 100644 | |||
26 | char buff[4096]; | 27 | char buff[4096]; |
27 | struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; | 28 | struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; |
28 | 29 | ||
29 | @@ -1138,7 +1138,10 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | 30 | @@ -1686,7 +1686,10 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change |
30 | // enough to hold all pending data and so avoid message fragmentation. | 31 | // enough to hold all pending data and so avoid message fragmentation. |
31 | // (Note that FIONREAD is not supported on AF_NETLINK.) | 32 | // (Note that FIONREAD is not supported on AF_NETLINK.) |
32 | 33 | ||
@@ -38,7 +39,7 @@ index 3243ed4..84af26b 100644 | |||
38 | while (1) | 39 | while (1) |
39 | { | 40 | { |
40 | // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. | 41 | // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. |
41 | @@ -1154,7 +1157,9 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | 42 | @@ -1702,7 +1705,9 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change |
42 | pNLMsg = (struct nlmsghdr*) buff; | 43 | pNLMsg = (struct nlmsghdr*) buff; |
43 | 44 | ||
44 | // read more data | 45 | // read more data |
@@ -49,7 +50,7 @@ index 3243ed4..84af26b 100644 | |||
49 | continue; // spin around and revalidate with new readCount | 50 | continue; // spin around and revalidate with new readCount |
50 | } | 51 | } |
51 | else | 52 | else |
52 | @@ -1429,6 +1434,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanReceiveUnicast(void) | 53 | @@ -2017,6 +2022,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanReceiveUnicast(void) |
53 | int err; | 54 | int err; |
54 | int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | 55 | int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |
55 | struct sockaddr_in s5353; | 56 | struct sockaddr_in s5353; |
@@ -58,5 +59,5 @@ index 3243ed4..84af26b 100644 | |||
58 | s5353.sin_port = MulticastDNSPort.NotAnInteger; | 59 | s5353.sin_port = MulticastDNSPort.NotAnInteger; |
59 | s5353.sin_addr.s_addr = 0; | 60 | s5353.sin_addr.s_addr = 0; |
60 | -- | 61 | -- |
61 | 2.17.1 | 62 | 2.35.1 |
62 | 63 | ||
diff --git a/meta-networking/recipes-protocols/mdns/files/mdns.service b/meta-networking/recipes-protocols/mdns/mdns/mdns.service index 531d142dcd..531d142dcd 100644 --- a/meta-networking/recipes-protocols/mdns/files/mdns.service +++ b/meta-networking/recipes-protocols/mdns/mdns/mdns.service | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb b/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb deleted file mode 100644 index 205dc929be..0000000000 --- a/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol" | ||
2 | DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks." | ||
3 | HOMEPAGE = "http://developer.apple.com/networking/bonjour/" | ||
4 | LICENSE = "Apache-2.0 & BSD-3-Clause" | ||
5 | LIC_FILES_CHKSUM = "file://../LICENSE;md5=31c50371921e0fb731003bbc665f29bf" | ||
6 | |||
7 | DEPENDS:append:libc-musl = " musl-nscd" | ||
8 | |||
9 | RPROVIDES:${PN} += "libdns_sd.so" | ||
10 | |||
11 | SRC_URI = "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \ | ||
12 | file://mdns.service \ | ||
13 | file://0001-mdns-include-stddef.h-for-NULL.patch;patchdir=.. \ | ||
14 | file://0002-mdns-cross-compilation-fixes-for-bitbake.patch;patchdir=.. \ | ||
15 | file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch;patchdir=.. \ | ||
16 | file://0002-Create-subroutine-for-tearing-down-an-interface.patch;patchdir=.. \ | ||
17 | file://0003-Track-interface-socket-family.patch;patchdir=.. \ | ||
18 | file://0004-Use-list-for-changed-interfaces.patch;patchdir=.. \ | ||
19 | file://0006-Remove-unneeded-function.patch;patchdir=.. \ | ||
20 | file://0008-Mark-deleted-interfaces-as-being-changed.patch;patchdir=.. \ | ||
21 | file://0009-Fix-possible-NULL-dereference.patch;patchdir=.. \ | ||
22 | file://0010-Handle-errors-from-socket-calls.patch;patchdir=.. \ | ||
23 | file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch;patchdir=.. \ | ||
24 | file://0001-dns-sd-Include-missing-headers.patch;patchdir=.. \ | ||
25 | " | ||
26 | SRC_URI[sha256sum] = "040f6495c18b9f0557bcf9e00cbcfc82b03405f5ba6963dc147730ca0ca90d6f" | ||
27 | |||
28 | CVE_PRODUCT = "apple:mdnsresponder" | ||
29 | |||
30 | # CVE-2007-0613 is not applicable as it only affects Apple products | ||
31 | # i.e. ichat,mdnsresponder, instant message framework and MacOS. | ||
32 | # Also, https://www.exploit-db.com/exploits/3230 shows the part of code | ||
33 | # affected by CVE-2007-0613 which is not preset in upstream source code. | ||
34 | # Hence, CVE-2007-0613 does not affect other Yocto implementations and | ||
35 | # is not reported for other distros can be marked whitelisted. | ||
36 | # Links: | ||
37 | # https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 | ||
38 | # https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613 | ||
39 | # https://security-tracker.debian.org/tracker/CVE-2007-0613 | ||
40 | # https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 | ||
41 | CVE_CHECK_IGNORE += "CVE-2007-0613" | ||
42 | |||
43 | PARALLEL_MAKE = "" | ||
44 | |||
45 | S = "${WORKDIR}/mDNSResponder-${PV}/mDNSPosix" | ||
46 | |||
47 | EXTRA_OEMAKE += "os=linux DEBUG=0 'CC=${CC}' 'LD=${CCLD} ${LDFLAGS}'" | ||
48 | |||
49 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
50 | |||
51 | do_install () { | ||
52 | install -d ${D}${sbindir} | ||
53 | install -m 0755 build/prod/mdnsd ${D}${sbindir} | ||
54 | |||
55 | install -d ${D}${libdir} | ||
56 | cp build/prod/libdns_sd.so ${D}${libdir}/libdns_sd.so.1 | ||
57 | chmod 0644 ${D}${libdir}/libdns_sd.so.1 | ||
58 | ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so | ||
59 | |||
60 | install -d ${D}${includedir} | ||
61 | install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir} | ||
62 | |||
63 | install -d ${D}${mandir}/man8 | ||
64 | install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8 | ||
65 | |||
66 | install -d ${D}${bindir} | ||
67 | install -m 0755 ../Clients/build/dns-sd ${D}${bindir} | ||
68 | |||
69 | install -d ${D}${libdir} | ||
70 | oe_libinstall -C build/prod -so libnss_mdns-0.2 ${D}${libdir} | ||
71 | ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2 | ||
72 | |||
73 | install -d ${D}${sysconfdir} | ||
74 | install -m 0644 nss_mdns.conf ${D}${sysconfdir} | ||
75 | |||
76 | install -d ${D}${mandir}/man5 | ||
77 | install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5 | ||
78 | |||
79 | install -d ${D}${mandir}/man8 | ||
80 | install -m 0644 libnss_mdns.8 ${D}${mandir}/man8 | ||
81 | |||
82 | install -d ${D}${systemd_unitdir}/system/ | ||
83 | install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_unitdir}/system/ | ||
84 | } | ||
85 | |||
86 | pkg_postinst:${PN} () { | ||
87 | sed -e '/^hosts:/s/\s*\<mdns\>//' \ | ||
88 | -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \ | ||
89 | -i $D/etc/nsswitch.conf | ||
90 | } | ||
91 | |||
92 | pkg_prerm:${PN} () { | ||
93 | sed -e '/^hosts:/s/\s*\<mdns\>//' \ | ||
94 | -e '/^hosts:/s/\s*mdns//' \ | ||
95 | -i $D/etc/nsswitch.conf | ||
96 | } | ||
97 | |||
98 | inherit systemd | ||
99 | |||
100 | SYSTEMD_SERVICE:${PN} = "mdns.service" | ||
101 | |||
102 | FILES:${PN} += "${systemd_unitdir}/system/mdns.service" | ||
103 | FILES:${PN} += "${libdir}/libdns_sd.so.1 \ | ||
104 | ${bindir}/dns-sd \ | ||
105 | ${libdir}/libnss_mdns-0.2.so \ | ||
106 | ${sysconfdir}/nss_mdns.conf" | ||
107 | |||
108 | FILES:${PN}-dev += "${libdir}/libdns_sd.so \ | ||
109 | ${includedir}/dns_sd.h " | ||
110 | |||
111 | FILES:${PN}-man += "${mandir}/man8/mdnsd.8 \ | ||
112 | ${mandir}/man5/nss_mdns.conf.5 \ | ||
113 | ${mandir}/man8/libnss_mdns.8" | ||
114 | |||
115 | PACKAGES = "${PN} ${PN}-dev ${PN}-man ${PN}-dbg" | ||
diff --git a/meta-networking/recipes-protocols/mdns/mdns_1790.40.31.bb b/meta-networking/recipes-protocols/mdns/mdns_1790.40.31.bb new file mode 100644 index 0000000000..84018de1bb --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns_1790.40.31.bb | |||
@@ -0,0 +1,130 @@ | |||
1 | SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol" | ||
2 | DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks." | ||
3 | HOMEPAGE = "http://developer.apple.com/networking/bonjour/" | ||
4 | LICENSE = "Apache-2.0 & BSD-3-Clause" | ||
5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=31c50371921e0fb731003bbc665f29bf" | ||
6 | |||
7 | DEPENDS:append:libc-musl = " musl-nscd" | ||
8 | |||
9 | SRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=main \ | ||
10 | file://0001-dns-sd-Include-missing-headers.patch \ | ||
11 | file://0002-make-Set-libdns_sd.so-soname-correctly.patch \ | ||
12 | file://0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch \ | ||
13 | file://0004-make-Separate-TLS-targets-from-libraries.patch \ | ||
14 | file://0005-mDNSCore-Fix-broken-debug-parameter.patch \ | ||
15 | file://0006-make-Add-top-level-Makefile.patch \ | ||
16 | file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch \ | ||
17 | file://0002-Create-subroutine-for-tearing-down-an-interface.patch \ | ||
18 | file://0003-Track-interface-socket-family.patch \ | ||
19 | file://0004-Indicate-loopback-interface-to-mDNS-core.patch \ | ||
20 | file://0005-Use-list-for-changed-interfaces.patch \ | ||
21 | file://0006-Handle-noisy-netlink-sockets.patch \ | ||
22 | file://0007-Mark-deleted-interfaces-as-being-changed.patch \ | ||
23 | file://0008-Handle-errors-from-socket-calls.patch \ | ||
24 | file://mdns.service \ | ||
25 | " | ||
26 | SRCREV = "806254210edec4cab01f794f6fd28658aa6ba59d" | ||
27 | |||
28 | # We install a stub Makefile in the top directory so that the various checks | ||
29 | # in base.bbclass pass their tests for a Makefile, this ensures (that amongst | ||
30 | # other things) the sstate checks will clean the build directory when the | ||
31 | # task hashes changes. | ||
32 | # | ||
33 | # We can't use the approach of setting ${S} to mDNSPosix as we need | ||
34 | # DEBUG_PREFIX_MAP to cover files which come from the Clients directory too. | ||
35 | S = "${WORKDIR}/git" | ||
36 | |||
37 | inherit github-releases manpages systemd update-rc.d | ||
38 | |||
39 | PACKAGECONFIG ?= "tls \ | ||
40 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" | ||
41 | PACKAGECONFIG[debug] = "DEBUG=1,DEBUG=0" | ||
42 | PACKAGECONFIG[ipv6] = "HAVE_IPV6=1,HAVE_IPV6=0" | ||
43 | PACKAGECONFIG[manpages] = "" | ||
44 | PACKAGECONFIG[tls] = ",tls=no,mbedtls" | ||
45 | |||
46 | CVE_PRODUCT = "apple:mdnsresponder" | ||
47 | |||
48 | # CVE-2007-0613 is not applicable as it only affects Apple products | ||
49 | # i.e. ichat,mdnsresponder, instant message framework and MacOS. | ||
50 | # Also, https://www.exploit-db.com/exploits/3230 shows the part of code | ||
51 | # affected by CVE-2007-0613 which is not preset in upstream source code. | ||
52 | # Hence, CVE-2007-0613 does not affect other Yocto implementations and | ||
53 | # is not reported for other distros can be marked whitelisted. | ||
54 | # Links: | ||
55 | # https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 | ||
56 | # https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613 | ||
57 | # https://security-tracker.debian.org/tracker/CVE-2007-0613 | ||
58 | # https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 | ||
59 | CVE_CHECK_IGNORE += "CVE-2007-0613" | ||
60 | |||
61 | PARALLEL_MAKE = "" | ||
62 | |||
63 | EXTRA_OEMAKE = "os=linux 'CC=${CCLD}' 'LD=${CCLD}' 'LINKOPTS=${LDFLAGS}' STRIP=: ${PACKAGECONFIG_CONFARGS}" | ||
64 | |||
65 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
66 | |||
67 | MDNS_BUILDDIR = "build/${@bb.utils.contains('PACKAGECONFIG','debug','debug','prod', d)}" | ||
68 | |||
69 | do_install () { | ||
70 | cd mDNSPosix | ||
71 | |||
72 | install -d ${D}${sbindir} | ||
73 | install ${MDNS_BUILDDIR}/mdnsd ${D}${sbindir} | ||
74 | |||
75 | install -d ${D}${libdir} | ||
76 | install -m 0644 ${MDNS_BUILDDIR}/libdns_sd.so ${D}${libdir}/libdns_sd.so.1 | ||
77 | ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so | ||
78 | |||
79 | install -d ${D}${includedir} | ||
80 | install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir} | ||
81 | |||
82 | install -d ${D}${mandir}/man8 | ||
83 | install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8 | ||
84 | |||
85 | install -d ${D}${bindir} | ||
86 | install -m 0755 ../Clients/build/dns-sd ${D}${bindir} | ||
87 | |||
88 | install -d ${D}${libdir} | ||
89 | oe_libinstall -C ${MDNS_BUILDDIR} -so libnss_mdns-0.2 ${D}${libdir} | ||
90 | ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2 | ||
91 | |||
92 | install -d ${D}${sysconfdir} | ||
93 | install -m 0644 nss_mdns.conf ${D}${sysconfdir} | ||
94 | |||
95 | install -d ${D}${mandir}/man5 | ||
96 | install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5 | ||
97 | |||
98 | install -d ${D}${mandir}/man8 | ||
99 | install -m 0644 libnss_mdns.8 ${D}${mandir}/man8 | ||
100 | |||
101 | install -d ${D}${systemd_system_unitdir} | ||
102 | install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_system_unitdir} | ||
103 | |||
104 | install -d ${D}${INIT_D_DIR} | ||
105 | install mdnsd.sh ${D}${INIT_D_DIR}/mdns | ||
106 | } | ||
107 | |||
108 | pkg_postinst:${PN} () { | ||
109 | if [ -r $D${sysconfdir}/nsswitch.conf ]; then | ||
110 | sed -e '/^hosts:/s/\s*\<mdns\>//' \ | ||
111 | -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns\3\4\5/' \ | ||
112 | -i $D${sysconfdir}/nsswitch.conf | ||
113 | fi | ||
114 | } | ||
115 | |||
116 | pkg_prerm:${PN} () { | ||
117 | if [ -r $D${sysconfdir}/nsswitch.conf ]; then | ||
118 | sed -e '/^hosts:/s/\s*\<mdns\>//' \ | ||
119 | -e '/^hosts:/s/\s*mdns//' \ | ||
120 | -i $D${sysconfdir}/nsswitch.conf | ||
121 | fi | ||
122 | } | ||
123 | |||
124 | SYSTEMD_SERVICE:${PN} = "mdns.service" | ||
125 | INITSCRIPT_NAME = "mdns" | ||
126 | |||
127 | FILES_SOLIBSDEV = "${libdir}/libdns_sd.so" | ||
128 | FILES:${PN} += "${libdir}/libnss_mdns-0.2.so" | ||
129 | |||
130 | RPROVIDES:${PN} += "libdns_sd.so" | ||