Skip to content

Commit da83750

Browse files
committed
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>
1 parent f8341ab commit da83750

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

netutils/netlib/netlib_obtainipv4addr.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,19 @@ static int dhcp_obtain_statefuladdr(FAR const char *ifname)
112112
{
113113
struct dhcpc_state ds;
114114
FAR void *handle;
115+
int ret;
115116
uint8_t mac[IFHWADDRLEN];
116117

117-
int ret = netlib_getmacaddr(ifname, mac);
118+
#ifdef CONFIG_NET_ETHERNET
119+
ret = netlib_getmacaddr(ifname, mac);
118120
if (ret < 0)
119121
{
120122
nerr("ERROR: get MAC address failed for '%s' : %d\n", ifname, ret);
121123
return ret;
122124
}
125+
#else
126+
bzero(mac, sizeof(mac));
127+
#endif
123128

124129
/* Set up the DHCPC modules */
125130

0 commit comments

Comments
 (0)