Skip to content

Commit f11c7c2

Browse files
authored
Merge pull request #93 from danielinux/fixes_20260331
Fixes 20260331
2 parents bbdf83b + d9a1437 commit f11c7c2

12 files changed

Lines changed: 1352 additions & 56 deletions

.github/workflows/stm32h563-m33mu-freertos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
stm32h563_m33mu_echo_freertos:
1010
runs-on: ubuntu-latest
1111
container:
12-
image: ghcr.io/danielinux/m33mu-ci:1.8
12+
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
1313
options: --privileged
1414
steps:
1515
- name: Checkout

.github/workflows/stm32h563-m33mu-ssh-tzen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 25
1313
container:
14-
image: ghcr.io/danielinux/m33mu-ci:1.8
14+
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
1515
options: --privileged
1616

1717
steps:

.github/workflows/stm32h563-m33mu.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 20
1313
container:
14-
image: ghcr.io/danielinux/m33mu-ci:1.8
14+
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
1515
options: --privileged
1616

1717
steps:
@@ -114,7 +114,7 @@ jobs:
114114
runs-on: ubuntu-latest
115115
timeout-minutes: 30
116116
container:
117-
image: ghcr.io/danielinux/m33mu-ci:1.8
117+
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
118118
options: --privileged
119119

120120
steps:
@@ -323,7 +323,7 @@ jobs:
323323
runs-on: ubuntu-latest
324324
timeout-minutes: 25
325325
container:
326-
image: ghcr.io/danielinux/m33mu-ci:1.8
326+
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
327327
options: --privileged
328328

329329
steps:

