Skip to content

Commit f9701a1

Browse files
nealjackkartben
authored andcommitted
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: Neal Jackson <neal@blueirislabs.com>
1 parent 64de800 commit f9701a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

subsys/mgmt/hawkbit/hawkbit.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <zephyr/mgmt/hawkbit/hawkbit.h>
2222
#include <zephyr/mgmt/hawkbit/config.h>
2323
#include <zephyr/mgmt/hawkbit/event.h>
24-
#include <zephyr/net/dns_resolve.h>
2524
#include <zephyr/net/http/client.h>
2625
#include <zephyr/net/net_ip.h>
2726
#include <zephyr/net/net_mgmt.h>
@@ -75,10 +74,18 @@ static bool hawkbit_initialized;
7574

7675
#endif /* CONFIG_HAWKBIT_DDI_NO_SECURITY */
7776

77+
#ifdef CONFIG_DNS_RESOLVER_MAX_QUERY_LEN
78+
#define SERVER_ADDR_LEN CONFIG_DNS_RESOLVER_MAX_QUERY_LEN
79+
#elif defined(CONFIG_NET_IPV6)
80+
#define SERVER_ADDR_LEN INET6_ADDRSTRLEN
81+
#else
82+
#define SERVER_ADDR_LEN INET_ADDRSTRLEN
83+
#endif
84+
7885
static struct hawkbit_config {
7986
int32_t action_id;
8087
#ifdef CONFIG_HAWKBIT_SET_SETTINGS_RUNTIME
81-
char server_addr[CONFIG_DNS_RESOLVER_MAX_QUERY_LEN + 1];
88+
char server_addr[SERVER_ADDR_LEN + 1];
8289
char server_port[sizeof(STRINGIFY(__UINT16_MAX__))];
8390
#ifndef CONFIG_HAWKBIT_DDI_NO_SECURITY
8491
char ddi_security_token[DDI_SECURITY_TOKEN_SIZE + 1];

0 commit comments

Comments
 (0)