-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mdnsresponder package and update openthread-br to use it by defau…
…lt (#25) * Add mdnsresponder package * Use mdnsresponder for openthread-br by default The new openthread-br-avahi variant of the package continues to use Avahi. Also tweak a few build options and default the UART baud rate to 460800; USB RCPs generally support this baud rate and it avoids the UART interface being the bottleneck for the border router.
- Loading branch information
1 parent
8b60380
commit 79a078c
Showing
11 changed files
with
736 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# Copyright (c) 2024 Apple Inc. | ||
# Copyright (c) 2024 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=mDNSResponder | ||
PKG_VERSION:=2200.140.11 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=mDNSResponder-$(PKG_VERSION).tar.gz | ||
PKG_SOURCE_URL:=https://github.com/apple-oss-distributions/mDNSResponder/archive/refs/tags | ||
PKG_HASH:=f52963497e8baf650e6640fb5769ffbad7c6e45eea833dec2a0ca86a3ca55928 | ||
|
||
# Use local source dir for development | ||
# USE_SOURCE_DIR:=$(HOME)/workspace/mDNSResponder | ||
|
||
PKG_LICENSE:=Apache-2.0 | ||
PKG_LICENSE_FILES:=LICENSE | ||
|
||
PKG_BUILD_PARALLEL:=1 | ||
PKG_CONFIG_DEPENDS:=CONFIG_MDNSD_DEBUG_LOGGING | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/mdnsresponder/Default | ||
SECTION:=net | ||
CATEGORY:=Network | ||
SUBMENU:=IP Addresses and Names | ||
URL:=https://github.com/apple-oss-distributions/mDNSResponder | ||
endef | ||
|
||
define Package/mdnsresponder/Default/description | ||
The mDNS Responder suite consists of a set of daemons, tools, and | ||
libraries that implement Multicast DNS and DNS-SD service discovery. | ||
endef | ||
|
||
|
||
define Package/mdnsresponder | ||
$(call Package/mdnsresponder/Default) | ||
TITLE:=mDNS Responder suite (meta package) | ||
DEPENDS:=+mdnsd +libdnssd +mdns-utils | ||
endef | ||
|
||
define Package/mdnsresponder/description | ||
$(call Package/mdnsresponder/Default/description) | ||
|
||
This meta-package selects all packages in the mDNS Responder suite. | ||
endef | ||
|
||
|
||
define Package/mdnsd | ||
$(call Package/mdnsresponder/Default) | ||
TITLE:=mDNS Responder daemon | ||
MENU:=1 | ||
endef | ||
|
||
define Package/mdnsd/config | ||
if PACKAGE_mdnsd | ||
config MDNSD_DEBUG_LOGGING | ||
bool "Enable debug logging" | ||
default n | ||
endif | ||
endef | ||
|
||
define Package/mdnsd/description | ||
$(call Package/mdnsresponder/Default/description) | ||
|
||
The mDNS Responder daemon serves both as resolver for information | ||
published using multicast DNS (mDNS), and as a publisher of mDNS | ||
information. | ||
endef | ||
|
||
|
||
define Package/libdnssd | ||
$(call Package/mdnsresponder/Default) | ||
SECTION:=libs | ||
CATEGORY:=Libraries | ||
SUBMENU:= | ||
TITLE:=mDNS Responder DNS-SD client library | ||
CONFLICTS:=libavahi-compat-libdnssd | ||
DEPENDS:=+mdnsd | ||
endef | ||
|
||
define Package/libdnssd/description | ||
The DNS-SD client library allows applications to make use of the | ||
functionality provided by mDNSResponder. This includes publishing, | ||
browsing, and resolving of DNS-SD services. | ||
endef | ||
|
||
|
||
define Package/mdns-utils | ||
$(call Package/mdnsresponder/Default) | ||
TITLE:=mDNS Responder utilities | ||
DEPENDS:=+libdnssd | ||
endef | ||
|
||
define Package/mdns-utils/description | ||
This package contains the dns-sd utility. | ||
endef | ||
|
||
|
||
# The GitHub archive tarball has the wrong prefix due to the tag including the package name | ||
TAR_CMD=$(HOST_TAR) -C $(1) --strip-components 1 $(TAR_OPTIONS) | ||
|
||
# Build with os=linux-uclibc ("not glibc") because musl does not support nss. | ||
# Build without debug options or stripping, both are handled via the OpenWrt build system. | ||
# Use gcc as the linker front-end so libssp gets linked automatically if needed. | ||
MAKE_PATH:=mDNSPosix | ||
OUT_DIR:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/build/prod | ||
CLIENTS_OUT_DIR:=$(PKG_BUILD_DIR)/Clients/build | ||
MAKE_FLAGS+=os=linux-uclibc tls=no CFLAGS_DEBUGGING= LD="$(TARGET_CC)" STRIP=: | ||
TARGET_CFLAGS+=\ | ||
-DmDNSResponderVersion=$(PKG_VERSION)-$(PKG_RELEASE) \ | ||
-DMDNS_VERSIONSTR_NODTS \ | ||
-DUNICAST_DISABLED \ | ||
-DMDNS_DEBUGMSGS=$(if CONFIG_MDNSD_DEBUG_LOGGING,1,0) | ||
|
||
# No configure step as such, but make clean on config changes | ||
define Build/Configure | ||
[ -f $(STAMP_CONFIGURED) ] || $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) clean | ||
endef | ||
|
||
define Build/Compile | ||
$(call Build/Compile/Default,Daemon libdns_sd Clients) | ||
endef | ||
|
||
define Build/InstallDev | ||
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib | ||
$(CP) $(PKG_BUILD_DIR)/mDNSShared/dns_sd.h $(1)/usr/include/ | ||
$(CP) $(OUT_DIR)/libdns_sd.so $(1)/usr/lib/ | ||
endef | ||
|
||
# make install is not suitable for a cross-compilation environment, | ||
# pick up files directly from the build directory instead. | ||
Build/Install:=$(empty) | ||
|
||
|
||
Package/mdnsresponder/install:=$(empty) | ||
|
||
define Package/mdnsd/install | ||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d | ||
$(INSTALL_BIN) $(OUT_DIR)/mdnsd $(1)/usr/sbin | ||
$(INSTALL_BIN) ./files/mdnsd.init $(1)/etc/init.d/mdnsd | ||
endef | ||
|
||
define Package/libdnssd/install | ||
$(INSTALL_DIR) $(1)/usr/lib | ||
$(CP) $(OUT_DIR)/libdns_sd.so $(1)/usr/lib/ | ||
endef | ||
|
||
define Package/mdns-utils/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(INSTALL_BIN) $(CLIENTS_OUT_DIR)/dns-sd $(1)/usr/bin | ||
endef | ||
|
||
$(eval $(call BuildPackage,mdnsresponder)) | ||
$(eval $(call BuildPackage,mdnsd)) | ||
$(eval $(call BuildPackage,libdnssd)) | ||
$(eval $(call BuildPackage,mdns-utils)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
# Copyright (c) 2024 Apple Inc. | ||
# Copyright (c) 2024 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
START=50 | ||
|
||
USE_PROCD=1 | ||
PROG=/usr/sbin/mdnsd | ||
|
||
start_service() { | ||
procd_open_instance | ||
procd_set_param command "$PROG" | ||
procd_set_param respawn | ||
procd_close_instance | ||
} |
58 changes: 58 additions & 0 deletions
58
...rty/mdnsresponder/patches/0001-mDNSResponderVersion-and-MDNS_VERSIONSTR_NODTS-handl.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From a3a7a5aed8bab31a9b9bc7f564d062e143a83d71 Mon Sep 17 00:00:00 2001 | ||
From: Karsten Sperling <[email protected]> | ||
Date: Tue, 24 Sep 2024 19:47:40 +1200 | ||
Subject: [PATCH] mDNSResponderVersion and MDNS_VERSIONSTR_NODTS handling | ||
|
||
--- | ||
mDNSPosix/PosixDaemon.c | 18 +++++++++++++----- | ||
mDNSShared/dnssd_clientlib.c | 6 +++++- | ||
2 files changed, 18 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c | ||
index 9a0f692..beda41e 100644 | ||
--- a/mDNSPosix/PosixDaemon.c | ||
+++ b/mDNSPosix/PosixDaemon.c | ||
@@ -270,10 +270,18 @@ asm (".desc ___crashreporter_info__, 0x10"); | ||
#endif | ||
|
||
// For convenience when using the "strings" command, this is the last thing in the file | ||
-#if mDNSResponderVersion > 1 | ||
-mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder-" STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; | ||
-#elif MDNS_VERSIONSTR_NODTS | ||
-mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder (Engineering Build)"; | ||
+#ifndef STRINGIFY | ||
+#define STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s) # s | ||
+#define STRINGIFY(s) STRINGIFY_ARGUMENT_WITHOUT_EXPANSION(s) | ||
+#endif | ||
+ | ||
+mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder" | ||
+#ifdef mDNSResponderVersion | ||
+ "-" STRINGIFY(mDNSResponderVersion) | ||
#else | ||
-mDNSexport const char mDNSResponderVersionString_SCCS[] = "@(#) mDNSResponder (Engineering Build) (" __DATE__ " " __TIME__ ")"; | ||
+ " (Engineering Build)" | ||
+#endif | ||
+#if !MDNS_VERSIONSTR_NODTS | ||
+ " (" __DATE__ " " __TIME__ ")" | ||
#endif | ||
+; | ||
diff --git a/mDNSShared/dnssd_clientlib.c b/mDNSShared/dnssd_clientlib.c | ||
index a1d98d9..75bece2 100644 | ||
--- a/mDNSShared/dnssd_clientlib.c | ||
+++ b/mDNSShared/dnssd_clientlib.c | ||
@@ -372,7 +372,11 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wdate-time" | ||
#endif | ||
-const char VersionString_SCCS_libdnssd[] DNSSD_USED = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion) " (" __DATE__ " " __TIME__ ")"; | ||
+const char VersionString_SCCS_libdnssd[] DNSSD_USED = "@(#) libdns_sd " STRINGIFY(mDNSResponderVersion) | ||
+#if !MDNS_VERSIONSTR_NODTS | ||
+ " (" __DATE__ " " __TIME__ ")" | ||
+#endif | ||
+; | ||
#if defined(__GNUC__) | ||
#pragma GCC diagnostic pop | ||
#endif | ||
-- | ||
2.39.2 | ||
|
25 changes: 25 additions & 0 deletions
25
third_party/mdnsresponder/patches/0002-Avoid-strcmp-with-null.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From edf0afdd8378fd2ce6a2aca050dfdb8a79eab372 Mon Sep 17 00:00:00 2001 | ||
From: Karsten Sperling <[email protected]> | ||
Date: Tue, 24 Sep 2024 19:48:17 +1200 | ||
Subject: [PATCH] Avoid strcmp with null | ||
|
||
--- | ||
mDNSShared/mDNSDebug.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/mDNSShared/mDNSDebug.c b/mDNSShared/mDNSDebug.c | ||
index 7a4ca19..d449dde 100644 | ||
--- a/mDNSShared/mDNSDebug.c | ||
+++ b/mDNSShared/mDNSDebug.c | ||
@@ -71,7 +71,7 @@ mDNSlocal void LogMsgWithLevelv(os_log_t category, os_log_type_t level, const ch | ||
mDNSlocal void LogMsgWithLevelv(const char *category, mDNSLogLevel_t level, const char *format, va_list args) | ||
{ | ||
// Do not print the logs if the log category is MDNS_LOG_CATEGORY_DISABLED. | ||
- if (strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) | ||
+ if (category && strcmp(category, MDNS_LOG_CATEGORY_DISABLED) == 0) | ||
{ | ||
return; | ||
} | ||
-- | ||
2.39.2 | ||
|
76 changes: 76 additions & 0 deletions
76
...rty/mdnsresponder/patches/0003-Ignore-irrelevant-config-files-with-UNICAST_DISABLED.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From b1aff590a9adbc6133819e56aef197fd768134a2 Mon Sep 17 00:00:00 2001 | ||
From: Karsten Sperling <[email protected]> | ||
Date: Wed, 25 Sep 2024 12:40:17 +1200 | ||
Subject: [PATCH] Ignore irrelevant config files with UNICAST_DISABLED | ||
|
||
--- | ||
mDNSCore/uDNS.c | 2 +- | ||
mDNSPosix/PosixDaemon.c | 4 ++++ | ||
mDNSPosix/mDNSPosix.c | 2 ++ | ||
3 files changed, 7 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/mDNSCore/uDNS.c b/mDNSCore/uDNS.c | ||
index c9e9bcd..fe8d372 100644 | ||
--- a/mDNSCore/uDNS.c | ||
+++ b/mDNSCore/uDNS.c | ||
@@ -7277,7 +7277,7 @@ mDNSexport mStatus mDNS_SetSecretForDomain(mDNS *m, DomainAuthInfo *info, const | ||
return mStatus_UnsupportedErr; | ||
} | ||
|
||
-mDNSexport domainname *uDNS_GetNextSearchDomain(mDNSInterfaceID InterfaceID, mDNSs8 *searchIndex, mDNSBool ignoreDotLocal) | ||
+mDNSexport domainname *uDNS_GetNextSearchDomain(mDNSInterfaceID InterfaceID, int *searchIndex, mDNSBool ignoreDotLocal) | ||
{ | ||
(void) InterfaceID; | ||
(void) searchIndex; | ||
diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c | ||
index beda41e..c9867ef 100644 | ||
--- a/mDNSPosix/PosixDaemon.c | ||
+++ b/mDNSPosix/PosixDaemon.c | ||
@@ -50,9 +50,11 @@ extern int daemon(int, int); | ||
#include "uds_daemon.h" | ||
#include "PlatformCommon.h" | ||
|
||
+#ifndef UNICAST_DISABLED | ||
#define CONFIG_FILE "/etc/mdnsd.conf" | ||
static domainname DynDNSZone; // Default wide-area zone for service registration | ||
static domainname DynDNSHostname; | ||
+#endif | ||
|
||
#define RR_CACHE_SIZE 500 | ||
static CacheEntity gRRCache[RR_CACHE_SIZE]; | ||
@@ -87,6 +89,7 @@ mDNSlocal void mDNS_StatusCallback(mDNS *const m, mStatus result) | ||
|
||
static void Reconfigure(mDNS *m) | ||
{ | ||
+#ifndef UNICAST_DISABLED | ||
mDNSAddr DynDNSIP; | ||
const mDNSAddr dummy = { mDNSAddrType_IPv4, { { { 1, 1, 1, 1 } } } };; | ||
mDNS_SetPrimaryInterfaceInfo(m, NULL, NULL, NULL); | ||
@@ -96,6 +99,7 @@ static void Reconfigure(mDNS *m) | ||
mDNSPlatformSourceAddrForDest(&DynDNSIP, &dummy); | ||
if (DynDNSHostname.c[0]) mDNS_AddDynDNSHostName(m, &DynDNSHostname, NULL, NULL); | ||
if (DynDNSIP.type) mDNS_SetPrimaryInterfaceInfo(m, &DynDNSIP, NULL, NULL); | ||
+#endif | ||
mDNS_ConfigChanged(m); | ||
} | ||
|
||
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
index 3b761d0..51cbd9b 100644 | ||
--- a/mDNSPosix/mDNSPosix.c | ||
+++ b/mDNSPosix/mDNSPosix.c | ||
@@ -1852,10 +1852,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS *const m) | ||
// Tell mDNS core about the network interfaces on this machine. | ||
if (err == mStatus_NoError) err = SetupInterfaceList(m); | ||
|
||
+#ifndef UNICAST_DISABLED | ||
// Tell mDNS core about DNS Servers | ||
mDNS_Lock(m); | ||
if (err == mStatus_NoError) ParseDNSServers(m, uDNS_SERVERS_FILE); | ||
mDNS_Unlock(m); | ||
+#endif | ||
|
||
if (err == mStatus_NoError) | ||
{ | ||
-- | ||
2.39.2 | ||
|
25 changes: 25 additions & 0 deletions
25
third_party/mdnsresponder/patches/0004-Run-in-foreground-under-procd.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 9506c22107cb110abeeb94bb6ddeda15c8fc38db Mon Sep 17 00:00:00 2001 | ||
From: Karsten Sperling <[email protected]> | ||
Date: Wed, 25 Sep 2024 18:13:45 +1200 | ||
Subject: [PATCH] Run in foreground under procd | ||
|
||
--- | ||
mDNSPosix/PosixDaemon.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c | ||
index c9867ef..4861895 100644 | ||
--- a/mDNSPosix/PosixDaemon.c | ||
+++ b/mDNSPosix/PosixDaemon.c | ||
@@ -113,7 +113,7 @@ mDNSlocal void ParseCmdLineArgs(int argc, char **argv) | ||
} | ||
if (!mDNS_DebugMode) | ||
{ | ||
- int result = daemon(0, 0); | ||
+ int result = 0; //daemon(0, 0); | ||
if (result != 0) { LogMsg("Could not run as daemon - exiting"); exit(result); } | ||
#if __APPLE__ | ||
LogMsg("The POSIX mdnsd should only be used on OS X for testing - exiting"); | ||
-- | ||
2.39.2 | ||
|
Oops, something went wrong.