Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
samples: common: make net_connect() a noop with NET_CONFIG_NEED_IPV4
Browse files Browse the repository at this point in the history
In case of CONFIG_NET_CONFIG_NEED_IPV4=y Zephyr networking subsystem
initialization code already takes care about configuring IP layer and
making sure there is assigned IPv4 address before reaching 'main()'
function. Make net_connect() a noop in that case, as no more networking
setup is needed.

Signed-off-by: Marcin Niestroj <[email protected]>
  • Loading branch information
mniestroj committed Oct 12, 2023
1 parent 25f9752 commit 976421a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion samples/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zephyr_library_sources(net_connect.c)
zephyr_library_sources_ifndef(CONFIG_NET_CONFIG_NEED_IPV4 net_connect.c)
zephyr_library_sources_ifdef(CONFIG_GOLIOTH_SAMPLE_HARDCODED_CREDENTIALS hardcoded_credentials.c)
zephyr_library_sources_ifdef(CONFIG_GOLIOTH_SAMPLE_NRF91_LTE_MONITOR nrf91_lte_monitor.c)
zephyr_library_sources_ifdef(CONFIG_GOLIOTH_SAMPLE_PSK_SETTINGS settings_golioth.c)
Expand Down
4 changes: 4 additions & 0 deletions samples/common/include/samples/common/net_connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* @{
*/

#ifdef CONFIG_NET_CONFIG_NEED_IPV4
static inline void net_connect(void) {}
#else
void net_connect(void);
#endif

/** @} */

Expand Down

0 comments on commit 976421a

Please sign in to comment.