diff options
9 files changed, 224 insertions, 547 deletions
diff --git a/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch index 692c344db9..f8efc10448 100644 --- a/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch +++ b/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 89ea6ac4a8840e8c2be0140a9805c6522c6c5280 Mon Sep 17 00:00:00 2001 | 1 | From 6d90f9fdaf008f5c3b8fd8d91594fa1461437888 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 01/11] Create subroutine for cleaning recent interfaces | 4 | Subject: [PATCH] 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. |
@@ -10,14 +10,14 @@ 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 | --- | 12 | --- |
13 | mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- | 13 | mDNSPosix/mDNSPosix.c | 23 ++++++++++++++--------- |
14 | 1 file changed, 14 insertions(+), 10 deletions(-) | 14 | 1 file changed, 14 insertions(+), 9 deletions(-) |
15 | 15 | ||
16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 16 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
17 | index 0e10bd5..ffc9696 100644 | 17 | index a63cd19..7aeee7b 100755 |
18 | --- a/mDNSPosix/mDNSPosix.c | 18 | --- a/mDNSPosix/mDNSPosix.c |
19 | +++ b/mDNSPosix/mDNSPosix.c | 19 | +++ b/mDNSPosix/mDNSPosix.c |
20 | @@ -856,6 +856,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf | 20 | @@ -1199,6 +1199,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf |
21 | return err; | 21 | return err; |
22 | } | 22 | } |
23 | 23 | ||
@@ -37,11 +37,10 @@ index 0e10bd5..ffc9696 100644 | |||
37 | // Creates a PosixNetworkInterface for the interface whose IP address is | 37 | // Creates a PosixNetworkInterface for the interface whose IP address is |
38 | // intfAddr and whose name is intfName and registers it with mDNS core. | 38 | // intfAddr and whose name is intfName and registers it with mDNS core. |
39 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, const char *intfName, int intfIndex) | 39 | mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, const char *intfName, int intfIndex) |
40 | @@ -1010,16 +1023,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | 40 | @@ -1388,15 +1401,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) |
41 | |||
42 | // Clean up. | 41 | // Clean up. |
43 | if (intfList != NULL) free_ifi_info(intfList); | 42 | if (intfList != NULL) freeifaddrs(intfList); |
44 | - | 43 | |
45 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute | 44 | - // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute |
46 | - PosixNetworkInterface **ri = &gRecentInterfaces; | 45 | - PosixNetworkInterface **ri = &gRecentInterfaces; |
47 | - const mDNSs32 utc = mDNSPlatformUTC(); | 46 | - const mDNSs32 utc = mDNSPlatformUTC(); |
@@ -56,5 +55,5 @@ index 0e10bd5..ffc9696 100644 | |||
56 | return err; | 55 | return err; |
57 | } | 56 | } |
58 | -- | 57 | -- |
59 | 2.17.1 | 58 | 2.20.1 |
60 | 59 | ||
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 new file mode 100644 index 0000000000..3e9be7d6a5 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch | |||
@@ -0,0 +1,40 @@ | |||
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 | #include "nsec.h" | ||
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 new file mode 100644 index 0000000000..33590ffc57 --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch | |||
@@ -0,0 +1,145 @@ | |||
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/0004-Use-list-for-changed-interfaces.patch b/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch index 05ad49b9f9..db3a63ea48 100644 --- a/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch +++ b/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From e1f483510a1011e37540fdee8f3bc36111fa45a0 Mon Sep 17 00:00:00 2001 | 1 | From 798bfb5e984845a27874d1a244686db6e384d7b8 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 04/11] Use list for changed interfaces |
@@ -15,10 +15,10 @@ Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | |||
15 | 1 file changed, 52 insertions(+), 15 deletions(-) | 15 | 1 file changed, 52 insertions(+), 15 deletions(-) |
16 | 16 | ||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
18 | index 8fe22be..699855a 100644 | 18 | index 195d04b..bb883c1 100755 |
19 | --- a/mDNSPosix/mDNSPosix.c | 19 | --- a/mDNSPosix/mDNSPosix.c |
20 | +++ b/mDNSPosix/mDNSPosix.c | 20 | +++ b/mDNSPosix/mDNSPosix.c |
21 | @@ -75,6 +75,14 @@ struct IfChangeRec | 21 | @@ -67,6 +67,14 @@ struct IfChangeRec |
22 | }; | 22 | }; |
23 | typedef struct IfChangeRec IfChangeRec; | 23 | typedef struct IfChangeRec IfChangeRec; |
24 | 24 | ||
@@ -31,9 +31,9 @@ index 8fe22be..699855a 100644 | |||
31 | +typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; | 31 | +typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; |
32 | + | 32 | + |
33 | // Note that static data is initialized to zero in (modern) C. | 33 | // Note that static data is initialized to zero in (modern) C. |
34 | static fd_set gEventFDs; | 34 | static PosixEventSource *gEventSources; // linked list of PosixEventSource's |
35 | static int gMaxFD; // largest fd in gEventFDs | 35 | static sigset_t gEventSignalSet; // Signals which event loop listens for |
36 | @@ -1071,6 +1079,32 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) | 36 | @@ -1458,6 +1466,32 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) |
37 | return err; | 37 | return err; |
38 | } | 38 | } |
39 | 39 | ||
@@ -66,7 +66,7 @@ index 8fe22be..699855a 100644 | |||
66 | #if MDNS_DEBUGMSGS | 66 | #if MDNS_DEBUGMSGS |
67 | mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | 67 | mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) |
68 | { | 68 | { |
69 | @@ -1098,14 +1132,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) | 69 | @@ -1485,14 +1519,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) |
70 | } | 70 | } |
71 | #endif | 71 | #endif |
72 | 72 | ||
@@ -82,7 +82,7 @@ index 8fe22be..699855a 100644 | |||
82 | 82 | ||
83 | // The structure here is more complex than it really ought to be because, | 83 | // 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 | 84 | // unfortunately, there's no good way to size a buffer in advance large |
85 | @@ -1141,9 +1174,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 85 | @@ -1528,9 +1561,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
86 | 86 | ||
87 | // Process the NetLink message | 87 | // Process the NetLink message |
88 | if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) | 88 | if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) |
@@ -94,7 +94,7 @@ index 8fe22be..699855a 100644 | |||
94 | 94 | ||
95 | // Advance pNLMsg to the next message in the buffer | 95 | // Advance pNLMsg to the next message in the buffer |
96 | if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) | 96 | if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) |
97 | @@ -1154,8 +1187,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 97 | @@ -1541,8 +1574,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
98 | else | 98 | else |
99 | break; // all done! | 99 | break; // all done! |
100 | } | 100 | } |
@@ -103,7 +103,7 @@ index 8fe22be..699855a 100644 | |||
103 | } | 103 | } |
104 | 104 | ||
105 | #else // USES_NETLINK | 105 | #else // USES_NETLINK |
106 | @@ -1187,14 +1218,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) | 106 | @@ -1574,14 +1605,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) |
107 | } | 107 | } |
108 | #endif | 108 | #endif |
109 | 109 | ||
@@ -119,7 +119,7 @@ index 8fe22be..699855a 100644 | |||
119 | 119 | ||
120 | readCount = read(sd, buff, sizeof buff); | 120 | readCount = read(sd, buff, sizeof buff); |
121 | if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) | 121 | if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) |
122 | @@ -1209,12 +1239,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) | 122 | @@ -1596,12 +1626,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) |
123 | pRSMsg->ifam_type == RTM_IFINFO) | 123 | pRSMsg->ifam_type == RTM_IFINFO) |
124 | { | 124 | { |
125 | if (pRSMsg->ifam_type == RTM_IFINFO) | 125 | if (pRSMsg->ifam_type == RTM_IFINFO) |
@@ -134,7 +134,7 @@ index 8fe22be..699855a 100644 | |||
134 | } | 134 | } |
135 | 135 | ||
136 | #endif // USES_NETLINK | 136 | #endif // USES_NETLINK |
137 | @@ -1224,7 +1252,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, short filter, void *context) | 137 | @@ -1611,7 +1639,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) |
138 | { | 138 | { |
139 | IfChangeRec *pChgRec = (IfChangeRec*) context; | 139 | IfChangeRec *pChgRec = (IfChangeRec*) context; |
140 | fd_set readFDs; | 140 | fd_set readFDs; |
@@ -144,7 +144,7 @@ index 8fe22be..699855a 100644 | |||
144 | struct timeval zeroTimeout = { 0, 0 }; | 144 | struct timeval zeroTimeout = { 0, 0 }; |
145 | 145 | ||
146 | (void)fd; // Unused | 146 | (void)fd; // Unused |
147 | @@ -1233,17 +1262,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, short filter, void *context) | 147 | @@ -1619,17 +1648,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) |
148 | FD_ZERO(&readFDs); | 148 | FD_ZERO(&readFDs); |
149 | FD_SET(pChgRec->NotifySD, &readFDs); | 149 | FD_SET(pChgRec->NotifySD, &readFDs); |
150 | 150 | ||
@@ -173,5 +173,5 @@ index 8fe22be..699855a 100644 | |||
173 | 173 | ||
174 | // Register with either a Routing Socket or RtNetLink to listen for interface changes. | 174 | // Register with either a Routing Socket or RtNetLink to listen for interface changes. |
175 | -- | 175 | -- |
176 | 2.17.1 | 176 | 2.20.1 |
177 | 177 | ||
diff --git a/meta-networking/recipes-protocols/mdns/files/0005-Handle-noisy-netlink-sockets.patch b/meta-networking/recipes-protocols/mdns/files/0005-Handle-noisy-netlink-sockets.patch deleted file mode 100644 index f2b171e55b..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0005-Handle-noisy-netlink-sockets.patch +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | From 92025cab86619f548bf3eb816a1804ef40507ca7 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 05/11] 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 | --- | ||
26 | mDNSPosix/mDNSPosix.c | 143 +++++++++++++++++++++++++++++++++++++++--- | ||
27 | 1 file changed, 133 insertions(+), 10 deletions(-) | ||
28 | |||
29 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
30 | index 699855a..59a8b8c 100644 | ||
31 | --- a/mDNSPosix/mDNSPosix.c | ||
32 | +++ b/mDNSPosix/mDNSPosix.c | ||
33 | @@ -1247,14 +1247,38 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change | ||
34 | |||
35 | #endif // USES_NETLINK | ||
36 | |||
37 | +// Test whether the given PosixNetworkInterface matches the given struct ifi_info | ||
38 | +mDNSlocal mDNSBool InterfacesMatch(PosixNetworkInterface *intf, struct ifi_info *ifi) | ||
39 | +{ | ||
40 | + mDNSBool match = mDNSfalse; | ||
41 | + mDNSAddr ip, mask; | ||
42 | + | ||
43 | + if((intf->index == ifi->ifi_index) && | ||
44 | + (intf->sa_family == ifi->ifi_addr->sa_family) && | ||
45 | + (strcmp(intf->coreIntf.ifname, ifi->ifi_name) == 0)) | ||
46 | + { | ||
47 | + SockAddrTomDNSAddr(ifi->ifi_addr, &ip, NULL); | ||
48 | + SockAddrTomDNSAddr(ifi->ifi_netmask, &mask, NULL); | ||
49 | + | ||
50 | + match = mDNSSameAddress(&intf->coreIntf.ip, &ip) && | ||
51 | + mDNSSameAddress(&intf->coreIntf.mask, &mask); | ||
52 | + } | ||
53 | + | ||
54 | + return match; | ||
55 | +} | ||
56 | + | ||
57 | // Called when data appears on interface change notification socket | ||
58 | mDNSlocal void InterfaceChangeCallback(int fd, short filter, void *context) | ||
59 | { | ||
60 | IfChangeRec *pChgRec = (IfChangeRec*) context; | ||
61 | + mDNS *m = pChgRec->mDNS; | ||
62 | fd_set readFDs; | ||
63 | GenLinkedList changedInterfaces; | ||
64 | NetworkInterfaceIndex *changedInterface; | ||
65 | struct timeval zeroTimeout = { 0, 0 }; | ||
66 | + struct ifi_info *ifi_list, **ifi, *ifi_free, *ifi_loop4 = NULL; | ||
67 | + PosixNetworkInterface *intf, *intfNext; | ||
68 | + mDNSBool found, foundav4; | ||
69 | |||
70 | (void)fd; // Unused | ||
71 | (void)filter; // Unused | ||
72 | @@ -1270,12 +1294,115 @@ mDNSlocal void InterfaceChangeCallback(int fd, short filter, void *context) | ||
73 | } | ||
74 | while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); | ||
75 | |||
76 | - // Currently we rebuild the entire interface list whenever any interface change is | ||
77 | - // detected. If this ever proves to be a performance issue in a multi-homed | ||
78 | - // configuration, more care should be paid to changedInterfaces. | ||
79 | - if (changedInterfaces.Head != NULL) | ||
80 | - mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); | ||
81 | + CleanRecentInterfaces(); | ||
82 | + | ||
83 | + if (changedInterfaces.Head == NULL) goto cleanup; | ||
84 | + | ||
85 | + ifi_list = get_ifi_info(AF_INET, mDNStrue); | ||
86 | + if (ifi_list == NULL) goto cleanup; | ||
87 | + | ||
88 | +#if HAVE_IPV6 | ||
89 | + /* Link the IPv6 list to the end of the IPv4 list */ | ||
90 | + ifi = &ifi_list; | ||
91 | + while (*ifi != NULL) ifi = &(*ifi)->ifi_next; | ||
92 | + *ifi = get_ifi_info(AF_INET6, mDNStrue); | ||
93 | +#endif | ||
94 | + | ||
95 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
96 | + { | ||
97 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
98 | + | ||
99 | + // Loopback interface(s) are handled later | ||
100 | + if (intf->coreIntf.Loopback) continue; | ||
101 | + | ||
102 | + found = mDNSfalse; | ||
103 | + for (ifi = &ifi_list; *ifi != NULL; ifi = &(*ifi)->ifi_next) | ||
104 | + { | ||
105 | + if (InterfacesMatch(intf, *ifi)) | ||
106 | + { | ||
107 | + found = mDNStrue; | ||
108 | + | ||
109 | + // Removes unchanged from ifi_list | ||
110 | + ifi_free = *ifi; | ||
111 | + *ifi = (*ifi)->ifi_next; | ||
112 | + ifi_free->ifi_next = NULL; | ||
113 | + free_ifi_info(ifi_free); | ||
114 | + | ||
115 | + break; | ||
116 | + } | ||
117 | + } | ||
118 | + | ||
119 | + // Removes changed and old interfaces from m->HostInterfaces | ||
120 | + if (!found) TearDownInterface(m, intf); | ||
121 | + } | ||
122 | + | ||
123 | + // Add new and changed interfaces in ifi_list | ||
124 | + // Save off loopback interface in case it is needed later | ||
125 | + for (ifi = &ifi_list; *ifi != NULL; ifi = &(*ifi)->ifi_next) | ||
126 | + { | ||
127 | + if ((ifi_loop4 == NULL) && | ||
128 | + ((*ifi)->ifi_addr->sa_family == AF_INET) && | ||
129 | + ((*ifi)->ifi_flags & IFF_UP) && | ||
130 | + ((*ifi)->ifi_flags & IFF_LOOPBACK)) | ||
131 | + { | ||
132 | + ifi_loop4 = *ifi; | ||
133 | + continue; | ||
134 | + } | ||
135 | + | ||
136 | + if ( (((*ifi)->ifi_addr->sa_family == AF_INET) | ||
137 | +#if HAVE_IPV6 | ||
138 | + || ((*ifi)->ifi_addr->sa_family == AF_INET6) | ||
139 | +#endif | ||
140 | + ) && ((*ifi)->ifi_flags & IFF_UP) | ||
141 | + && !((*ifi)->ifi_flags & IFF_POINTOPOINT) | ||
142 | + && !((*ifi)->ifi_flags & IFF_LOOPBACK)) | ||
143 | + { | ||
144 | + SetupOneInterface(m, *ifi); | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + // Determine if there is at least one non-loopback IPv4 interface. This is to work around issues | ||
149 | + // with multicast loopback on IPv6 interfaces -- see corresponding logic in SetupInterfaceList(). | ||
150 | + foundav4 = mDNSfalse; | ||
151 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
152 | + { | ||
153 | + if (intf->sa_family == AF_INET && !intf->coreIntf.Loopback) | ||
154 | + { | ||
155 | + foundav4 = mDNStrue; | ||
156 | + break; | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + if (foundav4) | ||
161 | + { | ||
162 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) | ||
163 | + { | ||
164 | + intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); | ||
165 | + if (intf->coreIntf.Loopback) TearDownInterface(m, intf); | ||
166 | + } | ||
167 | + } | ||
168 | + else | ||
169 | + { | ||
170 | + found = mDNSfalse; | ||
171 | + | ||
172 | + for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) | ||
173 | + { | ||
174 | + if (intf->coreIntf.Loopback) | ||
175 | + { | ||
176 | + found = mDNStrue; | ||
177 | + break; | ||
178 | + } | ||
179 | + } | ||
180 | + | ||
181 | + if (!found && (ifi_loop4 != NULL)) | ||
182 | + { | ||
183 | + SetupOneInterface(m, ifi_loop4); | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + if (ifi_list != NULL) free_ifi_info(ifi_list); | ||
188 | |||
189 | +cleanup: | ||
190 | while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) | ||
191 | { | ||
192 | RemoveFromList(&changedInterfaces, changedInterface); | ||
193 | @@ -1400,15 +1527,11 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) | ||
194 | #endif | ||
195 | } | ||
196 | |||
197 | -// This is used internally by InterfaceChangeCallback. | ||
198 | -// It's also exported so that the Standalone Responder (mDNSResponderPosix) | ||
199 | +// This is exported so that the Standalone Responder (mDNSResponderPosix) | ||
200 | // can call it in response to a SIGHUP (mainly for debugging purposes). | ||
201 | mDNSexport mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m) | ||
202 | { | ||
203 | int err; | ||
204 | - // This is a pretty heavyweight way to process interface changes -- | ||
205 | - // destroying the entire interface list and then making fresh one from scratch. | ||
206 | - // We should make it like the OS X version, which leaves unchanged interfaces alone. | ||
207 | ClearInterfaceList(m); | ||
208 | err = SetupInterfaceList(m); | ||
209 | return PosixErrorToStatus(err); | ||
210 | -- | ||
211 | 2.17.1 | ||
212 | |||
diff --git a/meta-networking/recipes-protocols/mdns/files/0007-Indicate-loopback-interface-to-mDNS-core.patch b/meta-networking/recipes-protocols/mdns/files/0007-Indicate-loopback-interface-to-mDNS-core.patch deleted file mode 100644 index 86201c650d..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/0007-Indicate-loopback-interface-to-mDNS-core.patch +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | From 07a9401d84804d7f0181aa4fb0f13a54b2a1c9a8 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 07/11] 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 | Also reorganizes SetupOneInterface() to use a const struct | ||
9 | rather than growing its parameter list again. | ||
10 | |||
11 | Upstream-Status: Submitted [dts@apple.com] | ||
12 | |||
13 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
14 | --- | ||
15 | mDNSPosix/mDNSPosix.c | 37 ++++++++++++++++++------------------- | ||
16 | 1 file changed, 18 insertions(+), 19 deletions(-) | ||
17 | |||
18 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
19 | index 3fc5451..798ab10 100644 | ||
20 | --- a/mDNSPosix/mDNSPosix.c | ||
21 | +++ b/mDNSPosix/mDNSPosix.c | ||
22 | @@ -889,16 +889,14 @@ mDNSlocal void CleanRecentInterfaces(void) | ||
23 | |||
24 | // Creates a PosixNetworkInterface for the interface whose IP address is | ||
25 | // intfAddr and whose name is intfName and registers it with mDNS core. | ||
26 | -mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, const char *intfName, int intfIndex) | ||
27 | +mDNSlocal int SetupOneInterface(mDNS *const m, struct ifi_info *const ifi) | ||
28 | { | ||
29 | int err = 0; | ||
30 | PosixNetworkInterface *intf; | ||
31 | PosixNetworkInterface *alias = NULL; | ||
32 | |||
33 | assert(m != NULL); | ||
34 | - assert(intfAddr != NULL); | ||
35 | - assert(intfName != NULL); | ||
36 | - assert(intfMask != NULL); | ||
37 | + assert(ifi != NULL); | ||
38 | |||
39 | // Allocate the interface structure itself. | ||
40 | intf = (PosixNetworkInterface*)calloc(1, sizeof(*intf)); | ||
41 | @@ -907,26 +905,27 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
42 | // And make a copy of the intfName. | ||
43 | if (err == 0) | ||
44 | { | ||
45 | - intf->intfName = strdup(intfName); | ||
46 | + intf->intfName = strdup(ifi->ifi_name); | ||
47 | if (intf->intfName == NULL) { assert(0); err = ENOMEM; } | ||
48 | } | ||
49 | |||
50 | if (err == 0) | ||
51 | { | ||
52 | // Set up the fields required by the mDNS core. | ||
53 | - SockAddrTomDNSAddr(intfAddr, &intf->coreIntf.ip, NULL); | ||
54 | - SockAddrTomDNSAddr(intfMask, &intf->coreIntf.mask, NULL); | ||
55 | + SockAddrTomDNSAddr(ifi->ifi_addr, &intf->coreIntf.ip, NULL); | ||
56 | + SockAddrTomDNSAddr(ifi->ifi_netmask, &intf->coreIntf.mask, NULL); | ||
57 | |||
58 | //LogMsg("SetupOneInterface: %#a %#a", &intf->coreIntf.ip, &intf->coreIntf.mask); | ||
59 | - strncpy(intf->coreIntf.ifname, intfName, sizeof(intf->coreIntf.ifname)); | ||
60 | + strncpy(intf->coreIntf.ifname, ifi->ifi_name, sizeof(intf->coreIntf.ifname)); | ||
61 | intf->coreIntf.ifname[sizeof(intf->coreIntf.ifname)-1] = 0; | ||
62 | intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; | ||
63 | intf->coreIntf.McastTxRx = mDNStrue; | ||
64 | + intf->coreIntf.Loopback = ((ifi->ifi_flags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; | ||
65 | |||
66 | // Set up the extra fields in PosixNetworkInterface. | ||
67 | assert(intf->intfName != NULL); // intf->intfName already set up above | ||
68 | - intf->index = intfIndex; | ||
69 | - intf->sa_family = intfAddr->sa_family; | ||
70 | + intf->index = ifi->ifi_index; | ||
71 | + intf->sa_family = ifi->ifi_addr->sa_family; | ||
72 | intf->multicastSocket4 = -1; | ||
73 | #if HAVE_IPV6 | ||
74 | intf->multicastSocket6 = -1; | ||
75 | @@ -936,17 +935,17 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
76 | intf->coreIntf.InterfaceID = (mDNSInterfaceID)alias; | ||
77 | |||
78 | if (alias != intf) | ||
79 | - debugf("SetupOneInterface: %s %#a is an alias of %#a", intfName, &intf->coreIntf.ip, &alias->coreIntf.ip); | ||
80 | + debugf("SetupOneInterface: %s %#a is an alias of %#a", ifi->ifi_name, &intf->coreIntf.ip, &alias->coreIntf.ip); | ||
81 | } | ||
82 | |||
83 | // Set up the multicast socket | ||
84 | if (err == 0) | ||
85 | { | ||
86 | - if (alias->multicastSocket4 == -1 && intfAddr->sa_family == AF_INET) | ||
87 | - err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket4); | ||
88 | + if (alias->multicastSocket4 == -1 && ifi->ifi_addr->sa_family == AF_INET) | ||
89 | + err = SetupSocket(ifi->ifi_addr, MulticastDNSPort, intf->index, &alias->multicastSocket4); | ||
90 | #if HAVE_IPV6 | ||
91 | - else if (alias->multicastSocket6 == -1 && intfAddr->sa_family == AF_INET6) | ||
92 | - err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket6); | ||
93 | + else if (alias->multicastSocket6 == -1 && ifi->ifi_addr->sa_family == AF_INET6) | ||
94 | + err = SetupSocket(ifi->ifi_addr, MulticastDNSPort, intf->index, &alias->multicastSocket6); | ||
95 | #endif | ||
96 | } | ||
97 | |||
98 | @@ -973,8 +972,8 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | - // Use intfName instead of intf->intfName in the next line to avoid dereferencing NULL. | ||
103 | - debugf("SetupOneInterface: %s %#a failed to register %d", intfName, &intf->coreIntf.ip, err); | ||
104 | + // Use ifi->ifi_name instead of intf->intfName in the next line to avoid dereferencing NULL. | ||
105 | + debugf("SetupOneInterface: %s %#a failed to register %d", ifi->ifi_name, &intf->coreIntf.ip, err); | ||
106 | if (intf) { FreePosixNetworkInterface(intf); intf = NULL; } | ||
107 | } | ||
108 | |||
109 | @@ -1023,7 +1022,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | - if (SetupOneInterface(m, i->ifi_addr, i->ifi_netmask, i->ifi_name, i->ifi_index) == 0) | ||
114 | + if (SetupOneInterface(m, i) == 0) | ||
115 | if (i->ifi_addr->sa_family == AF_INET) | ||
116 | foundav4 = mDNStrue; | ||
117 | } | ||
118 | @@ -1037,7 +1036,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) | ||
119 | // In the interim, we skip loopback interface only if we found at least one v4 interface to use | ||
120 | // if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) | ||
121 | if (!foundav4 && firstLoopback) | ||
122 | - (void) SetupOneInterface(m, firstLoopback->ifi_addr, firstLoopback->ifi_netmask, firstLoopback->ifi_name, firstLoopback->ifi_index); | ||
123 | + (void) SetupOneInterface(m, firstLoopback); | ||
124 | } | ||
125 | |||
126 | // Clean up. | ||
127 | -- | ||
128 | 2.17.1 | ||
129 | |||
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 index d64fb35db1..d9adde04c2 100644 --- 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 | |||
@@ -1,7 +1,7 @@ | |||
1 | From 19de26db69408f02241e232b39224589a0f630df Mon Sep 17 00:00:00 2001 | 1 | From 9ff06108cd44e84ba6c68bfa6737e793f117e303 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:46:03 -0500 | 3 | Date: Thu, 10 Aug 2017 08:46:03 -0500 |
4 | Subject: [PATCH 11/11] Change a dynamic allocation to file-scope variable | 4 | Subject: [PATCH] Change a dynamic allocation to file-scope variable |
5 | 5 | ||
6 | Changes a variable from being dynamically-allocated to being | 6 | Changes a variable from being dynamically-allocated to being |
7 | statically-allocated at the file scope. Addresses a Coverity | 7 | statically-allocated at the file scope. Addresses a Coverity |
@@ -11,14 +11,14 @@ 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 | --- | 13 | --- |
14 | mDNSPosix/mDNSPosix.c | 12 ++++-------- | 14 | mDNSPosix/mDNSPosix.c | 14 ++++---------- |
15 | 1 file changed, 4 insertions(+), 8 deletions(-) | 15 | 1 file changed, 4 insertions(+), 10 deletions(-) |
16 | 16 | ||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | 17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c |
18 | index 84af26b..b7795ed 100644 | 18 | index 7aeee7b..2d25016 100755 |
19 | --- a/mDNSPosix/mDNSPosix.c | 19 | --- a/mDNSPosix/mDNSPosix.c |
20 | +++ b/mDNSPosix/mDNSPosix.c | 20 | +++ b/mDNSPosix/mDNSPosix.c |
21 | @@ -91,6 +91,7 @@ static sigset_t gEventSignalSet; // Signals which event loop list | 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 | 22 | static sigset_t gEventSignals; // Signals which were received while inside loop |
23 | 23 | ||
24 | static PosixNetworkInterface *gRecentInterfaces; | 24 | static PosixNetworkInterface *gRecentInterfaces; |
@@ -26,13 +26,13 @@ index 84af26b..b7795ed 100644 | |||
26 | 26 | ||
27 | // *************************************************************************** | 27 | // *************************************************************************** |
28 | // Globals (for debugging) | 28 | // Globals (for debugging) |
29 | @@ -1412,16 +1413,11 @@ cleanup: | 29 | @@ -1641,18 +1642,11 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) |
30 | mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m) | 30 | mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m) |
31 | { | 31 | { |
32 | mStatus err; | 32 | mStatus err; |
33 | - IfChangeRec *pChgRec; | 33 | - IfChangeRec *pChgRec; |
34 | 34 | ||
35 | - pChgRec = (IfChangeRec*) mDNSPlatformMemAllocate(sizeof *pChgRec); | 35 | - pChgRec = (IfChangeRec*) mDNSPlatformMemAllocateClear(sizeof *pChgRec); |
36 | - if (pChgRec == NULL) | 36 | - if (pChgRec == NULL) |
37 | - return mStatus_NoMemoryErr; | 37 | - return mStatus_NoMemoryErr; |
38 | - | 38 | - |
@@ -42,10 +42,12 @@ index 84af26b..b7795ed 100644 | |||
42 | + err = OpenIfNotifySocket(&gChgRec.NotifySD); | 42 | + err = OpenIfNotifySocket(&gChgRec.NotifySD); |
43 | if (err == 0) | 43 | if (err == 0) |
44 | - err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec); | 44 | - err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec); |
45 | - if (err) | ||
46 | - mDNSPlatformMemFree(pChgRec); | ||
45 | + err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec); | 47 | + err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec); |
46 | 48 | ||
47 | return err; | 49 | return err; |
48 | } | 50 | } |
49 | -- | 51 | -- |
50 | 2.17.1 | 52 | 2.20.1 |
51 | 53 | ||
diff --git a/meta-networking/recipes-protocols/mdns/files/build.patch b/meta-networking/recipes-protocols/mdns/files/build.patch deleted file mode 100644 index 4ab9d23bf7..0000000000 --- a/meta-networking/recipes-protocols/mdns/files/build.patch +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | From 43b6e98c9c37afd0d914949dcff4eab81f5a995f 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 | |||
5 | Upstream-Status: Inappropriate [OE-specific] | ||
6 | |||
7 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
8 | |||
9 | --- | ||
10 | mDNSPosix/Makefile | 54 +++++++++++++++++++++++++----------------------------- | ||
11 | 1 file changed, 25 insertions(+), 29 deletions(-) | ||
12 | |||
13 | diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile | ||
14 | index 4f98e90..8ac97ad 100755 | ||
15 | --- a/mDNSPosix/Makefile | ||
16 | +++ b/mDNSPosix/Makefile | ||
17 | @@ -50,6 +50,7 @@ | ||
18 | |||
19 | LIBVERS = 1 | ||
20 | |||
21 | +POSIXDIR = ../mDNSPosix | ||
22 | COREDIR = ../mDNSCore | ||
23 | SHAREDDIR ?= ../mDNSShared | ||
24 | JDK = /usr/jdk | ||
25 | @@ -58,11 +59,11 @@ CC = @cc | ||
26 | BISON = @bison | ||
27 | FLEX = @flex | ||
28 | ST = @strip | ||
29 | -LD = ld -shared | ||
30 | +LD =@LD | ||
31 | CP = cp | ||
32 | RM = rm | ||
33 | LN = ln -s -f | ||
34 | -CFLAGS_COMMON = -I$(COREDIR) -I$(SHAREDDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" | ||
35 | +CFLAGS_COMMON = -I$(POSIXDIR) -I$(COREDIR) -I$(SHAREDDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" | ||
36 | CFLAGS_PTHREAD = | ||
37 | LINKOPTS = | ||
38 | LINKOPTS_PTHREAD = -lpthread | ||
39 | @@ -70,7 +71,7 @@ LDSUFFIX = so | ||
40 | JAVACFLAGS_OS = -fPIC -shared -ldns_sd | ||
41 | |||
42 | # Set up diverging paths for debug vs. prod builds | ||
43 | -DEBUG=0 | ||
44 | +DEBUG?=1 | ||
45 | ifeq ($(DEBUG),1) | ||
46 | CFLAGS_DEBUG = -g -DMDNS_DEBUGMSGS=2 | ||
47 | OBJDIR = objects/debug | ||
48 | @@ -213,7 +214,7 @@ endif | ||
49 | endif | ||
50 | endif | ||
51 | |||
52 | -CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG) | ||
53 | +CFLAGS_BUILD = $(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUG) | ||
54 | |||
55 | ############################################################################# | ||
56 | |||
57 | @@ -249,8 +250,7 @@ Daemon: setup $(BUILDDIR)/mdnsd | ||
58 | @echo "Responder daemon done" | ||
59 | |||
60 | $(BUILDDIR)/mdnsd: $(DAEMONOBJS) | ||
61 | - $(CC) -o $@ $+ $(LINKOPTS) | ||
62 | - @$(STRIP) $@ | ||
63 | + $(CC) -o $@ $+ | ||
64 | |||
65 | # libdns_sd target builds the client library | ||
66 | libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | ||
67 | @@ -259,22 +259,18 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) | ||
68 | CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o | ||
69 | |||
70 | $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) | ||
71 | - @$(LD) $(LINKOPTS) -o $@ $+ | ||
72 | - @$(STRIP) $@ | ||
73 | + $(LD) -shared $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ | ||
74 | |||
75 | -Clients: setup libdns_sd ../Clients/build/dns-sd | ||
76 | +Clients: setup libdns_sd | ||
77 | + @$(MAKE) -C ../Clients DEBUG=${DEBUG} | ||
78 | @echo "Clients done" | ||
79 | |||
80 | -../Clients/build/dns-sd: | ||
81 | - @$(MAKE) -C ../Clients | ||
82 | - | ||
83 | # nss_mdns target builds the Name Service Switch module | ||
84 | nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE) | ||
85 | @echo "Name Service Switch module done" | ||
86 | |||
87 | $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o | ||
88 | - @$(LD) $(LINKOPTS) -o $@ $+ | ||
89 | - @$(STRIP) $@ | ||
90 | + $(LD) -shared $(LINKOPTS) -o $@ $+ | ||
91 | |||
92 | ############################################################################# | ||
93 | |||
94 | @@ -470,55 +466,55 @@ dnsextd: setup $(BUILDDIR)/dnsextd | ||
95 | @echo "dnsextd done" | ||
96 | |||
97 | $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(OBJDIR)/Client.c.o | ||
98 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
99 | + $(CC) $+ -o $@ | ||
100 | |||
101 | $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(OBJDIR)/Responder.c.o | ||
102 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
103 | + $(CC) $+ -o $@ | ||
104 | |||
105 | $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(OBJDIR)/ProxyResponder.c.o | ||
106 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
107 | + $(CC) $+ -o $@ | ||
108 | |||
109 | $(BUILDDIR)/mDNSIdentify: $(SPECIALOBJ) $(OBJDIR)/Identify.c.o | ||
110 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
111 | + $(CC) $+ -o $@ | ||
112 | |||
113 | $(OBJDIR)/Identify.c.o: $(COREDIR)/mDNS.c # Note: Identify.c textually imports mDNS.c | ||
114 | |||
115 | $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(OBJDIR)/NetMonitor.c.o | ||
116 | - $(CC) $+ -o $@ $(LINKOPTS) | ||
117 | + $(CC) $+ -o $@ | ||
118 | |||
119 | $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c | ||
120 | |||
121 | $(BUILDDIR)/dnsextd: $(DNSEXTDOBJ) $(OBJDIR)/dnsextd.c.threadsafe.o | ||
122 | - $(CC) $+ -o $@ $(LINKOPTS) $(LINKOPTS_PTHREAD) | ||
123 | + $(CC) $+ -o $@ $(LINKOPTS_PTHREAD) | ||
124 | |||
125 | ############################################################################# | ||
126 | |||
127 | # Implicit rules | ||
128 | $(OBJDIR)/%.c.o: %.c | ||
129 | - $(CC) $(CFLAGS) -c -o $@ $< | ||
130 | + $(CC) $(CFLAGS_BUILD) -c -o $@ $< | ||
131 | |||
132 | $(OBJDIR)/%.c.o: $(COREDIR)/%.c | ||
133 | - $(CC) $(CFLAGS) -c -o $@ $< | ||
134 | + $(CC) $(CFLAGS_BUILD) -c -o $@ $< | ||
135 | |||
136 | $(OBJDIR)/%.c.o: $(SHAREDDIR)/%.c | ||
137 | - $(CC) $(CFLAGS) -c -o $@ $< | ||
138 | + $(CC) $(CFLAGS_BUILD) -c -o $@ $< | ||
139 | |||
140 | $(OBJDIR)/%.c.threadsafe.o: %.c | ||
141 | - $(CC) $(CFLAGS) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $< | ||
142 | + $(CC) $(CFLAGS_BUILD) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $< | ||
143 | |||
144 | $(OBJDIR)/%.c.threadsafe.o: $(SHAREDDIR)/%.c | ||
145 | - $(CC) $(CFLAGS) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $< | ||
146 | + $(CC) $(CFLAGS_BUILD) $(CFLAGS_PTHREAD) -D_REENTRANT -c -o $@ $< | ||
147 | |||
148 | $(OBJDIR)/%.c.so.o: %.c | ||
149 | - $(CC) $(CFLAGS) -c -fPIC -o $@ $< | ||
150 | + $(CC) $(CFLAGS_BUILD) -c -fPIC -o $@ $< | ||
151 | |||
152 | $(OBJDIR)/%.c.so.o: $(SHAREDDIR)/%.c | ||
153 | - $(CC) $(CFLAGS) -c -fPIC -o $@ $< | ||
154 | + $(CC) $(CFLAGS_BUILD) -c -fPIC -o $@ $< | ||
155 | |||
156 | $(OBJDIR)/%.y.o: $(SHAREDDIR)/%.y | ||
157 | $(BISON) -o $(OBJDIR)/$*.c -d $< | ||
158 | - $(CC) $(CFLAGS) -c -o $@ $(OBJDIR)/$*.c | ||
159 | + $(CC) $(CFLAGS_BUILD) -c -o $@ $(OBJDIR)/$*.c | ||
160 | |||
161 | $(OBJDIR)/%.l.o: $(SHAREDDIR)/%.l | ||
162 | $(FLEX) $(FLEXFLAGS_OS) -i -o$(OBJDIR)/$*.l.c $< | ||
163 | - $(CC) $(CFLAGS) -Wno-error -c -o $@ $(OBJDIR)/$*.l.c | ||
164 | + $(CC) $(CFLAGS_BUILD) -Wno-error -c -o $@ $(OBJDIR)/$*.l.c | ||
165 | -- | ||
166 | 2.9.5 | ||
167 | |||
diff --git a/meta-networking/recipes-protocols/mdns/mdns_878.270.2.bb b/meta-networking/recipes-protocols/mdns/mdns_1096.40.7.bb index 0f8dc92df3..88521c1b2e 100644 --- a/meta-networking/recipes-protocols/mdns/mdns_878.270.2.bb +++ b/meta-networking/recipes-protocols/mdns/mdns_1096.40.7.bb | |||
@@ -9,22 +9,21 @@ COMPATIBLE_HOST_libc-musl = 'null' | |||
9 | RPROVIDES_${PN} += "libdns_sd.so" | 9 | RPROVIDES_${PN} += "libdns_sd.so" |
10 | 10 | ||
11 | SRC_URI = "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \ | 11 | SRC_URI = "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \ |
12 | file://build.patch;patchdir=.. \ | ||
13 | file://mdns.service \ | 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=.. \ | ||
14 | file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch;patchdir=.. \ | 15 | file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch;patchdir=.. \ |
15 | file://0002-Create-subroutine-for-tearing-down-an-interface.patch;patchdir=.. \ | 16 | file://0002-Create-subroutine-for-tearing-down-an-interface.patch;patchdir=.. \ |
16 | file://0003-Track-interface-socket-family.patch;patchdir=.. \ | 17 | file://0003-Track-interface-socket-family.patch;patchdir=.. \ |
17 | file://0004-Use-list-for-changed-interfaces.patch;patchdir=.. \ | 18 | file://0004-Use-list-for-changed-interfaces.patch;patchdir=.. \ |
18 | file://0005-Handle-noisy-netlink-sockets.patch;patchdir=.. \ | ||
19 | file://0006-Remove-unneeded-function.patch;patchdir=.. \ | 19 | file://0006-Remove-unneeded-function.patch;patchdir=.. \ |
20 | file://0007-Indicate-loopback-interface-to-mDNS-core.patch;patchdir=.. \ | ||
21 | file://0008-Mark-deleted-interfaces-as-being-changed.patch;patchdir=.. \ | 20 | file://0008-Mark-deleted-interfaces-as-being-changed.patch;patchdir=.. \ |
22 | file://0009-Fix-possible-NULL-dereference.patch;patchdir=.. \ | 21 | file://0009-Fix-possible-NULL-dereference.patch;patchdir=.. \ |
23 | file://0010-Handle-errors-from-socket-calls.patch;patchdir=.. \ | 22 | file://0010-Handle-errors-from-socket-calls.patch;patchdir=.. \ |
24 | file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch;patchdir=.. \ | 23 | file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch;patchdir=.. \ |
25 | " | 24 | " |
26 | SRC_URI[md5sum] = "4e139a8e1133349006b0436291c9e29b" | 25 | SRC_URI[md5sum] = "ac766013bbcb323e9db4c80805b2552a" |
27 | SRC_URI[sha256sum] = "2cef0ee9900504c5277fb81de0a28e6c0835fe482ebecf1067c6864f5c4eda74" | 26 | SRC_URI[sha256sum] = "b86f4816b4145915198e7c5bf0bc56dbbfd960e9a4518bb6486baa40cdcca7e6" |
28 | 27 | ||
29 | PARALLEL_MAKE = "" | 28 | PARALLEL_MAKE = "" |
30 | 29 | ||