Lines Matching +full:dummy +full:- +full:bytes +full:- +full:count
1 /* main.c - Application main entry point */
6 * SPDX-License-Identifier: Apache-2.0
27 #include <zephyr/net/dummy.h>
109 struct net_test_mld *context = dev->data; in net_test_get_mac()
111 if (context->mac_addr[2] == 0x00) { in net_test_get_mac()
112 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in net_test_get_mac()
113 context->mac_addr[0] = 0x00; in net_test_get_mac()
114 context->mac_addr[1] = 0x00; in net_test_get_mac()
115 context->mac_addr[2] = 0x5E; in net_test_get_mac()
116 context->mac_addr[3] = 0x00; in net_test_get_mac()
117 context->mac_addr[4] = 0x53; in net_test_get_mac()
118 context->mac_addr[5] = sys_rand8_get(); in net_test_get_mac()
121 return context->mac_addr; in net_test_get_mac()
146 if (!pkt->buffer) { in tester_send()
148 return -ENODATA; in tester_send()
153 if (icmp->type == NET_ICMPV6_MLDv2) { in tester_send()
162 report_handler->fn(pkt, report_handler->user_data); in tester_send()
189 struct net_test_mld *context = iface->if_dev->dev->data; in init_null_iface()
191 memset(&context->mac_addr, 0, sizeof(context->mac_addr)); in init_null_iface()
193 net_if_set_link_addr(iface, context->mac_addr, sizeof(struct net_eth_addr), in init_null_iface()
249 net_ipv6_addr_cmp(exp_mcast_group, cb->info)) { in group_joined()
265 net_ipv6_addr_cmp(exp_mcast_group, cb->info)) { in group_left()
301 net_iface = net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)); in test_mld_setup()
331 zassert_true(ret == 0 || ret == -EALREADY, in test_join_group()
432 /* Sent to all MLDv2-capable routers */ in send_query()
444 /* Add hop-by-hop option and router alert option, RFC 3810 ch 5. */ in send_query()
447 ret = net_pkt_write_u8(pkt, 0); /* length (0 means 8 bytes) */ in send_query()
495 /* interface needs to join the MLDv2-capable routers multicast group before it
503 iface = net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)); in join_mldv2_capable_routers_group()
508 zassert_true(ret == 0 || ret == -EALREADY, in join_mldv2_capable_routers_group()
509 "Cannot join MLDv2-capable routers multicast group"); in join_mldv2_capable_routers_group()
520 iface = net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)); in leave_mldv2_capable_routers_group()
526 "Cannot leave MLDv2-capable routers multicast group"); in leave_mldv2_capable_routers_group()
565 send_query(net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY))); in test_catch_query()
607 send_query(net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY))); in test_verify_send_report()
653 zassert_ok(net_pkt_read_be16(pkt, &res_bytes), "Failed to read reserved bytes"); in expect_exclude_mcast_report()
654 zassert_equal(0, res_bytes, "Reserved bytes must be zeroed"); in expect_exclude_mcast_report()
656 zassert_ok(net_pkt_read_be16(pkt, &records_count), "Failed to read addr count"); in expect_exclude_mcast_report()
657 zexpect_equal(records_count, 1, "Incorrect record count "); in expect_exclude_mcast_report()
839 zassert_ok(net_pkt_read_be16(pkt, &res_bytes), "Failed to read reserved bytes"); in handle_mld_report()
840 zassert_equal(0, res_bytes, "Reserved bytes must be zeroed"); in handle_mld_report()
842 zassert_ok(net_pkt_read_be16(pkt, &info->records_count), "Failed to read addr count"); in handle_mld_report()
843 zexpect_between_inclusive(info->records_count, 0, MLD_REPORT_ADDR_COUNT, in handle_mld_report()
846 for (size_t i = 0; i < info->records_count; ++i) { in handle_mld_report()
847 net_pkt_read(pkt, &info->records[i], sizeof(struct mld_report_mcast_record)); in handle_mld_report()
855 ARRAY_FOR_EACH_PTR(iface->config.ip.ipv6->mcast, mcast_addr) { in get_mcast_addr_count()
856 if (mcast_addr->is_used) { in get_mcast_addr_count()
875 zassert_equal(info->records_count, 1, "Invalid number of reported addresses"); in add_mcast_route_and_verify()
876 zassert_equal(info->records[0].record_type, NET_IPV6_MLDv2_CHANGE_TO_EXCLUDE_MODE, in add_mcast_route_and_verify()
878 zassert_mem_equal(&info->records[0].mcast_addr, addr, in add_mcast_route_and_verify()
898 zassert_equal(info->records_count, 1, "Invalid number of reported addresses"); in del_mcast_route_and_verify()
899 zassert_equal(info->records[0].record_type, NET_IPV6_MLDv2_CHANGE_TO_INCLUDE_MODE, in del_mcast_route_and_verify()
901 zassert_mem_equal(&info->records[0].mcast_addr, addr, in del_mcast_route_and_verify()
913 zassert_not_null(dummy_iface, "Invalid dummy iface"); in verify_mcast_routes_in_mld()
943 zassert_equal(-EAGAIN, k_sem_take(&wait_data, K_MSEC(WAIT_TIME)), "Expected a timeout"); in verify_mcast_routes_in_mld()
957 zassert_equal(info->records_count, get_mcast_addr_count(dummy_iface) + 2, in verify_mcast_routes_in_mld()
976 zassert_equal(-EAGAIN, k_sem_take(&wait_data, K_MSEC(WAIT_TIME)), "Expected a timeout"); in verify_mcast_routes_in_mld()
986 struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)); in ZTEST()
1035 zassert_true(fd >= 0, "Cannot get socket (%d)", -errno); in socket_group_with_index()
1039 zassert_true(ret == -1 && errno == EINVAL, in socket_group_with_index()
1040 "Incorrect return value (%d)", -errno); in socket_group_with_index()
1044 zassert_true(ret == -1 && errno == EINVAL, in socket_group_with_index()
1045 "Incorrect return value (%d)", -errno); in socket_group_with_index()
1050 zassert_true(ret == -1 && errno == EINVAL, in socket_group_with_index()
1051 "Incorrect return value (%d)", -errno); in socket_group_with_index()
1062 zassert_true(ret == 0 || ret == -EALREADY, in socket_group_with_index()
1064 -errno); in socket_group_with_index()
1068 -errno); in socket_group_with_index()
1072 -errno); in socket_group_with_index()