Skip to content

Commit 5f648ff

Browse files
committed
zephyr/main: Check default netif before applying operations to it.
If no network driver is enabled (e.g., it doesn't exist for a particular board), it will be NULL.
1 parent aa9ce28 commit 5f648ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zephyr/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ static char heap[MICROPY_HEAP_SIZE];
6262

6363
void init_zephyr(void) {
6464
// TODO: Make addresses configurable
65+
#ifdef CONFIG_NETWORKING
66+
if (net_if_get_default() == NULL) {
67+
// If there's no default networking interface,
68+
// there's nothing to configure.
69+
return;
70+
}
71+
#endif
6572
#ifdef CONFIG_NET_IPV4
6673
static struct in_addr in4addr_my = {{{192, 0, 2, 1}}};
6774
net_if_ipv4_addr_add(net_if_get_default(), &in4addr_my, NET_ADDR_MANUAL, 0);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy