Lines Matching +full:random +full:- +full:mac +full:- +full:address
1 /* main.c - Application main entry point */
6 * SPDX-License-Identifier: Apache-2.0
19 #include <zephyr/random/random.h>
44 /* Extra address is assigned to ll_addr */
76 struct net_if_test *data = dev->data; in net_iface_get_mac()
78 if (data->mac_addr[2] == 0x00) { in net_iface_get_mac()
79 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in net_iface_get_mac()
80 data->mac_addr[0] = 0x00; in net_iface_get_mac()
81 data->mac_addr[1] = 0x00; in net_iface_get_mac()
82 data->mac_addr[2] = 0x5E; in net_iface_get_mac()
83 data->mac_addr[3] = 0x00; in net_iface_get_mac()
84 data->mac_addr[4] = 0x53; in net_iface_get_mac()
85 data->mac_addr[5] = sys_rand8_get(); in net_iface_get_mac()
88 data->ll_addr.addr = data->mac_addr; in net_iface_get_mac()
89 data->ll_addr.len = 6U; in net_iface_get_mac()
91 return data->mac_addr; in net_iface_get_mac()
96 uint8_t *mac = net_iface_get_mac(net_if_get_device(iface)); in net_iface_init() local
98 net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr), in net_iface_init()
108 const struct net_event_l4_hostname *info = cb->info; in hostname_changed()
110 if (strncmp(net_hostname_get(), info->hostname, sizeof(info->hostname))) { in hostname_changed()
111 /** Invalid value - do not give the semaphore **/ in hostname_changed()
122 if (!pkt->buffer) { in sender_iface()
124 return -ENODATA; in sender_iface()
166 struct eth_fake_context *ctx = dev->data; in eth_fake_iface_init()
168 ctx->iface = iface; in eth_fake_iface_init()
170 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in eth_fake_iface_init()
171 ctx->mac_address[0] = 0x00; in eth_fake_iface_init()
172 ctx->mac_address[1] = 0x00; in eth_fake_iface_init()
173 ctx->mac_address[2] = 0x5E; in eth_fake_iface_init()
174 ctx->mac_address[3] = 0x00; in eth_fake_iface_init()
175 ctx->mac_address[4] = 0x53; in eth_fake_iface_init()
176 ctx->mac_address[5] = sys_rand8_get(); in eth_fake_iface_init()
178 net_if_set_link_addr(iface, ctx->mac_address, in eth_fake_iface_init()
179 sizeof(ctx->mac_address), in eth_fake_iface_init()
201 struct eth_fake_context *ctx = dev->data; in eth_fake_init()
203 ctx->promisc_mode = false; in eth_fake_init()
254 net_if_get_device(iface1)->data)->idx = idx; in test_iface_setup()
264 DBG("Cannot add IPv6 address %s\n", in test_iface_setup()
272 DBG("Cannot add IPv4 address %s\n", in test_iface_setup()
278 ifaddr->addr_state = NET_ADDR_PREFERRED; in test_iface_setup()
283 DBG("Cannot add IPv6 address %s\n", in test_iface_setup()
288 ifaddr->addr_state = NET_ADDR_PREFERRED; in test_iface_setup()
294 DBG("Cannot add multicast IPv6 address %s\n", in test_iface_setup()
313 return -ENOMEM; in bytes_from_hostname_unique()
320 buf[i/2] += (src[i] - '0'); in bytes_from_hostname_unique()
325 buf[i/2] += (10 + (src[i] - 'A')); in bytes_from_hostname_unique()
330 buf[i/2] += (10 + (src[i] - 'a')); in bytes_from_hostname_unique()
334 return -EINVAL; in bytes_from_hostname_unique()
361 sizeof(CONFIG_NET_HOSTNAME) - 1, ""); in ZTEST()
364 char mac[6]; in ZTEST() local
367 ret = bytes_from_hostname_unique(mac, sizeof(mac), in ZTEST()
368 hostname + sizeof(CONFIG_NET_HOSTNAME) - 1); in ZTEST()
370 zassert_mem_equal(mac, net_if_get_link_addr(iface1)->addr, in ZTEST()
371 net_if_get_link_addr(iface1)->len, ""); in ZTEST()
380 ret = net_hostname_set_postfix("foobar", sizeof("foobar") - 1); in ZTEST()
381 zassert_equal(ret, -EALREADY, in ZTEST()
388 ret = net_hostname_set("foobar", sizeof("foobar") - 1); in ZTEST()
390 zassert_mem_equal("foobar", net_hostname_get(), sizeof("foobar")-1); in ZTEST()