src/test/unit/unit.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ Suite *wolf_suite(void)
123123
tcase_add_test(tc_utils, test_wolfip_send_port_unreachable_non_ethernet_skips_eth_filter);
124124
tcase_add_test(tc_utils, test_tcp_adv_win_clamps_and_applies_window_scale);
125125
tcase_add_test(tc_utils, test_tcp_segment_acceptable_zero_window_and_overlap_cases);
126+
tcase_add_test(tc_utils, test_tcp_segment_acceptable_counts_syn_in_segment_length);
126127
tcase_add_test(tc_utils, test_wolfip_ipconfig_ex_per_interface);
127128
tcase_add_test(tc_utils, test_wolfip_poll_executes_timers_and_callbacks);
128129
tcase_add_test(tc_utils, test_wolfip_poll_drains_all_expired_timers_in_one_pass);
@@ -252,6 +253,7 @@ Suite *wolf_suite(void)
252253
tcase_add_test(tc_utils, test_sock_connect_tcp_filter_drop);
253254
tcase_add_test(tc_utils, test_sock_connect_tcp_src_port_low);
254255
tcase_add_test(tc_utils, test_sock_connect_tcp_initial_seq_randomized);
256+
tcase_add_test(tc_utils, test_sock_connect_tcp_txbuf_full_does_not_enter_syn_sent);
255257
tcase_add_test(tc_utils, test_sock_sendto_more_error_paths);
256258
tcase_add_test(tc_utils, test_sock_sendto_udp_no_dest);
257259
tcase_add_test(tc_utils, test_sock_sendto_udp_sets_dest_and_assigns);
@@ -285,6 +287,7 @@ Suite *wolf_suite(void)
285287
tcase_add_test(tc_utils, test_sock_recvfrom_udp_payload_too_long);
286288
tcase_add_test(tc_utils, test_sock_recvfrom_icmp_payload_too_long);
287289
tcase_add_test(tc_utils, test_sock_accept_success);
290+
tcase_add_test(tc_utils, test_sock_accept_synack_rto_txbuf_full_does_not_consume_retry);
288291
tcase_add_test(tc_utils, test_sock_accept_ack_with_payload_completes_handshake);
289292
tcase_add_test(tc_utils, test_sock_accept_ack_at_snd_nxt_completes_handshake);
290293
tcase_add_test(tc_utils, test_sock_accept_ack_psh_with_payload_completes_handshake);
@@ -296,6 +299,7 @@ Suite *wolf_suite(void)
296299
tcase_add_test(tc_utils, test_poll_tcp_zero_window_arms_persist);
297300
tcase_add_test(tc_utils, test_tcp_persist_start_stops_when_window_reopens_or_no_unsent_payload);
298301
tcase_add_test(tc_utils, test_tcp_persist_helpers_ignore_non_tcp_and_null_inputs);
302+
tcase_add_test(tc_utils, test_tcp_has_pending_unsent_payload_ignores_zero_ip_len_ack_only_desc);
299303
tcase_add_test(tc_utils, test_tcp_initial_cwnd_caps_to_iw10_and_half_rwnd);
300304
tcase_add_test(tc_utils, test_tcp_persist_cb_sends_one_byte_probe);
301305
tcase_add_test(tc_utils, test_tcp_zero_wnd_probe_rejects_invalid_inputs_and_empty_payload);
@@ -315,8 +319,10 @@ Suite *wolf_suite(void)
315319
tcase_add_test(tc_utils, test_poll_icmp_send_on_arp_hit);
316320
tcase_add_test(tc_utils, test_poll_icmp_send_on_arp_miss_requests_arp_and_retains_queue);
317321
tcase_add_test(tc_utils, test_dhcp_timer_cb_paths);
322+
tcase_add_test(tc_utils, test_regression_dhcp_lease_expiry_deconfigures_address);
318323
tcase_add_test(tc_utils, test_dhcp_timer_cb_send_failure_does_not_consume_retry_budget);
319324
tcase_add_test(tc_utils, test_dhcp_client_init_and_bound);
325+
tcase_add_test(tc_utils, test_dhcp_client_init_bind_failure_closes_socket);
320326
tcase_add_test(tc_utils, test_dhcp_send_request_renewing_sets_ciaddr_and_rebind_deadline);
321327
tcase_add_test(tc_utils, test_dhcp_send_request_rebinding_broadcasts_to_lease_expiry);
322328
tcase_add_test(tc_utils, test_dhcp_send_request_send_failure_retries_next_tick);
@@ -325,6 +331,7 @@ Suite *wolf_suite(void)
325331
tcase_add_test(tc_utils, test_dhcp_poll_offer_and_ack);
326332
tcase_add_test(tc_utils, test_dhcp_poll_renewing_ack_binds_client);
327333
tcase_add_test(tc_utils, test_dhcp_poll_rebinding_ack_binds_client);
334+
tcase_add_test(tc_utils, test_regression_dhcp_nak_deconfigures_address_during_renew_and_rebind);
328335
tcase_add_test(tc_utils, test_dns_callback_ptr_response);
329336
tcase_add_test(tc_utils, test_udp_try_recv_short_frame);
330337
tcase_add_test(tc_utils, test_udp_try_recv_filter_drop);
@@ -335,11 +342,14 @@ Suite *wolf_suite(void)
335342
tcase_add_test(tc_utils, test_udp_try_recv_remote_ip_matches_local_ip);
336343
tcase_add_test(tc_utils, test_udp_try_recv_unmatched_port_sends_icmp_unreachable);
337344
tcase_add_test(tc_utils, test_udp_try_recv_unmatched_nonlocal_dst_does_not_send_icmp);
345+
tcase_add_test(tc_utils, test_udp_try_recv_full_fifo_drop_does_not_set_readable_or_send_icmp);
338346
tcase_add_test(tc_utils, test_dns_callback_bad_flags);
339347
tcase_add_test(tc_utils, test_dns_callback_truncated_response_aborts_query);
340348
tcase_add_test(tc_utils, test_dns_callback_bad_name);
341349
tcase_add_test(tc_utils, test_dns_callback_short_header_ignored);
342350
tcase_add_test(tc_utils, test_dns_callback_wrong_id_ignored);
351+
tcase_add_test(tc_utils, test_dns_callback_non_in_a_answer_ignored);
352+
tcase_add_test(tc_utils, test_dns_callback_non_in_ptr_answer_ignored);
343353
tcase_add_test(tc_utils, test_dns_callback_malformed_compressed_name_aborts_query);
344354
tcase_add_test(tc_utils, test_dns_callback_abort_clears_query_state);
345355
tcase_add_test(tc_utils, test_dns_abort_query_null_noop);
@@ -410,14 +420,17 @@ Suite *wolf_suite(void)
410420
tcase_add_test(tc_utils, test_tcp_rto_cb_resets_flags_and_arms_timer);
411421
tcase_add_test(tc_utils, test_tcp_rto_cb_no_pending_resets_backoff);
412422
tcase_add_test(tc_utils, test_tcp_rto_cb_skips_unsent_desc);
423+
tcase_add_test(tc_utils, test_tcp_rto_cb_does_not_signal_writable_for_zero_ip_len_ack_only_desc);
413424
tcase_add_test(tc_utils, test_tcp_rto_cb_non_tcp_noop);
414425
tcase_add_test(tc_utils, test_tcp_rto_cb_non_established_noop);
415426
tcase_add_test(tc_utils, test_tcp_rto_cb_syn_sent_requeues_syn_and_arms_timer);
416427
tcase_add_test(tc_utils, test_tcp_input_synack_cancels_control_rto);
417428
tcase_add_test(tc_utils, test_tcp_rto_cb_last_ack_requeues_finack_and_arms_timer);
429+
tcase_add_test(tc_utils, test_tcp_rto_cb_last_ack_full_txbuf_keeps_retry_budget);
418430
tcase_add_test(tc_utils, test_tcp_ctrl_state_needs_rto_fin_wait_1_waits_for_payload_drain);
419431
tcase_add_test(tc_utils, test_tcp_rto_cb_fin_wait_1_with_data_uses_data_recovery);
420432
tcase_add_test(tc_utils, test_tcp_rto_cb_fin_wait_1_no_data_requeues_finack);
433+
tcase_add_test(tc_utils, test_tcp_rto_cb_fin_wait_1_no_data_full_txbuf_keeps_retry_budget);
421434
tcase_add_test(tc_utils, test_tcp_ack_fin_wait_1_ack_of_fin_moves_to_fin_wait_2_and_arms_timeout);
422435
tcase_add_test(tc_utils, test_tcp_ack_closing_ack_of_fin_moves_to_time_wait_and_stops_timer);
423436
tcase_add_test(tc_utils, test_tcp_rto_cb_control_retry_cap_closes_socket);
@@ -429,6 +442,8 @@ Suite *wolf_suite(void)
429442
tcase_add_test(tc_utils, test_sock_close_udp_icmp);
430443
tcase_add_test(tc_utils, test_sock_close_invalid_fds);
431444
tcase_add_test(tc_utils, test_sock_close_tcp_fin_wait_1);
445+
tcase_add_test(tc_utils, test_sock_close_tcp_established_full_txbuf_preserves_state);
446+
tcase_add_test(tc_utils, test_sock_close_tcp_close_wait_full_txbuf_preserves_state);
432447
tcase_add_test(tc_utils, test_sock_close_tcp_other_state_closes);
433448
tcase_add_test(tc_utils, test_sock_close_tcp_cancels_rto_timer);
434449
tcase_add_test(tc_utils, test_sock_close_tcp_closed_returns_minus_one);
@@ -458,6 +473,8 @@ Suite *wolf_suite(void)
458473
tcase_add_test(tc_utils, test_tcp_input_syn_rcvd_ack_invalid_seq_rejected);
459474
tcase_add_test(tc_utils, test_tcp_input_filter_drop);
460475
tcase_add_test(tc_utils, test_tcp_input_port_mismatch_skips_socket);
476+
tcase_add_test(tc_utils, test_tcp_input_remote_ip_mismatch_skips_socket);
477+
tcase_add_test(tc_utils, test_tcp_input_local_ip_mismatch_preserves_if_idx);
461478
tcase_add_test(tc_utils, test_tcp_input_unmatched_ack_sends_rst);
462479
tcase_add_test(tc_utils, test_tcp_input_unmatched_ack_nonlocal_dst_does_not_send_rst);
463480
tcase_add_test(tc_utils, test_tcp_input_unmatched_syn_sends_rst_ack);
@@ -553,6 +570,7 @@ Suite *wolf_suite(void)
553570
tcase_add_test(tc_utils, test_tcp_mark_unsacked_for_retransmit_wrap_seg_end);
554571
tcase_add_test(tc_utils, test_tcp_mark_unsacked_retransmits_partially_acked_segment);
555572
tcase_add_test(tc_utils, test_tcp_mark_unsacked_rescans_after_clearing_stale_sack);
573+
tcase_add_test(tc_utils, test_tcp_mark_unsacked_ignores_zero_ip_len_unsent_ack_only_desc);
556574
tcase_add_test(tc_utils, test_tcp_ack_sack_blocks_clamped_and_dropped);
557575
tcase_add_test(tc_utils, test_tcp_recv_ooo_capacity_limit);
558576
tcase_add_test(tc_utils, test_tcp_recv_overlapping_ooo_segments_coalesce_on_consume);
@@ -580,6 +598,7 @@ Suite *wolf_suite(void)
580598
tcase_add_test(tc_utils, test_tcp_input_header_len_below_min_dropped);
581599
tcase_add_test(tc_utils, test_socket_from_fd_invalid);
582600
tcase_add_test(tc_utils, test_socket_from_fd_valid);
601+
tcase_add_test(tc_utils, test_sock_close_tcp_fin_wait_1_repeated_close_keeps_fin_wait_2_path);
583602

