Skip to content

Commit

Permalink
lte_connectivity: fix LTE_CONNECTIVITY build with CONFIG_POSIX_API=y
Browse files Browse the repository at this point in the history
inet_pton() function is only accessible when:
 * CONFIG_POSIX_API=y or
 * CONFIG_NET_SOCKETS_POSIX_NAMES=y
are enabled.

Depending on the selected option (both are mutually exclusive), its
definition is located in different header file.
`lte_ip_addr_helper.c` (part of LTE_CONNECTIVITY) is including just one
of those, assuming CONFIG_NET_SOCKETS_POSIX_NAMES=y.

Add compatibility with CONFIG_POSIX_API=y by including `arpa/inet.h`
whenever POSIX API is enabled.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
  • Loading branch information
mniestroj authored and rlubos committed Aug 10, 2023
1 parent 1bc3c28 commit 91308a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/nrf_modem_lib/lte_connectivity/lte_ip_addr_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include <nrf_modem_at.h>
#include <string.h>

#ifdef CONFIG_POSIX_API
#include <arpa/inet.h>
#endif

#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(ip_addr_helper, CONFIG_LTE_CONNECTIVITY_LOG_LEVEL);
Expand Down

0 comments on commit 91308a0

Please sign in to comment.