Lines Matching +full:promiscuous +full:- +full:mode
1 /* main.c - Application main entry point */
7 * SPDX-License-Identifier: Apache-2.0
83 struct net_if_test *data = dev->data; in net_iface_get_mac()
85 if (data->mac_addr[2] == 0x00) { in net_iface_get_mac()
86 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in net_iface_get_mac()
87 data->mac_addr[0] = 0x00; in net_iface_get_mac()
88 data->mac_addr[1] = 0x00; in net_iface_get_mac()
89 data->mac_addr[2] = 0x5E; in net_iface_get_mac()
90 data->mac_addr[3] = 0x00; in net_iface_get_mac()
91 data->mac_addr[4] = 0x53; in net_iface_get_mac()
92 data->mac_addr[5] = sys_rand8_get(); in net_iface_get_mac()
95 data->ll_addr.addr = data->mac_addr; in net_iface_get_mac()
96 data->ll_addr.len = 6U; in net_iface_get_mac()
98 return data->mac_addr; in net_iface_get_mac()
112 return -EAGAIN; in dev_init()
120 if (!pkt->buffer) { in sender_iface()
122 return -ENODATA; in sender_iface()
126 struct net_if_test *data = dev->data; in sender_iface()
132 if (net_if_get_by_iface(net_pkt_iface(pkt)) != data->idx) { in sender_iface()
134 data->idx, net_if_get_by_iface(net_pkt_iface(pkt))); in sender_iface()
206 struct eth_fake_context *ctx = dev->data; in eth_fake_iface_init()
208 ctx->iface = iface; in eth_fake_iface_init()
210 net_if_set_link_addr(iface, ctx->mac_address, in eth_fake_iface_init()
211 sizeof(ctx->mac_address), in eth_fake_iface_init()
235 struct eth_fake_context *ctx = dev->data; in eth_fake_set_config()
239 if (config->promisc_mode == ctx->promisc_mode) { in eth_fake_set_config()
240 return -EALREADY; in eth_fake_set_config()
243 ctx->promisc_mode = config->promisc_mode; in eth_fake_set_config()
248 return -EINVAL; in eth_fake_set_config()
264 struct eth_fake_context *ctx = dev->data; in eth_fake_init()
266 ctx->promisc_mode = false; in eth_fake_init()
299 net_if_get_device(iface)->api; in iface_cb()
304 if (api->get_capabilities == in iface_cb()
341 net_if_get_device(iface1)->data)->idx = idx; in iface_setup()
345 net_if_get_device(iface2)->data)->idx = idx; in iface_setup()
349 net_if_get_device(iface3)->data)->idx = idx; in iface_setup()
366 dev->name, dev); in iface_setup()
370 zassert_equal(ret, -ENXIO, "Interface 1 is up (%d)", ret); in iface_setup()
376 zassert_equal(iface1->if_dev->oper_state, NET_IF_OPER_DOWN, in iface_setup()
378 iface1->if_dev->oper_state); in iface_setup()
381 dev->state->init_res = 0; in iface_setup()
387 zassert_equal(iface1->if_dev->oper_state, NET_IF_OPER_DORMANT, in iface_setup()
389 iface1->if_dev->oper_state); in iface_setup()
392 zassert_equal(iface1->if_dev->oper_state, NET_IF_OPER_UP, in iface_setup()
394 iface1->if_dev->oper_state); in iface_setup()
413 ifaddr->addr_state = NET_ADDR_PREFERRED; in iface_setup()
423 ifaddr->addr_state = NET_ADDR_PREFERRED; in iface_setup()
433 ifaddr->addr_state = NET_ADDR_PREFERRED; in iface_setup()
443 ifaddr->addr_state = NET_ADDR_PREFERRED; in iface_setup()
512 /* Carrier OFF, Dormant OFF - interface should remain down */ in ZTEST()
518 /* Carrier ON transition - interface should go up */ in ZTEST()
524 /* Carrier ON, Dormant ON - interface should remain down */ in ZTEST()
530 /* Dormant OFF transition - interface should go up */ in ZTEST()
536 /* Carrier ON, Dormant OFF - interface should go up right away */ in ZTEST()
542 /* Carrier OFF transition - interface should go down */ in ZTEST()
548 /* Carrier ON, Dormant OFF - interface should go up right away */ in ZTEST()
554 /* Dormant ON transition - interface should go down */ in ZTEST()
560 /* Carrier ON, Dormant OFF - interface should go up right away */ in ZTEST()
566 /* Admin down transition - interface should go down */ in ZTEST()
710 ifaddr->addr_state = NET_ADDR_TENTATIVE; in ZTEST()
739 DBG("Make sure promiscuous mode is OFF (%p)\n", iface4); in check_promisc_mode_off()
743 zassert_false(ret, "iface 1 promiscuous mode ON"); in check_promisc_mode_off()
750 DBG("Make sure promiscuous mode is ON (%p)\n", iface4); in check_promisc_mode_on()
754 zassert_true(ret, "iface 1 promiscuous mode OFF"); in check_promisc_mode_on()
761 DBG("Make sure promiscuous mode is ON (%p)\n", iface4); in set_promisc_mode_on_again()
765 zassert_equal(ret, -EALREADY, "iface 1 promiscuous mode OFF"); in set_promisc_mode_on_again()
772 DBG("Setting promiscuous mode ON (%p)\n", iface4); in set_promisc_mode_on()
776 zassert_equal(ret, 0, "iface 1 promiscuous mode set failed"); in set_promisc_mode_on()
781 DBG("Setting promiscuous mode OFF (%p)\n", iface4); in set_promisc_mode_off()
961 /* Add a link-local address based on the interface identifier */ in ZTEST()
965 zassert_not_null(ifaddr, "Cannot add IPv6 link-local address"); in ZTEST()
967 /* Add the corresponding solicited-node multicast address */ in ZTEST()
970 zassert_not_null(maddr, "Cannot add solicited-node multicast address"); in ZTEST()
979 /* Add the corresponding solicited-node multicast address (should exist) */ in ZTEST()
984 zassert_is_null(maddr, "Solicited-node multicast address was added twice"); in ZTEST()
990 /* The solicited-node multicast address should stay */ in ZTEST()
992 zassert_not_null(maddr, "Solicited-node multicast address was removed"); in ZTEST()
994 /* Remove the link-local address */ in ZTEST()
996 zassert_true(ret, "Cannot remove IPv6 link-local address"); in ZTEST()
998 /* The solicited-node multicast address should be gone */ in ZTEST()
1000 zassert_is_null(maddr, "Solicited-node multicast address was not removed"); in ZTEST()
1168 zassert_mem_equal(&if_addr->address.in_addr, &my_ipv4_addr1, in foreach_ipv4_addr_check()
1196 zassert_mem_equal(&if_addr->address.in_addr, &inaddr_mcast, in foreach_ipv4_maddr_check()
1225 if (net_ipv6_is_ll_addr(&if_addr->address.in6_addr)) { in foreach_ipv6_addr_check()
1226 zassert_mem_equal(&if_addr->address.in6_addr, &ll_addr, in foreach_ipv6_addr_check()
1229 zassert_mem_equal(&if_addr->address.in6_addr, &my_addr1, in foreach_ipv6_addr_check()
1258 zassert_mem_equal(&if_addr->address.in6_addr, &in6addr_mcast, sizeof(struct in6_addr), in foreach_ipv6_maddr_check()
1289 ret = net_if_get_name(NULL, NULL, -1); in ZTEST()
1290 zassert_equal(ret, -EINVAL, "Unexpected value returned"); in ZTEST()
1292 ret = net_if_get_name(iface, NULL, -1); in ZTEST()
1293 zassert_equal(ret, -EINVAL, "Unexpected value returned"); in ZTEST()
1296 zassert_equal(ret, -EINVAL, "Unexpected value returned"); in ZTEST()
1300 zassert_equal(ret, -ENAMETOOLONG, "Unexpected value (%d) returned", ret); in ZTEST()
1308 zassert_equal(ret, -EALREADY, "Unexpected value (%d) returned", ret); in ZTEST()
1317 zassert_equal(ret, -ERANGE, "Unexpected value (%d) returned", ret); in ZTEST()
1319 ret = net_if_get_name(iface, buf, strlen(name) - 1); in ZTEST()
1320 zassert_equal(ret, -ERANGE, "Unexpected value (%d) returned", ret); in ZTEST()
1322 ret = net_if_get_name(iface, buf, sizeof(buf) - 1); in ZTEST()
1330 zassert_equal(ret, -ENOENT, "Unexpected value (%d) returned", ret); in ZTEST()
1332 ret = net_if_get_name(NULL, NULL, -1); in ZTEST()
1333 zassert_equal(ret, -ENOTSUP, "Invalid value returned"); in ZTEST()
1350 mac = lladdr->addr; in generate_iid()
1353 memcpy(&expected_addr->s6_addr[8], &mac[0], 3); in generate_iid()
1354 expected_addr->s6_addr[11] = 0xff; in generate_iid()
1355 expected_addr->s6_addr[12] = 0xfe; in generate_iid()
1356 memcpy(&expected_addr->s6_addr[13], &mac[3], 3); in generate_iid()
1358 expected_addr->s6_addr[8] ^= 0x02; /* Universal bit toggle */ in generate_iid()
1387 /* Make sure that EUI-64 bytes are not there */ in ZTEST()
1392 "IID is EUI-64 instead of randomized"); in ZTEST()