netutils: fix compile error when not defined CONFIG_NET_ETHERNET

/home/ligd/platform/dev/apps/netutils/netlib/netlib_obtainipv4addr.c:117: undefined reference to `netlib_getmacaddr'

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2024-10-21 22:30:33 +08:00 committed by GUIDINGLI
parent f8341ab94d
commit da83750cd3

View file

@ -112,14 +112,19 @@ static int dhcp_obtain_statefuladdr(FAR const char *ifname)
{
struct dhcpc_state ds;
FAR void *handle;
int ret;
uint8_t mac[IFHWADDRLEN];
int ret = netlib_getmacaddr(ifname, mac);
#ifdef CONFIG_NET_ETHERNET
ret = netlib_getmacaddr(ifname, mac);
if (ret < 0)
{
nerr("ERROR: get MAC address failed for '%s' : %d\n", ifname, ret);
return ret;
}
#else
bzero(mac, sizeof(mac));
#endif
/* Set up the DHCPC modules */