summaryrefslogtreecommitdiff
path: root/test/regression/bsd_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression/bsd_test')
-rw-r--r--test/regression/bsd_test/netx_bsd_aton_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_getaddrinfo_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_inet_addr_pton_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_ioctl_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_multicast_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_ntoa_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_ntop_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_pton_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_basic_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_basic_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_bind_connect_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_ping_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_pppoe_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_rx_nohdr_basic_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_raw_tx_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_recvfromto_test.c315
-rw-r--r--test/regression/bsd_test/netx_bsd_select_improvements_test.c316
-rw-r--r--test/regression/bsd_test/netx_bsd_select_spurious_event_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_socket_options_test.c335
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_2nd_bind_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_accept_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_accept_blocking_timeout_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_timeout_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_accept_noselect_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_basic_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_basic_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_bind_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_blocking_bidirection_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_clients_share_port_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_clients_shared_port_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_disconnect_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_fionread_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_getsockname_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_getsockname_without_bind_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_multiple_accept_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_rcvbuf_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_sendto_recvfrom_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_servers_share_port_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_servers_shared_port_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_two_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_tcp_udp_select_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_basic_blocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_basic_nonblocking_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_bind_connect_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_bind_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_blocking_bidirection_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_checksum_corrupt_test.c11
-rw-r--r--test/regression/bsd_test/netx_bsd_udp_connect_test.c11
51 files changed, 1494 insertions, 0 deletions
diff --git a/test/regression/bsd_test/netx_bsd_aton_test.c b/test/regression/bsd_test/netx_bsd_aton_test.c
index de2bb5aa..dd0e94db 100644
--- a/test/regression/bsd_test/netx_bsd_aton_test.c
+++ b/test/regression/bsd_test/netx_bsd_aton_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_getaddrinfo_test.c b/test/regression/bsd_test/netx_bsd_getaddrinfo_test.c
index 876b552d..df2bbee4 100644
--- a/test/regression/bsd_test/netx_bsd_getaddrinfo_test.c
+++ b/test/regression/bsd_test/netx_bsd_getaddrinfo_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_inet_addr_pton_test.c b/test/regression/bsd_test/netx_bsd_inet_addr_pton_test.c
index b0a1222f..229dd6fb 100644
--- a/test/regression/bsd_test/netx_bsd_inet_addr_pton_test.c
+++ b/test/regression/bsd_test/netx_bsd_inet_addr_pton_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD utility function, inet_addr and inet_pton which
both call inet_aton for converting addresses into a in_addr numeric format. */
diff --git a/test/regression/bsd_test/netx_bsd_ioctl_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_ioctl_nonblocking_test.c
index 46056930..5b77c3f7 100644
--- a/test/regression/bsd_test/netx_bsd_ioctl_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_ioctl_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_multicast_test.c b/test/regression/bsd_test/netx_bsd_multicast_test.c
index cc9e5094..24485bf9 100644
--- a/test/regression/bsd_test/netx_bsd_multicast_test.c
+++ b/test/regression/bsd_test/netx_bsd_multicast_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_ntoa_test.c b/test/regression/bsd_test/netx_bsd_ntoa_test.c
index 5a80dcfb..56df9d0f 100644
--- a/test/regression/bsd_test/netx_bsd_ntoa_test.c
+++ b/test/regression/bsd_test/netx_bsd_ntoa_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on inet_ntoa function. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_ntop_test.c b/test/regression/bsd_test/netx_bsd_ntop_test.c
index e96f4cc7..4eba935f 100644
--- a/test/regression/bsd_test/netx_bsd_ntop_test.c
+++ b/test/regression/bsd_test/netx_bsd_ntop_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_pton_test.c b/test/regression/bsd_test/netx_bsd_pton_test.c
index 31b0ab8e..dcc69f29 100644
--- a/test/regression/bsd_test/netx_bsd_pton_test.c
+++ b/test/regression/bsd_test/netx_bsd_pton_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_basic_blocking_test.c b/test/regression/bsd_test/netx_bsd_raw_basic_blocking_test.c
index f9d1d7dd..f5c397b2 100644
--- a/test/regression/bsd_test/netx_bsd_raw_basic_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_basic_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_basic_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_raw_basic_nonblocking_test.c
index ef8d098e..b18f83e4 100644
--- a/test/regression/bsd_test/netx_bsd_raw_basic_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_basic_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_blocking_test.c b/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_blocking_test.c
index fee06050..84c33c05 100644
--- a/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_nonblocking_test.c
index 445a5df4..e77ebf4b 100644
--- a/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_basic_rx_nohdr_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_bind_connect_test.c b/test/regression/bsd_test/netx_bsd_raw_bind_connect_test.c
index b1f11b6a..79f22e0a 100644
--- a/test/regression/bsd_test/netx_bsd_raw_bind_connect_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_bind_connect_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW non-blocking bind to a specific address and connect + send operation. */
diff --git a/test/regression/bsd_test/netx_bsd_raw_ping_test.c b/test/regression/bsd_test/netx_bsd_raw_ping_test.c
index 08493b7c..0c502eb5 100644
--- a/test/regression/bsd_test/netx_bsd_raw_ping_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_ping_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW Ping. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_pppoe_test.c b/test/regression/bsd_test/netx_bsd_raw_pppoe_test.c
index ae5450b5..099fd49c 100644
--- a/test/regression/bsd_test/netx_bsd_raw_pppoe_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_pppoe_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the BSD RAW Packet blocking operation for PPPoE traffic. */
/* This test case covers the following scenarios:
Be able to create socket_1 of PPPOE_SESS for receiving SESS traffice,
diff --git a/test/regression/bsd_test/netx_bsd_raw_rx_nohdr_basic_blocking_test.c b/test/regression/bsd_test/netx_bsd_raw_rx_nohdr_basic_blocking_test.c
index 4129880b..1284e2bd 100644
--- a/test/regression/bsd_test/netx_bsd_raw_rx_nohdr_basic_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_rx_nohdr_basic_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_raw_tx_test.c b/test/regression/bsd_test/netx_bsd_raw_tx_test.c
index 45de010b..959c3d17 100644
--- a/test/regression/bsd_test/netx_bsd_raw_tx_test.c
+++ b/test/regression/bsd_test/netx_bsd_raw_tx_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD RAW non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_recvfromto_test.c b/test/regression/bsd_test/netx_bsd_recvfromto_test.c
new file mode 100644
index 00000000..223e5c04
--- /dev/null
+++ b/test/regression/bsd_test/netx_bsd_recvfromto_test.c
@@ -0,0 +1,315 @@
+/***************************************************************************
+ * Copyright (C) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Copilot (Sonnet 4.6).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+/* This test covers the recvfromto() API from PR #376:
+ *
+ * 1. recvfromto() populates fromAddr with the sender's address/port and
+ * toAddr with the destination (local) address/port of the UDP packet.
+ *
+ * 2. recvfromto() with NULL toAddr/toAddrLen works like recvfrom().
+ *
+ * 3. inet_aton() still accepts abbreviated IPv4 forms such as a.b.c
+ * and a.b (regression for the inet_aton revert).
+ */
+
+#include "tx_api.h"
+#include "nx_api.h"
+#if defined(NX_BSD_ENABLE) && !defined(NX_DISABLE_IPV4) && defined(__PRODUCT_NETXDUO__)
+#include "nxd_bsd.h"
+
+#define DEMO_STACK_SIZE 4096
+#define BSD_THREAD_PRIORITY 2
+#define TEST_PORT 4444
+
+static TX_THREAD ntest_0;
+static TX_THREAD ntest_1;
+
+static NX_PACKET_POOL pool_0;
+static NX_IP ip_0; /* BSD receiver: 1.2.3.4 */
+static NX_IP ip_1; /* NX sender: 1.2.3.5 */
+static TX_SEMAPHORE sema_rx_ready;
+static TX_SEMAPHORE sema_done;
+
+static ULONG error_counter;
+
+static ULONG packet_pool_area[(512 + sizeof(NX_PACKET)) * 32 / 4];
+static ULONG bsd_thread_area[DEMO_STACK_SIZE / sizeof(ULONG)];
+
+static void ntest_0_entry(ULONG thread_input);
+static void ntest_1_entry(ULONG thread_input);
+extern void test_control_return(UINT status);
+extern void _nx_ram_network_driver_256(struct NX_IP_DRIVER_STRUCT *driver_req);
+
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_recvfromto_test_application_define(void *first_unused_memory)
+#endif
+{
+CHAR *pointer = (CHAR *)first_unused_memory;
+UINT status;
+
+ error_counter = 0;
+
+ tx_thread_create(&ntest_0, "thread 0", ntest_0_entry, 0,
+ pointer, DEMO_STACK_SIZE, 3, 3,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+ pointer += DEMO_STACK_SIZE;
+
+ tx_thread_create(&ntest_1, "thread 1", ntest_1_entry, 0,
+ pointer, DEMO_STACK_SIZE, 3, 3,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+ pointer += DEMO_STACK_SIZE;
+
+ nx_system_initialize();
+
+ status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", 512,
+ packet_pool_area, sizeof(packet_pool_area));
+ if (status)
+ error_counter++;
+
+ status = nx_ip_create(&ip_0, "NetX IP Instance 0",
+ IP_ADDRESS(1, 2, 3, 4), 0xFFFFFF00UL,
+ &pool_0, _nx_ram_network_driver_256,
+ pointer, 2048, 1);
+ pointer += 2048;
+ if (status)
+ error_counter++;
+
+ status = nx_ip_create(&ip_1, "NetX IP Instance 1",
+ IP_ADDRESS(1, 2, 3, 5), 0xFFFFFF00UL,
+ &pool_0, _nx_ram_network_driver_256,
+ pointer, 2048, 1);
+ pointer += 2048;
+ if (status)
+ error_counter++;
+
+ status = nx_arp_enable(&ip_0, (void *)pointer, 1024);
+ pointer += 1024;
+ if (status)
+ error_counter++;
+
+ status = nx_arp_enable(&ip_1, (void *)pointer, 1024);
+ pointer += 1024;
+ if (status)
+ error_counter++;
+
+ status = nx_udp_enable(&ip_0);
+ status += nx_udp_enable(&ip_1);
+ if (status)
+ error_counter++;
+
+ status = bsd_initialize(&ip_0, &pool_0, (CHAR *)&bsd_thread_area[0],
+ sizeof(bsd_thread_area), BSD_THREAD_PRIORITY);
+ if (status)
+ error_counter++;
+
+ status = tx_semaphore_create(&sema_rx_ready, "RX READY", 0);
+ if (status)
+ error_counter++;
+
+ status = tx_semaphore_create(&sema_done, "DONE", 0);
+ if (status)
+ error_counter++;
+}
+
+/* Thread 0: BSD receiver */
+static void ntest_0_entry(ULONG thread_input)
+{
+INT sock;
+struct nx_bsd_sockaddr_in local_addr;
+struct nx_bsd_sockaddr_in from_addr;
+struct nx_bsd_sockaddr_in to_addr;
+INT from_len;
+INT to_len;
+CHAR buf[64];
+INT ret;
+UINT actual_status;
+
+ /* Wait for IP stack initialisation. */
+ nx_ip_status_check(&ip_0, NX_IP_INITIALIZE_DONE, &actual_status,
+ NX_IP_PERIODIC_RATE);
+
+ /* --- Test 1: recvfromto() populates fromAddr and toAddr --- */
+ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (sock < 0)
+ {
+ error_counter++;
+ test_control_return(1);
+ return;
+ }
+
+ memset(&local_addr, 0, sizeof(local_addr));
+ local_addr.sin_family = AF_INET;
+ local_addr.sin_port = htons(TEST_PORT);
+ local_addr.sin_addr.s_addr = htonl(IP_ADDRESS(1, 2, 3, 4));
+
+ if (bind(sock, (struct nx_bsd_sockaddr *)&local_addr, sizeof(local_addr)) < 0)
+ {
+ error_counter++;
+ soc_close(sock);
+ test_control_return(1);
+ return;
+ }
+
+ /* Signal sender that receiver is ready. */
+ tx_semaphore_put(&sema_rx_ready);
+
+ memset(&from_addr, 0, sizeof(from_addr));
+ memset(&to_addr, 0, sizeof(to_addr));
+ from_len = sizeof(from_addr);
+ to_len = sizeof(to_addr);
+
+ ret = recvfromto(sock, buf, sizeof(buf), 0,
+ (struct nx_bsd_sockaddr *)&from_addr, &from_len,
+ (struct nx_bsd_sockaddr *)&to_addr, &to_len);
+ if (ret <= 0)
+ {
+ error_counter++;
+ }
+ else
+ {
+ /* Validate fromAddr: must be 1.2.3.5 : any port */
+ if (from_addr.sin_family != AF_INET)
+ error_counter++;
+ if (ntohl(from_addr.sin_addr.s_addr) != IP_ADDRESS(1, 2, 3, 5))
+ error_counter++;
+
+ /* Validate toAddr: must be 1.2.3.4 : TEST_PORT */
+ if (to_addr.sin_family != AF_INET)
+ error_counter++;
+ if (ntohl(to_addr.sin_addr.s_addr) != IP_ADDRESS(1, 2, 3, 4))
+ error_counter++;
+ if (ntohs(to_addr.sin_port) != TEST_PORT)
+ error_counter++;
+
+ /* toAddrLen must be trimmed to sizeof(sockaddr_in). */
+ if (to_len != (INT)sizeof(struct nx_bsd_sockaddr_in))
+ error_counter++;
+ }
+
+ soc_close(sock);
+
+ /* --- Test 2: recvfromto() with NULL toAddr works like recvfrom() --- */
+ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (sock < 0)
+ {
+ error_counter++;
+ test_control_return(1);
+ return;
+ }
+
+ memset(&local_addr, 0, sizeof(local_addr));
+ local_addr.sin_family = AF_INET;
+ local_addr.sin_port = htons(TEST_PORT);
+ local_addr.sin_addr.s_addr = htonl(IP_ADDRESS(1, 2, 3, 4));
+
+ if (bind(sock, (struct nx_bsd_sockaddr *)&local_addr, sizeof(local_addr)) < 0)
+ {
+ error_counter++;
+ soc_close(sock);
+ test_control_return(1);
+ return;
+ }
+
+ tx_semaphore_put(&sema_rx_ready);
+
+ memset(&from_addr, 0, sizeof(from_addr));
+ from_len = sizeof(from_addr);
+
+ ret = recvfromto(sock, buf, sizeof(buf), 0,
+ (struct nx_bsd_sockaddr *)&from_addr, &from_len,
+ NX_NULL, NX_NULL);
+ if (ret <= 0)
+ error_counter++;
+
+ soc_close(sock);
+
+ /* --- Test 3: inet_aton() still accepts abbreviated IPv4 forms --- */
+ {
+ struct in_addr in_val;
+ INT rc;
+
+ /* a.b format: 11.657930 == 11.0x0a0a0a == 11.10.10.10 */
+ rc = inet_aton("11.657930", &in_val);
+ if (rc == 0)
+ error_counter++;
+
+ /* a.b.c format: 11.10.2570 == 11.10.0x0a0a == 11.10.10.10 */
+ rc = inet_aton("11.10.2570", &in_val);
+ if (rc == 0)
+ error_counter++;
+
+ /* standard dotted-decimal must still work */
+ rc = inet_aton("11.10.10.10", &in_val);
+ if (rc == 0)
+ error_counter++;
+ }
+
+ tx_semaphore_put(&sema_done);
+}
+
+/* Thread 1: NX UDP sender */
+static void ntest_1_entry(ULONG thread_input)
+{
+NX_UDP_SOCKET udp_socket;
+NX_PACKET *packet_ptr;
+NXD_ADDRESS dest_addr;
+UINT actual_status;
+
+ nx_ip_status_check(&ip_1, NX_IP_INITIALIZE_DONE, &actual_status,
+ NX_IP_PERIODIC_RATE);
+
+ nx_udp_socket_create(&ip_1, &udp_socket, "UDP sender",
+ NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 8);
+ nx_udp_socket_bind(&udp_socket, NX_ANY_PORT, NX_WAIT_FOREVER);
+
+ memset(&dest_addr, 0, sizeof(dest_addr));
+ dest_addr.nxd_ip_version = NX_IP_VERSION_V4;
+ dest_addr.nxd_ip_address.v4 = IP_ADDRESS(1, 2, 3, 4);
+
+ /* Send for Test 1 */
+ tx_semaphore_get(&sema_rx_ready, NX_IP_PERIODIC_RATE);
+
+ nx_packet_allocate(&pool_0, &packet_ptr, NX_UDP_PACKET, NX_WAIT_FOREVER);
+ nx_packet_data_append(packet_ptr, "hello", 5, &pool_0, NX_WAIT_FOREVER);
+ nxd_udp_socket_send(&udp_socket, packet_ptr, &dest_addr, TEST_PORT);
+
+ /* Send for Test 2 */
+ tx_semaphore_get(&sema_rx_ready, NX_IP_PERIODIC_RATE);
+
+ nx_packet_allocate(&pool_0, &packet_ptr, NX_UDP_PACKET, NX_WAIT_FOREVER);
+ nx_packet_data_append(packet_ptr, "world", 5, &pool_0, NX_WAIT_FOREVER);
+ nxd_udp_socket_send(&udp_socket, packet_ptr, &dest_addr, TEST_PORT);
+
+ nx_udp_socket_unbind(&udp_socket);
+ nx_udp_socket_delete(&udp_socket);
+
+ /* Wait for receiver to finish then report result. */
+ tx_semaphore_get(&sema_done, 5 * NX_IP_PERIODIC_RATE);
+ test_control_return(error_counter ? 1 : 0);
+}
+
+#else /* !(NX_BSD_ENABLE && !NX_DISABLE_IPV4) */
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_recvfromto_test_application_define(void *first_unused_memory)
+#endif
+{
+ NX_PARAMETER_NOT_USED(first_unused_memory);
+ test_control_return(3); /* skip */
+}
+#endif /* NX_BSD_ENABLE && !NX_DISABLE_IPV4 */
diff --git a/test/regression/bsd_test/netx_bsd_select_improvements_test.c b/test/regression/bsd_test/netx_bsd_select_improvements_test.c
new file mode 100644
index 00000000..86aba67f
--- /dev/null
+++ b/test/regression/bsd_test/netx_bsd_select_improvements_test.c
@@ -0,0 +1,316 @@
+/***************************************************************************
+ * Copyright (C) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Copilot (Sonnet 4.6).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+/* This test covers select() improvements from PR #375:
+ *
+ * 1. TCP readfds + exceptfds in one select() call — normal (non-urgent) data
+ * must set readfds but MUST NOT set exceptfds.
+ *
+ * 2. select() with zero timeout and no ready sockets must return 0 and must
+ * clear all output fd sets (TX_NO_EVENTS path).
+ *
+ * 3. A socket that is not in use must be reported in writefds (regression for
+ * the writefds "not in use" restore).
+ */
+
+#include "tx_api.h"
+#include "nx_api.h"
+#if defined(NX_BSD_ENABLE) && !defined(NX_DISABLE_IPV4)
+#include "nxd_bsd.h"
+
+#define DEMO_STACK_SIZE 4096
+#define BSD_THREAD_PRIORITY 2
+
+static TX_THREAD ntest_0;
+static TX_THREAD ntest_1;
+
+static NX_PACKET_POOL pool_0;
+static NX_IP ip_0;
+static NX_IP ip_1;
+static TX_SEMAPHORE sema_0;
+static TX_SEMAPHORE sema_1;
+
+static ULONG error_counter;
+
+static ULONG packet_pool_area[(512 + sizeof(NX_PACKET)) * 32 / 4];
+
+static void ntest_0_entry(ULONG thread_input);
+static void ntest_1_entry(ULONG thread_input);
+extern void test_control_return(UINT status);
+extern void _nx_ram_network_driver_256(struct NX_IP_DRIVER_STRUCT *driver_req);
+
+static ULONG bsd_thread_area[DEMO_STACK_SIZE / sizeof(ULONG)];
+
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_select_improvements_test_application_define(void *first_unused_memory)
+#endif
+{
+CHAR *pointer = (CHAR *)first_unused_memory;
+UINT status;
+
+ error_counter = 0;
+
+ tx_thread_create(&ntest_0, "thread 0", ntest_0_entry, 0,
+ pointer, DEMO_STACK_SIZE, 3, 3,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+ pointer += DEMO_STACK_SIZE;
+
+ tx_thread_create(&ntest_1, "thread 1", ntest_1_entry, 0,
+ pointer, DEMO_STACK_SIZE, 3, 3,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+ pointer += DEMO_STACK_SIZE;
+
+ nx_system_initialize();
+
+ status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", 512,
+ packet_pool_area, sizeof(packet_pool_area));
+ if (status)
+ error_counter++;
+
+ status = nx_ip_create(&ip_0, "NetX IP Instance 0",
+ IP_ADDRESS(1, 2, 3, 4), 0xFFFFFF00UL,
+ &pool_0, _nx_ram_network_driver_256,
+ pointer, 2048, 1);
+ pointer += 2048;
+ if (status)
+ error_counter++;
+
+ status = nx_ip_create(&ip_1, "NetX IP Instance 1",
+ IP_ADDRESS(1, 2, 3, 5), 0xFFFFFF00UL,
+ &pool_0, _nx_ram_network_driver_256,
+ pointer, 2048, 1);
+ pointer += 2048;
+ if (status)
+ error_counter++;
+
+ status = nx_arp_enable(&ip_0, (void *)pointer, 1024);
+ pointer += 1024;
+ if (status)
+ error_counter++;
+
+ status = nx_arp_enable(&ip_1, (void *)pointer, 1024);
+ pointer += 1024;
+ if (status)
+ error_counter++;
+
+ status = nx_tcp_enable(&ip_0);
+ status += nx_tcp_enable(&ip_1);
+ if (status)
+ error_counter++;
+
+ status = bsd_initialize(&ip_0, &pool_0, (CHAR *)&bsd_thread_area[0],
+ sizeof(bsd_thread_area), BSD_THREAD_PRIORITY);
+ if (status)
+ error_counter++;
+
+ status = tx_semaphore_create(&sema_0, "SEMA 0", 0);
+ status += tx_semaphore_create(&sema_1, "SEMA 1", 0);
+ if (status)
+ error_counter++;
+}
+
+/* Server thread: exercises select() with readfds + exceptfds. */
+static void ntest_0_entry(ULONG thread_input)
+{
+struct sockaddr_in server_addr;
+struct sockaddr_in client_addr;
+INT server_sock;
+INT conn_sock;
+INT client_addr_len;
+INT n;
+INT nfd;
+struct timeval tv;
+fd_set readfds;
+fd_set writefds;
+fd_set exceptfds;
+char buf[64];
+
+ NX_PARAMETER_NOT_USED(thread_input);
+
+ /* ================================================================
+ * Set up TCP server socket.
+ * ================================================================ */
+ server_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (server_sock < 0)
+ error_counter++;
+
+ memset(&server_addr, 0, sizeof(server_addr));
+ server_addr.sin_family = AF_INET;
+ server_addr.sin_port = htons(5555);
+ server_addr.sin_addr.s_addr = INADDR_ANY;
+
+ if (bind(server_sock, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
+ error_counter++;
+
+ if (listen(server_sock, 1) < 0)
+ error_counter++;
+
+ /* Signal client thread to connect. */
+ tx_semaphore_put(&sema_1);
+
+ /* Accept the connection. */
+ client_addr_len = sizeof(client_addr);
+ conn_sock = accept(server_sock, (struct sockaddr *)&client_addr, &client_addr_len);
+ if (conn_sock < 0)
+ error_counter++;
+
+ /* ================================================================
+ * Test 1: zero-timeout select with no data ready must return 0
+ * and clear all output fd sets.
+ * ================================================================ */
+ FD_ZERO(&readfds);
+ FD_ZERO(&writefds);
+ FD_ZERO(&exceptfds);
+ FD_SET(conn_sock, &readfds);
+ FD_SET(conn_sock, &exceptfds);
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ nfd = conn_sock + 1;
+
+ n = select(nfd, &readfds, &writefds, &exceptfds, &tv);
+
+ if (n != 0)
+ error_counter++;
+
+ /* All sets must be cleared when select returns 0 (timeout). */
+ if (FD_ISSET(conn_sock, &readfds))
+ error_counter++;
+ if (FD_ISSET(conn_sock, &exceptfds))
+ error_counter++;
+
+ /* ================================================================
+ * Test 2: normal TCP data must set readfds and NOT exceptfds.
+ * ================================================================ */
+ FD_ZERO(&readfds);
+ FD_ZERO(&exceptfds);
+ FD_SET(conn_sock, &readfds);
+ FD_SET(conn_sock, &exceptfds);
+
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+
+ /* Tell the client we are ready to receive. */
+ tx_semaphore_put(&sema_0);
+
+ n = select(nfd, &readfds, NX_NULL, &exceptfds, &tv);
+
+ if (n <= 0)
+ error_counter++;
+
+ /* readfds must be set (data arrived). */
+ if (!FD_ISSET(conn_sock, &readfds))
+ error_counter++;
+
+ /* exceptfds must NOT be set (no urgent data). */
+ if (FD_ISSET(conn_sock, &exceptfds))
+ error_counter++;
+
+ /* Consume the data. */
+ recv(conn_sock, buf, sizeof(buf), 0);
+
+ /* ================================================================
+ * Test 3: a socket that is not in use must appear in writefds.
+ * ================================================================ */
+ {
+ INT closed_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ INT open_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ INT max_fd;
+
+ if (closed_sock < 0 || open_sock < 0)
+ error_counter++;
+
+ /* Close one socket so its slot is free. */
+ soc_close(closed_sock);
+
+ FD_ZERO(&writefds);
+ FD_SET(closed_sock, &writefds);
+ FD_SET(open_sock, &writefds);
+
+ max_fd = (closed_sock > open_sock ? closed_sock : open_sock) + 1;
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+
+ n = select(max_fd, NX_NULL, &writefds, NX_NULL, &tv);
+
+ /* The not-in-use socket must be reported writable. */
+ if (!FD_ISSET(closed_sock, &writefds))
+ error_counter++;
+
+ soc_close(open_sock);
+ }
+
+ soc_close(conn_sock);
+ soc_close(server_sock);
+
+ if (error_counter)
+ test_control_return(1);
+ else
+ test_control_return(0);
+}
+
+/* Client thread: connects and sends normal (non-urgent) TCP data. */
+static void ntest_1_entry(ULONG thread_input)
+{
+struct sockaddr_in server_addr;
+INT client_sock;
+ULONG actual_status;
+
+ NX_PARAMETER_NOT_USED(thread_input);
+
+ nx_ip_status_check(&ip_1, NX_IP_INITIALIZE_DONE, &actual_status,
+ 5 * NX_IP_PERIODIC_RATE);
+
+ /* Wait for server to be ready. */
+ tx_semaphore_get(&sema_1, 5 * NX_IP_PERIODIC_RATE);
+
+ client_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (client_sock < 0)
+ error_counter++;
+
+ memset(&server_addr, 0, sizeof(server_addr));
+ server_addr.sin_family = AF_INET;
+ server_addr.sin_port = htons(5555);
+ server_addr.sin_addr.s_addr = htonl(IP_ADDRESS(1, 2, 3, 4));
+
+ if (connect(client_sock, (struct sockaddr *)&server_addr,
+ sizeof(server_addr)) < 0)
+ error_counter++;
+
+ /* Wait for server to enter select(). */
+ tx_semaphore_get(&sema_0, 5 * NX_IP_PERIODIC_RATE);
+
+ /* Send normal (non-urgent) data. */
+ if (send(client_sock, "Hello", 5, 0) < 0)
+ error_counter++;
+
+ soc_close(client_sock);
+}
+
+#else
+
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_select_improvements_test_application_define(void *first_unused_memory)
+#endif
+{
+ NX_PARAMETER_NOT_USED(first_unused_memory);
+ test_control_return(3);
+}
+
+#endif /* NX_BSD_ENABLE && !NX_DISABLE_IPV4 */
diff --git a/test/regression/bsd_test/netx_bsd_select_spurious_event_test.c b/test/regression/bsd_test/netx_bsd_select_spurious_event_test.c
index 573cf3d9..f9de74cf 100644
--- a/test/regression/bsd_test/netx_bsd_select_spurious_event_test.c
+++ b/test/regression/bsd_test/netx_bsd_select_spurious_event_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the BSD select spurious event bug (Issue #366). */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_socket_options_test.c b/test/regression/bsd_test/netx_bsd_socket_options_test.c
new file mode 100644
index 00000000..bdc8f177
--- /dev/null
+++ b/test/regression/bsd_test/netx_bsd_socket_options_test.c
@@ -0,0 +1,335 @@
+/***************************************************************************
+ * Copyright (C) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Copilot (Sonnet 4.6).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+/* This test exercises setsockopt/getsockopt for SO_LINGER, IP_TOS, IP_TTL,
+ SO_BROADCAST and TCP_NODELAY, including error-path coverage introduced
+ by the PR #374 bug-fixes. */
+
+#include "tx_api.h"
+#include "nx_api.h"
+#if defined(NX_BSD_ENABLE) && !defined(NX_DISABLE_IPV4) && defined(__PRODUCT_NETXDUO__)
+#include "nxd_bsd.h"
+
+#define DEMO_STACK_SIZE 4096
+#define BSD_THREAD_PRIORITY 2
+
+static TX_THREAD ntest_0;
+static NX_PACKET_POOL pool_0;
+static NX_IP ip_0;
+static ULONG bsd_thread_area[DEMO_STACK_SIZE / sizeof(ULONG)];
+static ULONG error_counter;
+
+static ULONG packet_pool_area[(256 + sizeof(NX_PACKET)) * 16 / 4];
+
+static void ntest_0_entry(ULONG thread_input);
+extern void test_control_return(UINT status);
+extern void _nx_ram_network_driver_256(struct NX_IP_DRIVER_STRUCT *driver_req);
+
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_socket_options_test_application_define(void *first_unused_memory)
+#endif
+{
+CHAR *pointer = (CHAR *)first_unused_memory;
+UINT status;
+
+ error_counter = 0;
+
+ tx_thread_create(&ntest_0, "thread 0", ntest_0_entry, 0,
+ pointer, DEMO_STACK_SIZE, 3, 3,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+ pointer += DEMO_STACK_SIZE;
+
+ nx_system_initialize();
+
+ status = nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", 256,
+ packet_pool_area, sizeof(packet_pool_area));
+ if (status)
+ error_counter++;
+
+ status = nx_ip_create(&ip_0, "NetX IP Instance 0",
+ IP_ADDRESS(1, 2, 3, 4), 0xFFFFFF00UL,
+ &pool_0, _nx_ram_network_driver_256,
+ pointer, 2048, 1);
+ pointer += 2048;
+ if (status)
+ error_counter++;
+
+ status = nx_arp_enable(&ip_0, (void *)pointer, 1024);
+ pointer += 1024;
+ if (status)
+ error_counter++;
+
+ status = nx_tcp_enable(&ip_0);
+ if (status)
+ error_counter++;
+
+ status = nx_udp_enable(&ip_0);
+ if (status)
+ error_counter++;
+
+ status = bsd_initialize(&ip_0, &pool_0, (CHAR *)&bsd_thread_area[0],
+ sizeof(bsd_thread_area), BSD_THREAD_PRIORITY);
+ if (status)
+ error_counter++;
+}
+
+static void ntest_0_entry(ULONG thread_input)
+{
+int tcp_sock;
+int udp_sock;
+struct nx_bsd_linger ling_set;
+struct nx_bsd_linger ling_get;
+INT opt_val;
+INT opt_len;
+INT ret;
+
+ NX_PARAMETER_NOT_USED(thread_input);
+
+ /* Create sockets. */
+ tcp_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (tcp_sock < 0)
+ error_counter++;
+
+ udp_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (udp_sock < 0)
+ error_counter++;
+
+ /* ================================================================
+ * SO_LINGER: round-trip on TCP socket
+ * ================================================================ */
+ ling_set.l_onoff = 1;
+ ling_set.l_linger = 5;
+ ret = setsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_set, (INT)sizeof(ling_set));
+ if (ret != 0)
+ error_counter++;
+
+ opt_len = (INT)sizeof(ling_get);
+ ret = getsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_get, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (ling_get.l_onoff != 1)
+ error_counter++;
+ if (ling_get.l_linger != 5)
+ error_counter++;
+ if (opt_len != (INT)sizeof(struct nx_bsd_linger))
+ error_counter++;
+
+ /* Disable linger and verify l_onoff is cleared. */
+ ling_set.l_onoff = 0;
+ ling_set.l_linger = 0;
+ ret = setsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_set, (INT)sizeof(ling_set));
+ if (ret != 0)
+ error_counter++;
+
+ opt_len = (INT)sizeof(ling_get);
+ ret = getsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_get, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (ling_get.l_onoff != 0)
+ error_counter++;
+
+ /* Negative l_linger must be rejected with EINVAL. */
+ ling_set.l_onoff = 1;
+ ling_set.l_linger = -1;
+ ret = setsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_set, (INT)sizeof(ling_set));
+ if (ret == 0)
+ error_counter++;
+
+ /* Short output buffer must be rejected with EINVAL. */
+ opt_len = 1;
+ ret = getsockopt(tcp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_get, &opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* SO_LINGER on a UDP socket must fail with ENOPROTOOPT. */
+ ling_set.l_onoff = 1;
+ ling_set.l_linger = 1;
+ ret = setsockopt(udp_sock, SOL_SOCKET, SO_LINGER,
+ &ling_set, (INT)sizeof(ling_set));
+ if (ret == 0)
+ error_counter++;
+
+ /* ================================================================
+ * IP_TOS: round-trip on TCP socket
+ * ================================================================ */
+ opt_val = 0x10;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TOS, &opt_val, opt_len);
+ if (ret != 0)
+ error_counter++;
+
+ opt_val = 0;
+ opt_len = (INT)sizeof(INT);
+ ret = getsockopt(tcp_sock, IPPROTO_IP, IP_TOS, &opt_val, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (opt_val != 0x10)
+ error_counter++;
+ if (opt_len != (INT)sizeof(INT))
+ error_counter++;
+
+ /* IP_TOS round-trip on UDP socket. */
+ opt_val = 0x28;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(udp_sock, IPPROTO_IP, IP_TOS, &opt_val, opt_len);
+ if (ret != 0)
+ error_counter++;
+
+ opt_val = 0;
+ opt_len = (INT)sizeof(INT);
+ ret = getsockopt(udp_sock, IPPROTO_IP, IP_TOS, &opt_val, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (opt_val != 0x28)
+ error_counter++;
+
+ /* IP_TOS: out-of-range values must be rejected. */
+ opt_val = 256;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TOS, &opt_val, opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ opt_val = -1;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TOS, &opt_val, opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* A SO_* option number passed to IPPROTO_IP level must be rejected. */
+ opt_val = 1;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, SO_BROADCAST, &opt_val, opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* ================================================================
+ * IP_TTL: round-trip on TCP socket with INT-sized input
+ * ================================================================ */
+ opt_val = 64;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TTL, &opt_val, opt_len);
+ if (ret != 0)
+ error_counter++;
+
+ {
+ UCHAR ttl_get = 0;
+ INT ttl_len = (INT)sizeof(UCHAR);
+
+ ret = getsockopt(tcp_sock, IPPROTO_IP, IP_TTL, &ttl_get, &ttl_len);
+ if (ret != 0)
+ error_counter++;
+ if (ttl_get != 64)
+ error_counter++;
+ }
+
+ /* IP_TTL: round-trip on UDP socket. */
+ opt_val = 128;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(udp_sock, IPPROTO_IP, IP_TTL, &opt_val, opt_len);
+ if (ret != 0)
+ error_counter++;
+
+ {
+ UCHAR ttl_get = 0;
+ INT ttl_len = (INT)sizeof(UCHAR);
+
+ ret = getsockopt(udp_sock, IPPROTO_IP, IP_TTL, &ttl_get, &ttl_len);
+ if (ret != 0)
+ error_counter++;
+ if (ttl_get != 128)
+ error_counter++;
+ }
+
+ /* IP_TTL: out-of-range INT values must be rejected. */
+ opt_val = 300;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TTL, &opt_val, opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ opt_val = -1;
+ opt_len = (INT)sizeof(INT);
+ ret = setsockopt(tcp_sock, IPPROTO_IP, IP_TTL, &opt_val, opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* ================================================================
+ * SO_BROADCAST: getsockopt validates option_length
+ * ================================================================ */
+ opt_val = 0;
+ opt_len = (INT)sizeof(INT);
+ ret = getsockopt(tcp_sock, SOL_SOCKET, SO_BROADCAST, &opt_val, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (opt_val != 1)
+ error_counter++;
+ if (opt_len != (INT)sizeof(INT))
+ error_counter++;
+
+ opt_val = 0;
+ opt_len = 1;
+ ret = getsockopt(tcp_sock, SOL_SOCKET, SO_BROADCAST, &opt_val, &opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* ================================================================
+ * TCP_NODELAY: getsockopt validates option_length
+ * ================================================================ */
+ opt_val = 0;
+ opt_len = (INT)sizeof(INT);
+ ret = getsockopt(tcp_sock, IPPROTO_TCP, TCP_NODELAY, &opt_val, &opt_len);
+ if (ret != 0)
+ error_counter++;
+ if (opt_val != 1)
+ error_counter++;
+ if (opt_len != (INT)sizeof(INT))
+ error_counter++;
+
+ opt_val = 0;
+ opt_len = 1;
+ ret = getsockopt(tcp_sock, IPPROTO_TCP, TCP_NODELAY, &opt_val, &opt_len);
+ if (ret == 0)
+ error_counter++;
+
+ /* Clean up. */
+ soc_close(tcp_sock);
+ soc_close(udp_sock);
+
+ if (error_counter)
+ test_control_return(1);
+ else
+ test_control_return(0);
+}
+
+#else
+#ifdef CTEST
+VOID test_application_define(void *first_unused_memory)
+#else
+void netx_bsd_socket_options_test_application_define(void *first_unused_memory)
+#endif
+{
+ NX_PARAMETER_NOT_USED(first_unused_memory);
+ test_control_return(3);
+}
+#endif /* NX_BSD_ENABLE && !NX_DISABLE_IPV4 && __PRODUCT_NETXDUO__ */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_2nd_bind_test.c b/test/regression/bsd_test/netx_bsd_tcp_2nd_bind_test.c
index a064905b..43eb3fb0 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_2nd_bind_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_2nd_bind_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_test.c b/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_test.c
index 68f183bd..5dbd6eb9 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_timeout_test.c b/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_timeout_test.c
index a8ccbbee..512bc4cb 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_timeout_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_accept_blocking_timeout_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_test.c
index bb56d837..53caba52 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_timeout_test.c b/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_timeout_test.c
index 0af9d755..691db316 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_timeout_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_accept_nonblocking_timeout_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD non-blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_accept_noselect_test.c b/test/regression/bsd_test/netx_bsd_tcp_accept_noselect_test.c
index c2fd97d7..a485ddf9 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_accept_noselect_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_accept_noselect_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_basic_blocking_test.c b/test/regression/bsd_test/netx_bsd_tcp_basic_blocking_test.c
index eca7932e..6b68834c 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_basic_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_basic_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_basic_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_tcp_basic_nonblocking_test.c
index dcb89159..576813a8 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_basic_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_basic_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD non-blocking operation. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_bind_test.c b/test/regression/bsd_test/netx_bsd_tcp_bind_test.c
index 76c80432..5405a9b4 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_bind_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_bind_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_blocking_bidirection_test.c b/test/regression/bsd_test/netx_bsd_tcp_blocking_bidirection_test.c
index cb592509..b5690f5e 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_blocking_bidirection_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_blocking_bidirection_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_clients_share_port_test.c b/test/regression/bsd_test/netx_bsd_tcp_clients_share_port_test.c
index 1544d814..af2c0b98 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_clients_share_port_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_clients_share_port_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This demoonstrates sharing a port between an IPv4 and IPv6 TCP client socket to send
and receive packets (e.g emulates a socket that can send/receive iPv4 and Ipv6 packets)
using a simulated Ethernet driver. */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_clients_shared_port_test.c b/test/regression/bsd_test/netx_bsd_tcp_clients_shared_port_test.c
index d535193e..6d5a9388 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_clients_shared_port_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_clients_shared_port_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This demonstrates sharing a port between an IPv4 and IPv6 TCP client socket to send
and receive packets (e.g emulates a socket that can send/receive iPv4 and Ipv6 packets)
using a simulated Ethernet driver. */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_disconnect_test.c b/test/regression/bsd_test/netx_bsd_tcp_disconnect_test.c
index ebd8317e..2fb39567 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_disconnect_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_disconnect_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_fionread_test.c b/test/regression/bsd_test/netx_bsd_tcp_fionread_test.c
index 63c33155..ac7ca960 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_fionread_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_fionread_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_getsockname_test.c b/test/regression/bsd_test/netx_bsd_tcp_getsockname_test.c
index d742e704..34547b84 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_getsockname_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_getsockname_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_getsockname_without_bind_test.c b/test/regression/bsd_test/netx_bsd_tcp_getsockname_without_bind_test.c
index a78e3ff3..ea42fa11 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_getsockname_without_bind_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_getsockname_without_bind_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
#include "tx_api.h"
#include "nx_api.h"
#if defined(NX_BSD_ENABLE) && !defined(NX_DISABLE_IPV4)
diff --git a/test/regression/bsd_test/netx_bsd_tcp_multiple_accept_test.c b/test/regression/bsd_test/netx_bsd_tcp_multiple_accept_test.c
index 09268039..8f3ddd4b 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_multiple_accept_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_multiple_accept_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_rcvbuf_test.c b/test/regression/bsd_test/netx_bsd_tcp_rcvbuf_test.c
index 9b3e20f6..420417b6 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_rcvbuf_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_rcvbuf_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP window size when window scaling is used. */
#include "tx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_tcp_sendto_recvfrom_test.c b/test/regression/bsd_test/netx_bsd_tcp_sendto_recvfrom_test.c
index fcb776b3..244237c6 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_sendto_recvfrom_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_sendto_recvfrom_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_servers_share_port_test.c b/test/regression/bsd_test/netx_bsd_tcp_servers_share_port_test.c
index 4ca1f3b7..4e666149 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_servers_share_port_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_servers_share_port_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This demoonstrates sharing a port between an IPv4 and IPv6 TCP server socket to send
and receive packets (e.g emulates a socket that can send/receive iPv4 and Ipv6 packets)
using a simulated Ethernet driver. */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_servers_shared_port_test.c b/test/regression/bsd_test/netx_bsd_tcp_servers_shared_port_test.c
index 1540d156..e7470a9a 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_servers_shared_port_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_servers_shared_port_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This demoonstrates sharing a port between an IPv4 and IPv6 TCP server socket to send
and receive packets (e.g emulates a socket that can send/receive iPv4 and Ipv6 packets)
using a simulated Ethernet driver. */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_two_blocking_test.c b/test/regression/bsd_test/netx_bsd_tcp_two_blocking_test.c
index b40c6152..28e93653 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_two_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_two_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD TCP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), recv(), soc_close(), setsockopt() */
diff --git a/test/regression/bsd_test/netx_bsd_tcp_udp_select_test.c b/test/regression/bsd_test/netx_bsd_tcp_udp_select_test.c
index e34ac2c6..977a9c7a 100644
--- a/test/regression/bsd_test/netx_bsd_tcp_udp_select_test.c
+++ b/test/regression/bsd_test/netx_bsd_tcp_udp_select_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
diff --git a/test/regression/bsd_test/netx_bsd_udp_basic_blocking_test.c b/test/regression/bsd_test/netx_bsd_udp_basic_blocking_test.c
index e8810de1..a74b2b09 100644
--- a/test/regression/bsd_test/netx_bsd_udp_basic_blocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_basic_blocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
diff --git a/test/regression/bsd_test/netx_bsd_udp_basic_nonblocking_test.c b/test/regression/bsd_test/netx_bsd_udp_basic_nonblocking_test.c
index 2f476d4d..a9d80332 100644
--- a/test/regression/bsd_test/netx_bsd_udp_basic_nonblocking_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_basic_nonblocking_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP blocking operation. */
#include "tx_api.h"
#include "nx_api.h"
diff --git a/test/regression/bsd_test/netx_bsd_udp_bind_connect_test.c b/test/regression/bsd_test/netx_bsd_udp_bind_connect_test.c
index b43e5944..f7385458 100644
--- a/test/regression/bsd_test/netx_bsd_udp_bind_connect_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_bind_connect_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking bind to a specific address and connect + send operation. */
diff --git a/test/regression/bsd_test/netx_bsd_udp_bind_test.c b/test/regression/bsd_test/netx_bsd_udp_bind_test.c
index fb936708..8dc74970 100644
--- a/test/regression/bsd_test/netx_bsd_udp_bind_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_bind_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */
diff --git a/test/regression/bsd_test/netx_bsd_udp_blocking_bidirection_test.c b/test/regression/bsd_test/netx_bsd_udp_blocking_bidirection_test.c
index 8694ec88..bd911b81 100644
--- a/test/regression/bsd_test/netx_bsd_udp_blocking_bidirection_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_blocking_bidirection_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP blocking operation. */
/* The BSD APIs involved in this test are: socket(), connect(), send(), soc_close() */
diff --git a/test/regression/bsd_test/netx_bsd_udp_checksum_corrupt_test.c b/test/regression/bsd_test/netx_bsd_udp_checksum_corrupt_test.c
index 4f820958..7e21d473 100644
--- a/test/regression/bsd_test/netx_bsd_udp_checksum_corrupt_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_checksum_corrupt_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the BSD UDP socket reject packet with corrupted checksum. */
diff --git a/test/regression/bsd_test/netx_bsd_udp_connect_test.c b/test/regression/bsd_test/netx_bsd_udp_connect_test.c
index 91692621..72695c8e 100644
--- a/test/regression/bsd_test/netx_bsd_udp_connect_test.c
+++ b/test/regression/bsd_test/netx_bsd_udp_connect_test.c
@@ -1,3 +1,14 @@
+/***************************************************************************/
+/* Copyright (c) 2024 Microsoft Corporation */
+/* Copyright (c) 2026 Eclipse ThreadX contributors */
+/* */
+/* This program and the accompanying materials are made available under */
+/* the terms of the MIT License which is available at */
+/* https://opensource.org/licenses/MIT. */
+/* */
+/* SPDX-License-Identifier: MIT */
+/***************************************************************************/
+
/* This NetX test concentrates on the basic BSD UDP non-blocking operation. */