Commit f9701a1a authored by Neal Jackson's avatar Neal Jackson Committed by Benjamin Cabé
Browse files

mgmt: hawkbit: remove DNS_RESOLVER requirement for server_addr

This commit removes the requirement for DNS_RESOLVER. If DNS_RESOLVER is
enabled, hawkbit uses `CONFIG_DNS_RESOLVER_MAX_QUERY_LEN` for the
server_addr buffer, if disabled it uses `CONFIG_INET6_ADDRSTRLEN`.
This adheres to #89533 which removes the requirement for DNS_RESOLVER.

Signed-off-by: default avatarNeal Jackson <neal@blueirislabs.com>
parent 64de800a
Loading
Loading
Loading
Loading
+9 −2
Changes for subsys/mgmt/hawkbit/hawkbit.c: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include <zephyr/mgmt/hawkbit/hawkbit.h>
#include <zephyr/mgmt/hawkbit/config.h>
#include <zephyr/mgmt/hawkbit/event.h>
#include <zephyr/net/dns_resolve.h>
#include <zephyr/net/http/client.h>
#include <zephyr/net/net_ip.h>
#include <zephyr/net/net_mgmt.h>
@@ -75,10 +74,18 @@ static bool hawkbit_initialized;

#endif /* CONFIG_HAWKBIT_DDI_NO_SECURITY */

#ifdef CONFIG_DNS_RESOLVER_MAX_QUERY_LEN
#define SERVER_ADDR_LEN CONFIG_DNS_RESOLVER_MAX_QUERY_LEN
#elif defined(CONFIG_NET_IPV6)
#define SERVER_ADDR_LEN INET6_ADDRSTRLEN
#else
#define SERVER_ADDR_LEN INET_ADDRSTRLEN
#endif

static struct hawkbit_config {
	int32_t action_id;
#ifdef CONFIG_HAWKBIT_SET_SETTINGS_RUNTIME
	char server_addr[CONFIG_DNS_RESOLVER_MAX_QUERY_LEN + 1];
	char server_addr[SERVER_ADDR_LEN + 1];
	char server_port[sizeof(STRINGIFY(__UINT16_MAX__))];
#ifndef CONFIG_HAWKBIT_DDI_NO_SECURITY
	char ddi_security_token[DDI_SECURITY_TOKEN_SIZE + 1];