584603
tcase_add_test(tc_proto, test_arp_request_basic);
585604
tcase_add_test(tc_proto, test_arp_request_throttle);
@@ -649,6 +668,7 @@ Suite *wolf_suite(void)
649668
tcase_add_test(tc_proto, test_icmp_try_recv_mismatch_local_ip);
650669
tcase_add_test(tc_proto, test_icmp_try_recv_mismatch_src_port);
651670
tcase_add_test(tc_proto, test_icmp_try_recv_mismatch_remote_ip);
671+
tcase_add_test(tc_proto, test_icmp_try_recv_full_fifo_does_not_signal_readable);
652672
tcase_add_test(tc_proto, test_wolfip_recv_on_not_for_us);
653673
tcase_add_test(tc_proto, test_wolfip_recv_on_filter_drop_eth);
654674
#if WOLFIP_ENABLE_FORWARDING
@@ -728,6 +748,9 @@ Suite *wolf_suite(void)
728748
tcase_add_test(tc_proto, test_regression_tcp_ip_len_below_ip_header);
729749
tcase_add_test(tc_proto, test_regression_syn_on_established_not_silently_processed);
730750
tcase_add_test(tc_proto, test_regression_syn_on_last_ack_not_silently_processed);
751+
tcase_add_test(tc_proto, test_regression_full_txbuf_still_sends_pure_ack);
752+
tcase_add_test(tc_proto, test_regression_loopback_immediate_pure_ack_uses_loopback_ll);
753+
tcase_add_test(tc_proto, test_regression_tcp_tx_desc_payload_len_keeps_descriptor_layout_sanity);
731754
tcase_add_test(tc_proto, test_regression_fast_recovery_cwnd_ssthresh_rfc5681);
732755
tcase_add_test(tc_proto, test_regression_paws_rejects_stale_timestamp);
733756
tcase_add_test(tc_proto, test_regression_paws_accepts_wrapped_newer_timestamp);
@@ -737,6 +760,8 @@ Suite *wolf_suite(void)
737760
tcase_add_test(tc_proto, test_regression_udp_checksum_zero_substituted_with_ffff);
738761
tcase_add_test(tc_proto, test_regression_last_ack_rejects_out_of_window_segment);
739762
tcase_add_test(tc_proto, test_regression_dns_id_never_zero);
763+
tcase_add_test(tc_proto, test_tcp_input_listen_synack_sends_rst_and_stays_listen);
764+
tcase_add_test(tc_proto, test_tcp_input_listen_accept_final_ack_does_not_send_rst);
740765

