Lines Matching +full:extra +full:- +full:wait +full:- +full:time

4  * SPDX-License-Identifier: Apache-2.0
20 /* 00-00-5E-00-53-xx Documentation RFC 7042 */
57 #define NO_LEASE_TIME -1
77 size_t payload_len = net_pkt_get_len(pkt) - net_pkt_ip_hdr_len(pkt) - in send_icmp_echo_reply()
84 zassert_ok(net_ipv4_create(reply, (struct in_addr *)ipv4_hdr->dst, in send_icmp_echo_reply()
85 (struct in_addr *)ipv4_hdr->src), in send_icmp_echo_reply()
107 if (ipv4_hdr->proto == IPPROTO_ICMP) { in server_send()
110 memcpy(&test_ctx.declined_ip, ipv4_hdr->dst, in server_send()
239 /* Wait for reply */ in client_send_discover()
241 zassert_ok(ret, "Exchange not completed in required time"); in client_send_discover()
253 /* Wait for reply */ in client_send_request_solicit()
255 zassert_ok(ret, "Exchange not completed in required time"); in client_send_request_solicit()
267 /* Wait for reply */ in client_send_request_renew()
269 zassert_ok(ret, "Exchange not completed in required time"); in client_send_request_renew()
281 /* Wait for reply */ in client_send_request_rebind()
283 zassert_ok(ret, "Exchange not completed in required time"); in client_send_request_rebind()
316 /* Wait for reply */ in client_send_inform()
318 zassert_ok(ret, "Exchange not completed in required time"); in client_send_inform()
326 switch (lease->state) { in lease_count_cb()
328 count->reserved++; in lease_count_cb()
332 count->allocated++; in lease_count_cb()
336 count->declined++; in lease_count_cb()
377 if (lease->state == DHCPV4_SERVER_ADDR_RESERVED) { in get_reserved_cb()
378 reserved->s_addr = lease->addr.s_addr; in get_reserved_cb()
510 zassert_mem_equal(ipv4_hdr->src, server_addr.s4_addr, in verify_offer()
513 zassert_mem_equal(ipv4_hdr->dst, net_ipv4_broadcast_address(), in verify_offer()
517 zassert_mem_equal(ipv4_hdr->dst, msg->yiaddr, in verify_offer()
521 zassert_equal(ipv4_hdr->proto, IPPROTO_UDP, "Wrong protocol"); in verify_offer()
524 zassert_equal(udp_hdr->src_port, htons(DHCPV4_SERVER_PORT), in verify_offer()
526 zassert_equal(udp_hdr->dst_port, htons(DHCPV4_CLIENT_PORT), in verify_offer()
530 zassert_equal(msg->op, DHCPV4_MSG_BOOT_REPLY, "Incorrect %s value", "op"); in verify_offer()
531 zassert_equal(msg->htype, HARDWARE_ETHERNET_TYPE, "Incorrect %s value", "htype"); in verify_offer()
532 zassert_equal(msg->hlen, sizeof(client_mac_addr), "Incorrect %s value", "hlen"); in verify_offer()
533 zassert_equal(msg->hops, 0, "Incorrect %s value", "hops"); in verify_offer()
534 zassert_equal(msg->xid, htonl(TEST_XID), "Incorrect %s value", "xid"); in verify_offer()
535 zassert_equal(msg->secs, 0, "Incorrect %s value", "secs"); in verify_offer()
536 zassert_equal(sys_get_be32(msg->ciaddr), 0, "Incorrect %s value", "ciaddr"); in verify_offer()
537 zassert_true((sys_get_be32(msg->yiaddr) >= in verify_offer()
539 (sys_get_be32(msg->yiaddr) < in verify_offer()
543 zassert_equal(sys_get_be32(msg->siaddr), 0, "Incorrect %s value", "siaddr"); in verify_offer()
545 zassert_equal(msg->flags, htons(DHCPV4_MSG_BROADCAST), in verify_offer()
548 zassert_equal(msg->flags, 0, "Incorrect %s value", "flags"); in verify_offer()
550 zassert_equal(sys_get_be32(msg->giaddr), 0, "Incorrect %s value", "giaddr"); in verify_offer()
551 zassert_mem_equal(msg->chaddr, client_mac_addr, sizeof(client_mac_addr), in verify_offer()
554 memcpy(&test_ctx.assigned_ip, msg->yiaddr, sizeof(struct in_addr)); in verify_offer()
584 zassert_equal(lease->state, DHCPV4_SERVER_ADDR_RESERVED, in reserved_address_cb()
586 zassert_equal(reserved->s_addr, lease->addr.s_addr, in reserved_address_cb()
684 zassert_mem_equal(ipv4_hdr->src, server_addr.s4_addr, in verify_ack()
687 zassert_mem_equal(ipv4_hdr->dst, msg->ciaddr, sizeof(struct in_addr), in verify_ack()
690 zassert_mem_equal(ipv4_hdr->dst, msg->yiaddr, sizeof(struct in_addr), in verify_ack()
694 zassert_equal(ipv4_hdr->proto, IPPROTO_UDP, "Wrong protocol"); in verify_ack()
697 zassert_equal(udp_hdr->src_port, htons(DHCPV4_SERVER_PORT), in verify_ack()
699 zassert_equal(udp_hdr->dst_port, htons(DHCPV4_CLIENT_PORT), in verify_ack()
703 zassert_equal(msg->op, DHCPV4_MSG_BOOT_REPLY, "Incorrect %s value", "op"); in verify_ack()
704 zassert_equal(msg->htype, HARDWARE_ETHERNET_TYPE, "Incorrect %s value", "htype"); in verify_ack()
705 zassert_equal(msg->hlen, sizeof(client_mac_addr), "Incorrect %s value", "hlen"); in verify_ack()
706 zassert_equal(msg->hops, 0, "Incorrect %s value", "hops"); in verify_ack()
707 zassert_equal(msg->xid, htonl(TEST_XID), "Incorrect %s value", "xid"); in verify_ack()
708 zassert_equal(msg->secs, 0, "Incorrect %s value", "secs"); in verify_ack()
711 zassert_mem_equal(msg->ciaddr, client_addr_static.s4_addr, in verify_ack()
715 zassert_mem_equal(msg->ciaddr, test_ctx.assigned_ip.s4_addr, in verify_ack()
719 zassert_equal(sys_get_be32(msg->ciaddr), 0, "Incorrect %s value", "ciaddr"); in verify_ack()
723 zassert_equal(sys_get_be32(msg->yiaddr), 0, "Incorrect %s value", "yiaddr"); in verify_ack()
725 zassert_mem_equal(msg->yiaddr, test_ctx.assigned_ip.s4_addr, in verify_ack()
729 zassert_equal(sys_get_be32(msg->siaddr), 0, "Incorrect %s value", "siaddr"); in verify_ack()
730 zassert_equal(msg->flags, 0, "Incorrect %s value", "flags"); in verify_ack()
731 zassert_equal(sys_get_be32(msg->giaddr), 0, "Incorrect %s value", "giaddr"); in verify_ack()
732 zassert_mem_equal(msg->chaddr, client_mac_addr, sizeof(client_mac_addr), in verify_ack()
736 memcpy(&test_ctx.assigned_ip, msg->yiaddr, sizeof(struct in_addr)); in verify_ack()
776 zassert_equal(lease->state, DHCPV4_SERVER_ADDR_ALLOCATED, in allocated_address_cb()
778 zassert_equal(allocated->s_addr, lease->addr.s_addr, in allocated_address_cb()
839 /* Add extra 10ms to avoid race. */ in ZTEST()
861 zassert_equal(lease->state, DHCPV4_SERVER_ADDR_DECLINED, in declined_address_cb()
863 zassert_equal(declined->s_addr, lease->addr.s_addr, in declined_address_cb()
878 * message, and gets released after configured time.
889 /* Add extra 10ms to avoid race. */ in ZTEST()
940 if (lease->state == DHCPV4_SERVER_ADDR_DECLINED) { in after_probe_address_cb()
941 zassert_equal(test_ctx.declined_ip.s_addr, lease->addr.s_addr, in after_probe_address_cb()
945 if (lease->state == DHCPV4_SERVER_ADDR_RESERVED) { in after_probe_address_cb()
946 zassert_equal(test_ctx.assigned_ip.s_addr, lease->addr.s_addr, in after_probe_address_cb()
991 zassert_equal(ret, -EINVAL, "Started server for wrong subnet"); in ZTEST()
994 zassert_equal(ret, -EINVAL, "Started server for overlapping address"); in ZTEST()