tools/testing/selftests/net/tcp_ao/unsigned-md5.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/tcp_ao/unsigned-md5.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/tcp_ao/unsigned-md5.c- Extension
.c- Size
- 28242 bytes
- Lines
- 773
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
inttypes.haolib.h
Detected Declarations
function setup_vrfsfunction try_acceptfunction server_add_routesfunction server_add_fail_testsfunction server_vrf_testsfunction client_bindfunction try_connectfunction try_add_key_vrffunction test_continuefunction open_addfunction try_to_preaddfunction try_to_addfunction client_add_ipfunction client_add_ipsfunction client_add_fail_testsfunction client_vrf_testsfunction main
Annotated Snippet
if (sk < 0) {
test_error("accept()");
} else {
if (fault(TIMEOUT))
test_fail("%s: accepted", tst_name);
}
}
if (ao_addr && test_get_tcp_counters(lsk, &cnt2))
test_error("test_get_tcp_counters()");
close(lsk);
if (!cnt_name) {
test_ok("%s: no counter checks", tst_name);
goto out;
}
after_cnt = netstat_get_one(cnt_name, NULL);
if (after_cnt <= before_cnt) {
test_fail("%s: %s counter did not increase: %" PRIu64 " <= %" PRIu64,
tst_name, cnt_name, after_cnt, before_cnt);
} else {
test_ok("%s: counter %s increased %" PRIu64 " => %" PRIu64,
tst_name, cnt_name, before_cnt, after_cnt);
}
if (ao_addr)
test_assert_counters(tst_name, &cnt1, &cnt2, cnt_expected);
out:
synchronize_threads(); /* test_kill_sk() */
if (sk >= 0)
test_kill_sk(sk);
}
static void server_add_routes(void)
{
int family = TEST_FAMILY;
synchronize_threads(); /* client_add_ips() */
if (ip_route_add(veth_name, family, this_ip_addr, client2))
test_error("Failed to add route");
if (ip_route_add(veth_name, family, this_ip_addr, client3))
test_error("Failed to add route");
}
static void server_add_fail_tests(unsigned int *port)
{
union tcp_addr addr_any = {};
try_accept("TCP-AO established: add TCP-MD5 key", (*port)++, NULL, 0,
&addr_any, 0, 0, 100, 100, 0, "TCPAOGood", TEST_CNT_GOOD,
1, 0);
try_accept("TCP-MD5 established: add TCP-AO key", (*port)++, &addr_any,
0, NULL, 0, 0, 0, 0, 0, NULL, 0, 1, 0);
try_accept("non-signed established: add TCP-AO key", (*port)++, NULL, 0,
NULL, 0, 0, 0, 0, 0, "CurrEstab", 0, 0, 0);
}
static void server_vrf_tests(unsigned int *port)
{
setup_vrfs();
}
static void *server_fn(void *arg)
{
unsigned int port = test_server_port;
union tcp_addr addr_any = {};
server_add_routes();
try_accept("[server] AO server (INADDR_ANY): AO client", port++, NULL, 0,
&addr_any, 0, 0, 100, 100, 0, "TCPAOGood",
TEST_CNT_GOOD, 0, 0);
try_accept("[server] AO server (INADDR_ANY): MD5 client", port++, NULL, 0,
&addr_any, 0, 0, 100, 100, 0, "TCPMD5Unexpected",
TEST_CNT_NS_MD5_UNEXPECTED, 1, FAULT_TIMEOUT);
try_accept("[server] AO server (INADDR_ANY): no sign client", port++, NULL, 0,
&addr_any, 0, 0, 100, 100, 0, "TCPAORequired",
TEST_CNT_AO_REQUIRED, 0, FAULT_TIMEOUT);
try_accept("[server] AO server (AO_REQUIRED): AO client", port++, NULL, 0,
&this_ip_dest, TEST_PREFIX, true,
100, 100, 0, "TCPAOGood", TEST_CNT_GOOD, 0, 0);
try_accept("[server] AO server (AO_REQUIRED): unsigned client", port++, NULL, 0,
&this_ip_dest, TEST_PREFIX, true,
100, 100, 0, "TCPAORequired",
TEST_CNT_AO_REQUIRED, 0, FAULT_TIMEOUT);
try_accept("[server] MD5 server (INADDR_ANY): AO client", port++, &addr_any, 0,
Annotation
- Immediate include surface: `inttypes.h`, `aolib.h`.
- Detected declarations: `function setup_vrfs`, `function try_accept`, `function server_add_routes`, `function server_add_fail_tests`, `function server_vrf_tests`, `function client_bind`, `function try_connect`, `function try_add_key_vrf`, `function test_continue`, `function open_add`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.