blob: 1dd57909eb55949e32991d180850700c00ae76c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <zephyr/logging/log.h>
#include <zephyr/net/net_if.h>
LOG_MODULE_REGISTER(main);
int main(void)
{
LOG_INF("Function main was started.");
struct net_if *iface = net_if_get_default();
if (iface == NULL) {
LOG_ERR("Could not find default network interface.");
goto FINISH;
}
LOG_DBG("Got default network interface pointer 0x%p", (void *)iface);
struct net_linkaddr *link_addr = net_if_get_link_addr(iface);
if (iface == NULL) {
LOG_ERR("Could not determine link address of default network interface.");
goto FINISH;
}
LOG_INF(
"Got link address of default network interface: %02x:%02x:%02x:%02x:%02x:%02x.",
link_addr->addr[0],
link_addr->addr[1],
link_addr->addr[2],
link_addr->addr[3],
link_addr->addr[4],
link_addr->addr[5]
);
FINISH:
LOG_INF("Function main was finished.");
return 0;
}
|