741766
tcase_add_test(tc_utils, test_transport_checksum);
742767
tcase_add_test(tc_utils, test_iphdr_set_checksum);

src/test/unit/unit_tests_api.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,38 @@ START_TEST(test_sock_connect_tcp_local_ip_from_primary)
19371937
}
19381938
END_TEST
19391939

1940+
START_TEST(test_sock_connect_tcp_txbuf_full_does_not_enter_syn_sent)
1941+
{
1942+
struct wolfIP s;
1943+
int tcp_sd;
1944+
struct tsocket *ts;
1945+
struct wolfIP_sockaddr_in sin;
1946+
uint8_t tiny_txbuf[32];
1947+
1948+
wolfIP_init(&s);
1949+
mock_link_init(&s);
1950+
wolfIP_ipconfig_set(&s, 0x0A000001U, 0xFFFFFF00U, 0);
1951+
1952+
tcp_sd = wolfIP_sock_socket(&s, AF_INET, IPSTACK_SOCK_STREAM, WI_IPPROTO_TCP);
1953+
ck_assert_int_gt(tcp_sd, 0);
1954+
ts = &s.tcpsockets[SOCKET_UNMARK(tcp_sd)];
1955+
ts->sock.tcp.state = TCP_CLOSED;
1956+
fifo_init(&ts->sock.tcp.txbuf, tiny_txbuf, sizeof(tiny_txbuf));
1957+
1958+
memset(&sin, 0, sizeof(sin));
1959+
sin.sin_family = AF_INET;
1960+
sin.sin_port = ee16(80);
1961+
sin.sin_addr.s_addr = ee32(0x0A000002U);
1962+
1963+
ck_assert_int_eq(wolfIP_sock_connect(&s, tcp_sd, (struct wolfIP_sockaddr *)&sin, sizeof(sin)),
1964+
-WOLFIP_EAGAIN);
1965+
ck_assert_int_eq(ts->sock.tcp.state, TCP_CLOSED);
1966+
ck_assert_uint_eq(ts->sock.tcp.ctrl_rto_active, 0);
1967+
ck_assert_int_eq(ts->sock.tcp.tmr_rto, NO_TIMER);
1968+
ck_assert_ptr_null(fifo_peek(&ts->sock.tcp.txbuf));
1969+
}
1970+
END_TEST
1971+
19401972
START_TEST(test_sock_connect_tcp_primary_ip_fallback)
19411973
{
19421974
struct wolfIP s;
@@ -2413,6 +2445,48 @@ START_TEST(test_sock_accept_clones_half_open_state_and_queues_synack)
24132445
}
24142446
END_TEST
24152447

