Skip to content

Commit 8a4fa57

Browse files
committed
tests: net: hostname: Set MAC address properly to all interfaces
The test creates two network interfaces, but does not set MAC address of one of them correctly (MAC address is all zeros). This is not good and the issue fixed in commit 9468cb6 could have been revealed earlier. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent d0abd9a commit 8a4fa57

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/net/hostname/src/main.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
2929
#define NET_LOG_ENABLED 1
3030
#include "net_private.h"
3131

32-
#if defined(CONFIG_NET_IF_LOG_LEVEL_DBG)
32+
#if defined(CONFIG_NET_HOSTNAME_LOG_LEVEL_DBG)
3333
#define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__)
3434
#else
3535
#define DBG(fmt, ...)
@@ -143,6 +143,14 @@ static void eth_fake_iface_init(struct net_if *iface)
143143

144144
ctx->iface = iface;
145145

146+
/* 00-00-5E-00-53-xx Documentation RFC 7042 */
147+
ctx->mac_address[0] = 0x00;
148+
ctx->mac_address[1] = 0x00;
149+
ctx->mac_address[2] = 0x5E;
150+
ctx->mac_address[3] = 0x00;
151+
ctx->mac_address[4] = 0x53;
152+
ctx->mac_address[5] = sys_rand32_get();
153+
146154
net_if_set_link_addr(iface, ctx->mac_address,
147155
sizeof(ctx->mac_address),
148156
NET_LINK_ETHERNET);

0 commit comments

Comments
 (0)