diff --git a/libs/avahi/Makefile b/libs/avahi/Makefile index 1ea497c561d51e..94433224af4dd5 100644 --- a/libs/avahi/Makefile +++ b/libs/avahi/Makefile @@ -1,6 +1,4 @@ # -# Copyright (C) 2007-2016 OpenWrt.org -# # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # @@ -8,15 +6,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=avahi -PKG_VERSION:=0.8 -PKG_RELEASE:=8 +PKG_VERSION:=0.9_rc4 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/lathiat/avahi/releases/download/v$(PKG_VERSION) \ - https://avahi.org/download -PKG_HASH:=060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda +PKG_SOURCE:=$(PKG_NAME)-0.9-rc4.tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/avahi/avahi/tar.gz/v0.9-rc4? +PKG_HASH:=08fcc57377ed05416ec4b3d8a179da716a7a9376821551a5ae16f8276a1ef0b5 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-0.9-rc4 -PKG_MAINTAINER:=Ted Hess +PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=LGPL-2.1-or-later PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:avahi:avahi @@ -31,7 +29,7 @@ define Package/avahi/Default SECTION:=net CATEGORY:=Network TITLE:=An mDNS/DNS-SD implementation - URL:=http://www.avahi.org/ + URL:=https://avahi.org/ endef define Package/avahi/Default/description @@ -67,6 +65,7 @@ define Package/avahi-autoipd SUBMENU:=IP Addresses and Names DEPENDS:=+libdaemon TITLE:=IPv4LL network address configuration daemon + USERID:=avahi=105:avahi=105 endef define Package/avahi-autoipd/description @@ -86,6 +85,7 @@ define Package/avahi-dbus-daemon SUBMENU:=IP Addresses and Names DEPENDS:=+libavahi-dbus-support +libexpat +librt +libdaemon TITLE+= (daemon) + USERID:=avahi=105:avahi=105 endef define Package/avahi-nodbus-daemon @@ -153,6 +153,7 @@ define Package/avahi-dnsconfd SUBMENU:=IP Addresses and Names DEPENDS:=+libavahi +libdaemon +libpthread TITLE:=A Unicast DNS server using avahi-daemon + USERID:=avahi=105:avahi=105 endef define Package/avahi-dnsconfd/description @@ -217,23 +218,6 @@ $(call Package/avahi/Default/description) For more information please see the avahi documentation. endef -define Package/libavahi-compat-libdnssd - $(call Package/avahi/Default) - SECTION:=libs - CATEGORY:=Libraries - VARIANT:=dbus - DEPENDS:=+libavahi-client - TITLE+= (libdnssd) -endef - -define Package/libavahi-compat-libdnssd/description -$(call Package/avahi/Default/description) - . - This packages adds the libavahi-compat-libdnssd library. - It also automatically adds the required libavahi-client package. - For more information please see the avahi documentation. -endef - define Package/avahi-utils $(call Package/avahi/Default) SUBMENU:=IP Addresses and Names @@ -285,19 +269,17 @@ CONFIGURE_ARGS += \ --disable-manpages \ --disable-xmltoman \ --disable-tests \ + --disable-libsystemd \ + --with-systemdsystemunitdir=no \ --with-xml=expat \ --with-distro=none \ - --with-avahi-user=nobody \ - --with-avahi-group=nogroup \ - --with-avahi-priv-access-group=nogroup \ - --with-autoipd-user=nobody \ - --with-autoipd-group=nogroup + --with-avahi-user=avahi \ + --with-avahi-group=avahi \ + --with-avahi-priv-access-group=avahi \ + --with-autoipd-user=avahi \ + --with-autoipd-group=avahi ifeq ($(BUILD_VARIANT),dbus) -ifneq ($(CONFIG_PACKAGE_libavahi-compat-libdnssd),) -CONFIGURE_ARGS += \ - --enable-compat-libdns_sd -endif CONFIGURE_ARGS += \ --enable-dbus else @@ -314,11 +296,6 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-* $(1)/usr/lib/ -ifneq ($(CONFIG_PACKAGE_libavahi-compat-libdnssd),) -ifeq ($(BUILD_VARIANT),dbus) - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdns_sd* $(1)/usr/lib/ -endif -endif $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/ endef @@ -331,7 +308,7 @@ endef define Package/libavahi-dbus-support/install $(call Package/libavahi/install,$(1)) $(INSTALL_DIR) $(1)/etc/dbus-1/system.d - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/* $(1)/etc/dbus-1/system.d + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/system.d/* $(1)/etc/dbus-1/system.d endef Package/libavahi-nodbus-support/install=$(Package/libavahi/install) @@ -341,11 +318,6 @@ define Package/libavahi-client/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/libavahi-client.so.* $(1)/usr/lib/ endef -define Package/libavahi-compat-libdnssd/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdns_sd.so* $(1)/usr/lib/ -endef - define Package/avahi-utils/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ @@ -393,7 +365,6 @@ define Package/avahi-dnsconfd/install endef $(eval $(call BuildPackage,libavahi-client)) -$(eval $(call BuildPackage,libavahi-compat-libdnssd)) $(eval $(call BuildPackage,avahi-utils)) $(eval $(call BuildPackage,libavahi-dbus-support)) $(eval $(call BuildPackage,libavahi-nodbus-support)) diff --git a/libs/avahi/files/avahi-daemon.conf b/libs/avahi/files/avahi-daemon.conf index 7ec88e466b1718..3ef0788ebcec86 100644 --- a/libs/avahi/files/avahi-daemon.conf +++ b/libs/avahi/files/avahi-daemon.conf @@ -5,7 +5,6 @@ use-ipv4=yes use-ipv6=yes check-response-ttl=no use-iff-running=no -deny-interfaces=wpan0 [publish] publish-addresses=yes diff --git a/libs/avahi/patches/020-no-po-subdir.patch b/libs/avahi/patches/020-no-po-subdir.patch new file mode 100644 index 00000000000000..752289709c8d4d --- /dev/null +++ b/libs/avahi/patches/020-no-po-subdir.patch @@ -0,0 +1,31 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -78,8 +78,7 @@ SUBDIRS = \ + avahi-autoipd \ + avahi-ui \ + avahi-ui-sharp \ +- avahi-libevent \ +- po ++ avahi-libevent + + DX_INPUT = \ + $(srcdir)/avahi-common/address.h \ +--- a/configure.ac ++++ b/configure.ac +@@ -425,8 +425,6 @@ fi + GETTEXT_PACKAGE=avahi + AC_SUBST([GETTEXT_PACKAGE]) + AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) +-AM_GNU_GETTEXT_VERSION([0.19.8]) +-AM_GNU_GETTEXT([external]) + + # Check for pkg-config manually first, as if its not installed the + # PKG_PROG_PKG_CONFIG macro won't be defined. +@@ -1177,7 +1175,6 @@ avahi-compat-howl/samples/Makefile + avahi-autoipd/Makefile + avahi-ui/Makefile + avahi-libevent/Makefile +-po/Makefile.in + ]) + AC_OUTPUT + diff --git a/libs/avahi/patches/020-revert-runtime-dir-systemd-change.patch b/libs/avahi/patches/020-revert-runtime-dir-systemd-change.patch deleted file mode 100644 index 6a6f903084b5fd..00000000000000 --- a/libs/avahi/patches/020-revert-runtime-dir-systemd-change.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure.ac -+++ b/configure.ac -@@ -1004,7 +1004,7 @@ AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_GROUP," - # - # Avahi runtime dir - # --avahi_runtime_dir="/run" -+avahi_runtime_dir="${localstatedir}/run" - avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket" - AC_SUBST(avahi_runtime_dir) - AC_SUBST(avahi_socket) diff --git a/libs/avahi/patches/100-p2p-no-iff_multicast-required.patch b/libs/avahi/patches/100-p2p-no-iff_multicast-required.patch deleted file mode 100644 index 11a0dc7a240dbb..00000000000000 --- a/libs/avahi/patches/100-p2p-no-iff_multicast-required.patch +++ /dev/null @@ -1,45 +0,0 @@ -commit 2b6bccca5d9d8ab7f11219a639707b325910a0b1 -Author: Philip Prindeville -Date: Thu Sep 17 00:27:55 2020 +0000 - - Logic for p2p on tunnels incorrectly requires IFF_MULTICAST (#305) - - Signed-off-by: Philip Prindeville - ---- a/avahi-core/iface-linux.c -+++ b/avahi-core/iface-linux.c -@@ -105,8 +105,8 @@ static void netlink_callback(AvahiNetlin - (ifinfomsg->ifi_flags & IFF_UP) && - (!m->server->config.use_iff_running || (ifinfomsg->ifi_flags & IFF_RUNNING)) && - ((ifinfomsg->ifi_flags & IFF_LOOPBACK) || -- (ifinfomsg->ifi_flags & IFF_MULTICAST)) && -- (m->server->config.allow_point_to_point || !(ifinfomsg->ifi_flags & IFF_POINTOPOINT)); -+ (ifinfomsg->ifi_flags & IFF_MULTICAST) || -+ ((ifinfomsg->ifi_flags & IFF_POINTOPOINT) && m->server->config.allow_point_to_point)); - - /* Handle interface attributes */ - l = NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg)); ---- a/avahi-core/iface-pfroute.c -+++ b/avahi-core/iface-pfroute.c -@@ -81,8 +81,8 @@ static void rtm_info(struct rt_msghdr *r - (ifm->ifm_flags & IFF_UP) && - (!m->server->config.use_iff_running || (ifm->ifm_flags & IFF_RUNNING)) && - ((ifm->ifm_flags & IFF_LOOPBACK) || -- (ifm->ifm_flags & IFF_MULTICAST)) && -- (m->server->config.allow_point_to_point || !(ifm->ifm_flags & IFF_POINTOPOINT)); -+ (ifm->ifm_flags & IFF_MULTICAST) || -+ ((ifm->ifm_flags & IFF_POINTOPOINT) && m->server->config.allow_point_to_point)); - - avahi_free(hw->name); - hw->name = avahi_strndup(sdl->sdl_data, sdl->sdl_nlen); -@@ -428,8 +428,8 @@ static void if_add_interface(struct lifr - (flags & IFF_UP) && - (!m->server->config.use_iff_running || (flags & IFF_RUNNING)) && - ((flags & IFF_LOOPBACK) || -- (flags & IFF_MULTICAST)) && -- (m->server->config.allow_point_to_point || !(flags & IFF_POINTOPOINT)); -+ (flags & IFF_MULTICAST) || -+ ((flags & IFF_POINTOPOINT) && m->server->config.allow_point_to_point)); - hw->name = avahi_strdup(lifreq->lifr_name); - hw->mtu = mtu; - /* TODO get mac address */ diff --git a/libs/avahi/patches/200-Fix-NULL-pointer-crashes-from-175.patch b/libs/avahi/patches/200-Fix-NULL-pointer-crashes-from-175.patch deleted file mode 100644 index fbf8e8ecc0e2f8..00000000000000 --- a/libs/avahi/patches/200-Fix-NULL-pointer-crashes-from-175.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 9d31939e55280a733d930b15ac9e4dda4497680c Mon Sep 17 00:00:00 2001 -From: Tommi Rantala -Date: Mon, 8 Feb 2021 11:04:43 +0200 -Subject: [PATCH] Fix NULL pointer crashes from #175 - -avahi-daemon is crashing when running "ping .local". -The crash is due to failing assertion from NULL pointer. -Add missing NULL pointer checks to fix it. - -Introduced in #175 - merge commit 8f75a045709a780c8cf92a6a21e9d35b593bdecd - -[Retrieved from: -https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c] -Signed-off-by: Fabrice Fontaine ---- - avahi-core/browse-dns-server.c | 5 ++++- - avahi-core/browse-domain.c | 5 ++++- - avahi-core/browse-service-type.c | 3 +++ - avahi-core/browse-service.c | 3 +++ - avahi-core/browse.c | 3 +++ - avahi-core/resolve-address.c | 5 ++++- - avahi-core/resolve-host-name.c | 5 ++++- - avahi-core/resolve-service.c | 5 ++++- - 8 files changed, 29 insertions(+), 5 deletions(-) - ---- a/avahi-core/browse-dns-server.c -+++ b/avahi-core/browse-dns-server.c -@@ -343,7 +343,10 @@ AvahiSDNSServerBrowser *avahi_s_dns_serv - AvahiSDNSServerBrowser* b; - - b = avahi_s_dns_server_browser_prepare(server, interface, protocol, domain, type, aprotocol, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_dns_server_browser_start(b); - - return b; --} -\ No newline at end of file -+} ---- a/avahi-core/browse-domain.c -+++ b/avahi-core/browse-domain.c -@@ -253,7 +253,10 @@ AvahiSDomainBrowser *avahi_s_domain_brow - AvahiSDomainBrowser *b; - - b = avahi_s_domain_browser_prepare(server, interface, protocol, domain, type, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_domain_browser_start(b); - - return b; --} -\ No newline at end of file -+} ---- a/avahi-core/browse-service-type.c -+++ b/avahi-core/browse-service-type.c -@@ -171,6 +171,9 @@ AvahiSServiceTypeBrowser *avahi_s_servic - AvahiSServiceTypeBrowser *b; - - b = avahi_s_service_type_browser_prepare(server, interface, protocol, domain, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_service_type_browser_start(b); - - return b; ---- a/avahi-core/browse-service.c -+++ b/avahi-core/browse-service.c -@@ -184,6 +184,9 @@ AvahiSServiceBrowser *avahi_s_service_br - AvahiSServiceBrowser *b; - - b = avahi_s_service_browser_prepare(server, interface, protocol, service_type, domain, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_service_browser_start(b); - - return b; ---- a/avahi-core/browse.c -+++ b/avahi-core/browse.c -@@ -634,6 +634,9 @@ AvahiSRecordBrowser *avahi_s_record_brow - AvahiSRecordBrowser *b; - - b = avahi_s_record_browser_prepare(server, interface, protocol, key, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_record_browser_start_query(b); - - return b; ---- a/avahi-core/resolve-address.c -+++ b/avahi-core/resolve-address.c -@@ -286,7 +286,10 @@ AvahiSAddressResolver *avahi_s_address_r - AvahiSAddressResolver *b; - - b = avahi_s_address_resolver_prepare(server, interface, protocol, address, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_address_resolver_start(b); - - return b; --} -\ No newline at end of file -+} ---- a/avahi-core/resolve-host-name.c -+++ b/avahi-core/resolve-host-name.c -@@ -318,7 +318,10 @@ AvahiSHostNameResolver *avahi_s_host_nam - AvahiSHostNameResolver *b; - - b = avahi_s_host_name_resolver_prepare(server, interface, protocol, host_name, aprotocol, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_host_name_resolver_start(b); - - return b; --} -\ No newline at end of file -+} ---- a/avahi-core/resolve-service.c -+++ b/avahi-core/resolve-service.c -@@ -519,7 +519,10 @@ AvahiSServiceResolver *avahi_s_service_r - AvahiSServiceResolver *b; - - b = avahi_s_service_resolver_prepare(server, interface, protocol, name, type, domain, aprotocol, flags, callback, userdata); -+ if (!b) -+ return NULL; -+ - avahi_s_service_resolver_start(b); - - return b; --} -\ No newline at end of file -+} diff --git a/libs/avahi/patches/201-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-event.patch b/libs/avahi/patches/201-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-event.patch deleted file mode 100644 index 6a2123f519e3be..00000000000000 --- a/libs/avahi/patches/201-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-event.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Riccardo Schirone -Date: Fri, 26 Mar 2021 11:50:24 +0100 -Subject: Avoid infinite-loop in avahi-daemon by handling HUP event in - client_work - -If a client fills the input buffer, client_work() disables the -AVAHI_WATCH_IN event, thus preventing the function from executing the -`read` syscall the next times it is called. However, if the client then -terminates the connection, the socket file descriptor receives a HUP -event, which is not handled, thus the kernel keeps marking the HUP event -as occurring. While iterating over the file descriptors that triggered -an event, the client file descriptor will keep having the HUP event and -the client_work() function is always called with AVAHI_WATCH_HUP but -without nothing being done, thus entering an infinite loop. - -See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984938 - -(cherry picked from commit 447affe29991ee99c6b9732fc5f2c1048a611d3b) ---- - avahi-daemon/simple-protocol.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/avahi-daemon/simple-protocol.c -+++ b/avahi-daemon/simple-protocol.c -@@ -424,6 +424,11 @@ static void client_work(AvahiWatch *watc - } - } - -+ if (events & AVAHI_WATCH_HUP) { -+ client_free(c); -+ return; -+ } -+ - c->server->poll_api->watch_update( - watch, - (c->outbuf_length > 0 ? AVAHI_WATCH_OUT : 0) | diff --git a/libs/avahi/patches/202-avahi_dns_packet_consume_uint32-fix-potential-undefined-b.patch b/libs/avahi/patches/202-avahi_dns_packet_consume_uint32-fix-potential-undefined-b.patch deleted file mode 100644 index c757d6b787a9b7..00000000000000 --- a/libs/avahi/patches/202-avahi_dns_packet_consume_uint32-fix-potential-undefined-b.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: traffic-millions <60914101+traffic-millions@users.noreply.github.com> -Date: Tue, 3 Mar 2020 11:15:48 +0800 -Subject: avahi_dns_packet_consume_uint32: fix potential undefined behavior - -avahi_dns_packet_consume_uint32 left shifts uint8_t values by 8, 16 and 24 bits to combine them into a 32-bit value. This produces an undefined behavior warning with gcc -fsanitize when fed input values of 128 or 255 however in testing no actual unexpected behavior occurs in practice and the 32-bit uint32_t is always correctly produced as the final value is immediately stored into a uint32_t and the compiler appears to handle this "correctly". - -Cast the intermediate values to uint32_t to prevent this warning and ensure the intended result is explicit. - -Closes: #267 -Closes: #268 -Reference: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19304 -Origin: upstream, 0.9, commit:b897ca43ac100d326d118e5877da710eb7f836f9 ---- - avahi-core/dns.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/avahi-core/dns.c -+++ b/avahi-core/dns.c -@@ -455,7 +455,7 @@ int avahi_dns_packet_consume_uint32(Avah - return -1; - - d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex); -- *ret_v = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; -+ *ret_v = ((uint32_t)d[0] << 24) | ((uint32_t)d[1] << 16) | ((uint32_t)d[2] << 8) | (uint32_t)d[3]; - p->rindex += sizeof(uint32_t); - - return 0; diff --git a/libs/avahi/patches/203-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch b/libs/avahi/patches/203-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch deleted file mode 100644 index d6d5490ead15e5..00000000000000 --- a/libs/avahi/patches/203-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Gustavo Noronha Silva -Date: Sun, 2 Jan 2022 22:29:04 -0300 -Subject: Do not disable timeout cleanup on watch cleanup - -This was causing timeouts to never be removed from the linked list that -tracks them, resulting in both memory and CPU usage to grow larger over -time. ---- - avahi-common/simple-watch.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/avahi-common/simple-watch.c -+++ b/avahi-common/simple-watch.c -@@ -238,7 +238,7 @@ static void cleanup_watches(AvahiSimpleP - destroy_watch(w); - } - -- s->timeout_req_cleanup = 0; -+ s->watch_req_cleanup = 0; - } - - static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) { diff --git a/libs/avahi/patches/204-Emit-error-if-requested-service-is-not-found.patch b/libs/avahi/patches/204-Emit-error-if-requested-service-is-not-found.patch deleted file mode 100644 index c4c87b4fd927ac..00000000000000 --- a/libs/avahi/patches/204-Emit-error-if-requested-service-is-not-found.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: =?utf-8?b?UGV0ciBNZW7FocOtaw==?= -Date: Thu, 17 Nov 2022 01:51:53 +0100 -Subject: Emit error if requested service is not found - -It currently just crashes instead of replying with error. Check return -value and emit error instead of passing NULL pointer to reply. - -Fixes #375 - -(cherry picked from commit a2696da2f2c50ac43b6c4903f72290d5c3fa9f6f) ---- - avahi-daemon/dbus-protocol.c | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) - ---- a/avahi-daemon/dbus-protocol.c -+++ b/avahi-daemon/dbus-protocol.c -@@ -375,10 +375,14 @@ static DBusHandlerResult dbus_get_altern - } - - t = avahi_alternative_host_name(n); -- avahi_dbus_respond_string(c, m, t); -- avahi_free(t); -- -- return DBUS_HANDLER_RESULT_HANDLED; -+ if (t) { -+ avahi_dbus_respond_string(c, m, t); -+ avahi_free(t); -+ -+ return DBUS_HANDLER_RESULT_HANDLED; -+ } else { -+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Hostname not found"); -+ } - } - - static DBusHandlerResult dbus_get_alternative_service_name(DBusConnection *c, DBusMessage *m, DBusError *error) { -@@ -389,10 +393,14 @@ static DBusHandlerResult dbus_get_altern - } - - t = avahi_alternative_service_name(n); -- avahi_dbus_respond_string(c, m, t); -- avahi_free(t); -- -- return DBUS_HANDLER_RESULT_HANDLED; -+ if (t) { -+ avahi_dbus_respond_string(c, m, t); -+ avahi_free(t); -+ -+ return DBUS_HANDLER_RESULT_HANDLED; -+ } else { -+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Service not found"); -+ } - } - - static DBusHandlerResult dbus_create_new_entry_group(DBusConnection *c, DBusMessage *m, DBusError *error) { diff --git a/libs/avahi/patches/205-conf-file-line-lengths.patch b/libs/avahi/patches/205-conf-file-line-lengths.patch deleted file mode 100644 index 3ea8a1de1eff26..00000000000000 --- a/libs/avahi/patches/205-conf-file-line-lengths.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/avahi-daemon/ini-file-parser.c -+++ b/avahi-daemon/ini-file-parser.c -@@ -50,7 +50,7 @@ AvahiIniFile* avahi_ini_file_load(const - - line = 0; - while (!feof(fo)) { -- char ln[256], *s, *e; -+ char ln[1024], *s, *e; - AvahiIniFilePair *pair; - - if (!(fgets(ln, sizeof(ln), fo))) diff --git a/libs/avahi/test-version.sh b/libs/avahi/test-version.sh new file mode 100644 index 00000000000000..2d3601aa3b9c18 --- /dev/null +++ b/libs/avahi/test-version.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# shellcheck shell=busybox + +_version_check() { + local bin="$1" pkg="$2" ver="$3" + # apk versions use _ where upstream uses - (e.g. 0.9_rc4 vs 0.9-rc4) + local upstream_ver + upstream_ver=$(echo "$ver" | tr '_' '-') + "$bin" -V 2>&1 | grep -F "$upstream_ver" || { + echo "FAIL: $bin -V did not print expected version '$upstream_ver'" + exit 1 + } +} + +case "$PKG_NAME" in +avahi-autoipd) + _version_check avahi-autoipd avahi-autoipd "$PKG_VERSION" + ;; + +avahi-dbus-daemon|\ +avahi-nodbus-daemon) + _version_check avahi-daemon avahi-daemon "$PKG_VERSION" + ;; + +avahi-dnsconfd) + _version_check avahi-dnsconfd avahi-dnsconfd "$PKG_VERSION" + ;; + +avahi-daemon-service-http|\ +avahi-daemon-service-ssh|\ +avahi-utils|\ +libavahi-client|\ +libavahi-dbus-support|\ +libavahi-nodbus-support) + exit 0 + ;; + +*) + echo "Untested package: $PKG_NAME" >&2 + exit 1 + ;; +esac diff --git a/libs/avahi/test.sh b/libs/avahi/test.sh new file mode 100644 index 00000000000000..a57c0f87e22eff --- /dev/null +++ b/libs/avahi/test.sh @@ -0,0 +1,187 @@ +#!/bin/sh + +_lib_check() { + local f="$1" + [ -e "$f" ] || { echo "FAIL: $f not found"; exit 1; } +} + +# Test avahi-daemon startup with a minimal config. +# Works for both dbus and nodbus variants; dbus variant skips the start +# test when avahi-utils (which needs dbus) is not installed. +_daemon_start_test() { + # Config file from package + [ -f /etc/avahi/avahi-daemon.conf ] || { + echo "FAIL: /etc/avahi/avahi-daemon.conf not installed" + exit 1 + } + grep -q "use-ipv4=yes" /etc/avahi/avahi-daemon.conf || { + echo "FAIL: use-ipv4=yes not found in avahi-daemon.conf" + exit 1 + } + [ -d /etc/avahi/services ] || { + echo "FAIL: /etc/avahi/services directory not installed" + exit 1 + } + + # Try to start avahi-daemon with a minimal config and no privilege drop + mkdir -p /var/run/avahi-daemon /tmp/avahi-test + + cat > /tmp/avahi-test/avahi-daemon.conf <<-'EOF' + [server] + host-name=avahi-test + use-ipv4=yes + use-ipv6=no + check-response-ttl=no + use-iff-running=no + enable-dbus=no + + [wide-area] + enable-wide-area=no + + [publish] + publish-addresses=yes + publish-hinfo=no + publish-workstation=no + publish-domain=yes + disable-publishing=no + + [reflector] + enable-reflector=no + + [rlimits] + rlimit-core=0 + rlimit-data=4194304 + rlimit-fsize=0 + rlimit-nofile=30 + rlimit-stack=4194304 + rlimit-nproc=3 + EOF + + avahi-daemon --no-drop-root --no-chroot \ + --file=/tmp/avahi-test/avahi-daemon.conf \ + -D 2>/tmp/avahi-test/daemon.log + + # Wait for pid file + i=0 + while [ $i -lt 10 ] && [ ! -f /var/run/avahi-daemon/pid ]; do + sleep 1 + i=$((i + 1)) + done + + if [ -f /var/run/avahi-daemon/pid ]; then + echo "avahi-daemon started (pid $(cat /var/run/avahi-daemon/pid))" + + # Verify socket exists + [ -e /var/run/avahi-daemon/socket ] && echo "socket present" || \ + echo "NOTE: socket not present (may need network)" + + # Stop the daemon + kill "$(cat /var/run/avahi-daemon/pid)" 2>/dev/null + i=0 + while [ $i -lt 5 ] && [ -f /var/run/avahi-daemon/pid ]; do + sleep 1; i=$((i + 1)) + done + echo "avahi-daemon stopped" + else + echo "NOTE: avahi-daemon did not start within 10s (may need network interface)" + echo "daemon log:" + cat /tmp/avahi-test/daemon.log 2>/dev/null + # Not a hard failure — network may not be available in all test envs + fi + + rm -rf /tmp/avahi-test +} + +_service_file_check() { + local f="$1" stype="$2" port="$3" + + [ -f "$f" ] || { echo "FAIL: $f not found"; exit 1; } + + # Validate it is XML and contains expected service attributes + grep -q "" "$f" || { echo "FAIL: $f missing "; exit 1; } + grep -q "_${stype}._tcp" "$f" || { + echo "FAIL: $f missing _${stype}._tcp" + exit 1 + } + grep -q "$port" "$f" || { + echo "FAIL: $f missing $port" + exit 1 + } + echo "$f: OK" +} + +case "$1" in +libavahi-dbus-support) + _lib_check /usr/lib/libavahi-common.so.3 + _lib_check /usr/lib/libavahi-core.so.7 + # D-Bus policy file + [ -f /etc/dbus-1/system.d/avahi-dbus.conf ] || { + echo "FAIL: avahi D-Bus policy not installed" + exit 1 + } + grep -q "avahi" /etc/dbus-1/system.d/avahi-dbus.conf || { + echo "FAIL: avahi-dbus.conf does not mention avahi" + exit 1 + } + ;; + +libavahi-nodbus-support) + _lib_check /usr/lib/libavahi-common.so.3 + _lib_check /usr/lib/libavahi-core.so.7 + ;; + +libavahi-client) + _lib_check /usr/lib/libavahi-client.so.3 + ;; + +avahi-dbus-daemon|avahi-nodbus-daemon) + _daemon_start_test + ;; + +avahi-autoipd) + [ -x /usr/sbin/avahi-autoipd ] || { echo "FAIL: avahi-autoipd not executable"; exit 1; } + [ -x /etc/avahi/avahi-autoipd.action ] || { + echo "FAIL: avahi-autoipd.action script not installed" + exit 1 + } + [ -f /lib/netifd/proto/autoip.sh ] || { + echo "FAIL: netifd autoip proto script not installed" + exit 1 + } + ;; + +avahi-daemon-service-http) + _service_file_check /etc/avahi/services/http.service http 80 + ;; + +avahi-daemon-service-ssh) + _service_file_check /etc/avahi/services/ssh.service ssh 22 + ;; + +avahi-dnsconfd) + [ -x /usr/sbin/avahi-dnsconfd ] || { echo "FAIL: avahi-dnsconfd not executable"; exit 1; } + [ -x /etc/avahi/avahi-dnsconfd.action ] || { + echo "FAIL: avahi-dnsconfd.action not installed" + exit 1 + } + ;; + +avahi-utils) + # All four utilities must be present and print a help/usage line + for bin in avahi-browse avahi-publish avahi-resolve avahi-set-host-name; do + [ -x "/usr/bin/$bin" ] || { echo "FAIL: $bin not found"; exit 1; } + # --help exits non-zero on some versions; capture stderr+stdout + "$bin" --help 2>&1 | grep -qi "usage\|help\|option" || { + echo "FAIL: $bin --help produced no usage output" + exit 1 + } + echo "$bin: OK" + done + + # Verify avahi-browse can list service types (fails fast without daemon; + # the important thing is the binary runs and parses arguments) + avahi-browse --terminate --all 2>&1 | grep -qi "avahi\|failed\|error\|No.*daemon\|socket\|service" && \ + echo "avahi-browse --terminate --all: ran" || \ + echo "avahi-browse --terminate --all: no output (daemon not running)" + ;; +esac