2448+
START_TEST(test_sock_accept_synack_rto_txbuf_full_does_not_consume_retry)
2449+
{
2450+
struct wolfIP s;
2451+
int listen_sd;
2452+
int client_sd;
2453+
struct tsocket *accepted;
2454+
struct wolfIP_sockaddr_in sin;
2455+
uint8_t tiny_txbuf[32];
2456+
2457+
wolfIP_init(&s);
2458+
mock_link_init(&s);
2459+
wolfIP_ipconfig_set(&s, 0x0A000001U, 0xFFFFFF00U, 0);
2460+
2461+
listen_sd = wolfIP_sock_socket(&s, AF_INET, IPSTACK_SOCK_STREAM, WI_IPPROTO_TCP);
2462+
ck_assert_int_gt(listen_sd, 0);
2463+
memset(&sin, 0, sizeof(sin));
2464+
sin.sin_family = AF_INET;
2465+
sin.sin_port = ee16(1234);
2466+
sin.sin_addr.s_addr = ee32(0x0A000001U);
2467+
ck_assert_int_eq(wolfIP_sock_bind(&s, listen_sd, (struct wolfIP_sockaddr *)&sin, sizeof(sin)), 0);
2468+
ck_assert_int_eq(wolfIP_sock_listen(&s, listen_sd, 1), 0);
2469+
2470+
inject_tcp_syn(&s, TEST_PRIMARY_IF, 0x0A000001U, 1234);
2471+
client_sd = wolfIP_sock_accept(&s, listen_sd, NULL, NULL);
2472+
ck_assert_int_gt(client_sd, 0);
2473+
2474+
accepted = &s.tcpsockets[SOCKET_UNMARK(client_sd)];
2475+
ck_assert_int_eq(accepted->sock.tcp.state, TCP_SYN_RCVD);
2476+
2477+
fifo_init(&accepted->sock.tcp.txbuf, tiny_txbuf, sizeof(tiny_txbuf));
2478+
accepted->sock.tcp.ctrl_rto_retries = 0;
2479+
s.last_tick = 10000;
2480+
2481+
tcp_rto_cb(accepted);
2482+
2483+
ck_assert_uint_eq(accepted->sock.tcp.ctrl_rto_retries, 0);
2484+
ck_assert_uint_eq(accepted->sock.tcp.ctrl_rto_active, 1);
2485+
ck_assert_int_ne(accepted->sock.tcp.tmr_rto, NO_TIMER);
2486+
ck_assert_ptr_null(fifo_peek(&accepted->sock.tcp.txbuf));
2487+
}
2488+
END_TEST
2489+
24162490
START_TEST(test_sock_accept_synack_retransmission)
24172491
{
24182492
struct wolfIP s;

0 commit comments

Comments
 (0)