Lines Matching +full:ext +full:- +full:address +full:- +full:match

1 /* main.c - Application main entry point */
6 * SPDX-License-Identifier: Apache-2.0
58 /* Below should match prefix/addr distributed in RA message. */
80 /* Target Address */
83 /* Source link layer address */
85 /* Target link layer address */
87 /* Source link layer address */
103 /* Target Address */
138 /* IPv6 hop-by-hop option in the message */
146 /* Hop-by-hop option starts here */
148 /* RPL sub-option starts here */
196 struct net_test_ipv6 *context = dev->data; in net_test_get_mac()
198 if (context->mac_addr[2] == 0x00) { in net_test_get_mac()
199 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in net_test_get_mac()
200 context->mac_addr[0] = 0x00; in net_test_get_mac()
201 context->mac_addr[1] = 0x00; in net_test_get_mac()
202 context->mac_addr[2] = 0x5E; in net_test_get_mac()
203 context->mac_addr[3] = 0x00; in net_test_get_mac()
204 context->mac_addr[4] = 0x53; in net_test_get_mac()
205 context->mac_addr[5] = sys_rand8_get(); in net_test_get_mac()
208 return context->mac_addr; in net_test_get_mac()
230 net_buf_unref(pkt->buffer); in prepare_ra_message()
231 pkt->buffer = NULL; in prepare_ra_message()
239 memcpy(&hdr.dst, net_pkt_iface(pkt)->if_dev->link_addr.addr, in prepare_ra_message()
267 memcpy(&hdr.dst, net_pkt_iface(pkt)->if_dev->link_addr.addr, in inject_na_message()
271 net_buf_reserve(pkt->frags, sizeof(struct net_eth_hdr)); in inject_na_message()
285 net_buf_push_mem(pkt->frags, &hdr, sizeof(struct net_eth_hdr)); in inject_na_message()
303 struct net_buf *bak = pkt->buffer; in get_icmp_hdr()
307 pkt->buffer = bak->frags; in get_icmp_hdr()
321 pkt->buffer = bak; in get_icmp_hdr()
333 if (!pkt->buffer) { in tester_send()
335 return -ENODATA; in tester_send()
341 if (icmp->type == NET_ICMPV6_RS) { in tester_send()
349 if (icmp->type == NET_ICMPV6_NS) { in tester_send()
351 ns_handler->fn(pkt, ns_handler->user_data); in tester_send()
421 /* dummy interface for multi-interface tests */
589 /* We cannot use net_if_ipv6_addr_add() to add the address to in ipv6_setup()
591 * we are not prepared to handle here. So instead add the address in ipv6_setup()
599 if (iface->config.ip.ipv6->unicast[i].is_used) { in ipv6_setup()
603 ifaddr = &iface->config.ip.ipv6->unicast[i]; in ipv6_setup()
605 ifaddr->is_used = true; in ipv6_setup()
606 ifaddr->address.family = AF_INET6; in ipv6_setup()
607 ifaddr->addr_type = NET_ADDR_MANUAL; in ipv6_setup()
608 ifaddr->addr_state = NET_ADDR_PREFERRED; in ipv6_setup()
610 net_ipaddr_copy(&ifaddr->address.in6_addr, &my_addr); in ipv6_setup()
627 * address. in ipv6_setup()
629 test_ra_autoconf_addr.s6_addr[15] = net_if_get_link_addr(iface)->addr[5]; in ipv6_setup()
651 ifaddr_record->is_used = false; in ipv6_teardown()
763 "Failed to read target address"); in expect_nd_ns()
765 if (net_ipv6_addr_cmp(ctx->exp_ns_addr, &target)) { in expect_nd_ns()
766 if (ctx->reply) { in expect_nd_ns()
771 k_sem_give(&ctx->wait_ns); in expect_nd_ns()
803 zassert_equal(net_ipv6_nbr_data(nbr)->state, NET_IPV6_NBR_STATE_REACHABLE, in ZTEST()
809 zassert_equal(k_sem_take(&ctx.wait_ns, K_MSEC(10)), -EAGAIN, in ZTEST()
852 zassert_equal(ifprefix->lifetime.wrap_counter, 1999, in ZTEST()
854 ifprefix->lifetime.wrap_counter); in ZTEST()
855 remaining = MSEC_PER_SEC * (uint64_t)lifetime - in ZTEST()
856 NET_TIMEOUT_MAX_VALUE * (uint64_t)ifprefix->lifetime.wrap_counter; in ZTEST()
858 zassert_equal(remaining, ifprefix->lifetime.timer_timeout, in ZTEST()
860 ifprefix->lifetime.timer_timeout); in ZTEST()
911 /* Check if autoconf address was added correctly. */ in ra_message()
914 zassert_not_null(ifaddr, "Autoconf address %s missing", in ra_message()
916 zassert_equal(ifaddr->addr_type, NET_ADDR_AUTOCONF, in ra_message()
917 "Address type should be autoconf"); in ra_message()
922 zassert_equal(route->prefix_len, 48, "Wrong prefix length set"); in ra_message()
923 zassert_mem_equal(&route->addr, &route_prefix, sizeof(route_prefix), in ra_message()
925 zassert_true(route->is_infinite, "Wrong lifetime set"); in ra_message()
926 zassert_equal(route->preference, NET_ROUTE_PREFERENCE_HIGH, in ra_message()
931 zassert_equal(ctx->state, DNS_RESOLVE_CONTEXT_ACTIVE); in ra_message()
932 dns_server = (struct sockaddr_in6 *)&ctx->servers[0].dns_server; in ra_message()
933 zassert_equal(dns_server->sin6_family, dns_addr.sin6_family); in ra_message()
934 zassert_equal(dns_server->sin6_port, dns_addr.sin6_port); in ra_message()
935 zassert_mem_equal(&dns_server->sin6_addr, &dns_addr.sin6_addr, in ra_message()
936 sizeof(dns_addr.sin6_addr), "Wrong DNS address set"); in ra_message()
937 zassert_equal(dns_server->sin6_scope_id, dns_addr.sin6_scope_id); in ra_message()
965 "Failed to read target address"); in expect_dad_ns()
967 if (net_ipv6_addr_cmp(ctx->exp_dad_addr, &target)) { in expect_dad_ns()
968 if (ctx->reply) { in expect_dad_ns()
973 k_sem_give(&ctx->wait_dad); in expect_dad_ns()
978 * prefix added and autoconf address configured.
1029 * @brief IPv6 parse Hop-By-Hop Option
1050 /* IPv6 hop-by-hop option in the message HBHO (72 Bytes) */
1058 /* Hop-by-hop option starts here */
1080 * @brief IPv6 parse Hop-By-Hop Option
1101 /* Verify IPv6 Ext hdr length */ in ZTEST()
1103 "IPv6 mismatch ext hdr length"); in ZTEST()
1106 /* IPv6 hop-by-hop option in the message HBHO (104 Bytes) */
1114 /* Hop-by-hop option starts here */
1140 * @brief IPv6 parse Hop-By-Hop Option
1161 /* Verify IPv6 Ext hdr length */ in ZTEST()
1163 "IPv6 mismatch ext hdr length"); in ZTEST()
1166 /* IPv6 hop-by-hop option in the message HBHO (920 bytes) */
1174 /* Hop-by-hop option starts here */
1303 * @brief IPv6 parse Hop-By-Hop Option
1323 /* Verify IPv6 Ext hdr length */ in ZTEST()
1325 "IPv6 mismatch ext hdr length"); in ZTEST()
1346 zassert_not_null(ifaddr, "Address with lifetime cannot be added"); in ZTEST()
1354 zassert_equal(ifaddr->lifetime.timer_timeout, timeout, in ZTEST()
1356 ifaddr->lifetime.timer_timeout, timeout); in ZTEST()
1357 zassert_equal(ifaddr->lifetime.wrap_counter, 0, in ZTEST()
1358 "Wrap counter wrong (%d)", ifaddr->lifetime.wrap_counter); in ZTEST()
1365 zassert_equal(ifaddr->lifetime.wrap_counter, 2, in ZTEST()
1366 "Wrap counter wrong (%d)", ifaddr->lifetime.wrap_counter); in ZTEST()
1367 remaining = MSEC_PER_SEC * (uint64_t)vlifetime - in ZTEST()
1368 NET_TIMEOUT_MAX_VALUE * (uint64_t)ifaddr->lifetime.wrap_counter; in ZTEST()
1370 zassert_equal(remaining, ifaddr->lifetime.timer_timeout, in ZTEST()
1372 ifaddr->lifetime.timer_timeout); in ZTEST()
1374 /* The address should not expire */ in ZTEST()
1377 zassert_equal(ifaddr->lifetime.wrap_counter, 2, in ZTEST()
1378 "Wrap counter wrong (%d)", ifaddr->lifetime.wrap_counter); in ZTEST()
1380 ifaddr->lifetime.timer_timeout = 10; in ZTEST()
1381 ifaddr->lifetime.timer_start = k_uptime_get_32() - 10; in ZTEST()
1382 ifaddr->lifetime.wrap_counter = 0; in ZTEST()
1386 /* The address should be expired now */ in ZTEST()
1387 zassert_equal(ifaddr->lifetime.timer_timeout, 0, in ZTEST()
1389 ifaddr->lifetime.timer_timeout, 0); in ZTEST()
1390 zassert_equal(ifaddr->lifetime.wrap_counter, 0, in ZTEST()
1391 "Wrap counter wrong (%d)", ifaddr->lifetime.wrap_counter); in ZTEST()
1394 zassert_true(ret, "Address with lifetime cannot be removed"); in ZTEST()
1398 * @brief IPv6 change ll address
1422 ll = net_nbr_get_lladdr(nbr->idx); in ZTEST()
1426 zassert_true(memcmp(ll->addr, ll_iface->addr, ll->len) != 0, in ZTEST()
1427 "Wrong link address 1"); in ZTEST()
1429 /* As the net_ipv6_send_na() uses interface link address to in ZTEST()
1430 * greate tllao, change the interface ll address here. in ZTEST()
1432 ll_iface->addr = new_mac; in ZTEST()
1441 ll = net_nbr_get_lladdr(nbr->idx); in ZTEST()
1443 zassert_true(memcmp(ll->addr, ll_iface->addr, ll->len) != 0, in ZTEST()
1444 "Wrong link address 2"); in ZTEST()
1446 ll_iface->addr = net_test_data.mac_addr; in ZTEST()
1465 zassert_not_null(ifaddr, "Address 1 cannot be added"); in ZTEST()
1470 zassert_not_null(ifaddr, "Address 2 cannot be added"); in ZTEST()
1475 zassert_not_null(ifaddr, "Address 3 cannot be added"); in ZTEST()
1490 /* Verify that DAD NS is sent after interface state change, for static address
1528 /* Verify that DAD NS is sent after interface state change, for link-local
1529 * address.
1569 /* Verify that in case of DAD conflict, address is not used on the interface. */
1589 zassert_not_null(ifaddr, "Address cannot be added"); in ZTEST()
1598 zassert_is_null(ifaddr, "Address should not be present on the interface"); in ZTEST()
1629 printk("Cannot write IPv6 ext header pkt %p", pkt); in setup_ipv6_udp()
1649 /* We by-pass the normal packet receiving flow in this case in order in recv_msg()
1677 "Local address packet was not dropped"); in ZTEST()
1690 "Local address packet was not dropped"); in ZTEST()
1861 * interface local scope multicast address packet will not leave the in ZTEST()
1862 * device. But we will still need to add proper multicast address to in ZTEST()
1866 zassert_not_null(maddr, "Cannot add multicast address to interface"); in ZTEST()
1938 /* add multicast address to interface but do not join the group yet */ in ZTEST()
1987 zassert_not_null(maddr, "Cannot add multicast address to interface"); in ZTEST()
1994 * Furthermore, multicast scope is link-local thus it should not cross in ZTEST()
2139 zassert_not_null(ifaddr, "Address cannot be added"); in ZTEST()
2145 zassert_equal(ifaddr->addr_state, NET_ADDR_PREFERRED, in ZTEST()
2146 "Address should've been set to preferred"); in ZTEST()
2149 zassert_true(ret, "Failed to remove address"); in ZTEST()
2163 net_ipv6_nbr_data(nbr)->state = NET_IPV6_NBR_STATE_STALE; in ZTEST()
2166 zassert_equal(net_ipv6_nbr_data(nbr)->state, NET_IPV6_NBR_STATE_REACHABLE); in ZTEST()
2169 net_ipv6_nbr_data(nbr)->state = NET_IPV6_NBR_STATE_PROBE; in ZTEST()
2173 zassert_equal(net_ipv6_nbr_data(nbr)->state, NET_IPV6_NBR_STATE_PROBE); in ZTEST()
2176 zassert_equal(net_ipv6_nbr_data(nbr)->state, NET_IPV6_NBR_STATE_REACHABLE); in ZTEST()
2183 ipv6 = iface->config.ip.ipv6; in is_pe_address_found()
2188 ARRAY_FOR_EACH(ipv6->unicast, i) { in is_pe_address_found()
2189 if (!ipv6->unicast[i].is_used || in is_pe_address_found()
2190 ipv6->unicast[i].address.family != AF_INET6 || in is_pe_address_found()
2191 !ipv6->unicast[i].is_temporary) { in is_pe_address_found()
2196 (uint8_t *)&ipv6->unicast[i].address.in6_addr, in is_pe_address_found()
2213 ipv6 = iface->config.ip.ipv6; in get_pe_addresses()
2218 ARRAY_FOR_EACH(ipv6->unicast, i) { in get_pe_addresses()
2219 if (!ipv6->unicast[i].is_used || in get_pe_addresses()
2220 ipv6->unicast[i].address.family != AF_INET6) { in get_pe_addresses()
2225 (uint8_t *)&ipv6->unicast[i].address.in6_addr, in get_pe_addresses()
2227 if (ipv6->unicast[i].is_temporary) { in get_pe_addresses()
2229 &ipv6->unicast[i].address.in6_addr; in get_pe_addresses()
2232 &ipv6->unicast[i].address.in6_addr; in get_pe_addresses()
2252 zassert_true(iface->pe_enabled, in ZTEST()
2257 zassert_true(iface->pe_prefer_public, in ZTEST()
2262 /* We received RA message earlier, make sure that temporary address in ZTEST()
2267 zassert_true(found, "Temporary address not found for iface %d", in ZTEST()
2318 zassert_true(found, "Temporary address not found for iface %p", iface); in ZTEST()
2335 zassert_false(found, "Temporary address found for iface %p", iface); in ZTEST()
2340 /* Add the temp address back for the next tests */ in ZTEST()
2352 zassert_true(found, "Temporary address not found for iface %p", iface); in ZTEST()
2370 zassert_not_null(public_addr, "No public address found"); in ZTEST()
2371 zassert_not_null(temp_addr, "No temporary address found"); in ZTEST()
2374 zassert_not_null(src_addr, "No suitable source address found"); in ZTEST()
2376 if (iface->pe_prefer_public) { in ZTEST()
2378 "Non public address selected"); in ZTEST()
2381 "Non temporary address selected"); in ZTEST()