tools/testing/selftests/net/tcp_ao/lib/aolib.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/tcp_ao/lib/aolib.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/tcp_ao/lib/aolib.h- Extension
.h- Size
- 24661 bytes
- Lines
- 833
- 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
arpa/inet.herrno.hlinux/snmp.hlinux/tcp.hnetinet/in.hstdarg.hstdbool.hstdlib.hstdio.hstring.hsys/syscall.hunistd.h../../../../../include/linux/stringify.h../../../../../include/linux/bits.h
Detected Declarations
struct tcp_ao_key_countersstruct tcp_ao_countersstruct tcp_countersstruct netstatstruct tcp_sock_queuestruct tcp_sock_statestruct test_ftracerenum test_faultenum test_needs_kconfigenum ftracer_openum trace_eventsfunction __printffunction __printffunction should_skip_testfunction test_init2function gen_tcp_addrfunction tcp_addr_to_sockaddr_infunction test_initfunction test_listen_socketfunction connectfunction test_connect_socketfunction test_set_md5function test_prepare_keyfunction test_prepare_def_keyfunction test_verify_socket_keyfunction test_add_key_vrffunction test_add_keyfunction test_verify_socket_aofunction test_set_ao_flagsfunction test_skpair_connect_pollfunction test_get_tcp_countersfunction netstat_get_onefunction test_sock_checkpointfunction test_sock_restorefunction test_add_repaired_keyfunction trace_hash_event_expectfunction trace_ao_event_expectfunction trace_ao_event_sk_expectfunction trace_ao_event_sne_expect
Annotated Snippet
struct tcp_ao_key_counters {
uint8_t sndid;
uint8_t rcvid;
uint64_t pkt_good;
uint64_t pkt_bad;
};
struct tcp_ao_counters {
/* per-netns */
uint64_t netns_ao_good;
uint64_t netns_ao_bad;
uint64_t netns_ao_key_not_found;
uint64_t netns_ao_required;
uint64_t netns_ao_dropped_icmp;
/* per-socket */
uint64_t ao_info_pkt_good;
uint64_t ao_info_pkt_bad;
uint64_t ao_info_pkt_key_not_found;
uint64_t ao_info_pkt_ao_required;
uint64_t ao_info_pkt_dropped_icmp;
/* per-key */
size_t nr_keys;
struct tcp_ao_key_counters *key_cnts;
};
struct tcp_counters {
struct tcp_ao_counters ao;
uint64_t netns_md5_notfound;
uint64_t netns_md5_unexpected;
uint64_t netns_md5_failure;
};
extern int test_get_tcp_counters(int sk, struct tcp_counters *out);
#define TEST_CNT_KEY_GOOD BIT(0)
#define TEST_CNT_KEY_BAD BIT(1)
#define TEST_CNT_SOCK_GOOD BIT(2)
#define TEST_CNT_SOCK_BAD BIT(3)
#define TEST_CNT_SOCK_KEY_NOT_FOUND BIT(4)
#define TEST_CNT_SOCK_AO_REQUIRED BIT(5)
#define TEST_CNT_SOCK_DROPPED_ICMP BIT(6)
#define TEST_CNT_NS_GOOD BIT(7)
#define TEST_CNT_NS_BAD BIT(8)
#define TEST_CNT_NS_KEY_NOT_FOUND BIT(9)
#define TEST_CNT_NS_AO_REQUIRED BIT(10)
#define TEST_CNT_NS_DROPPED_ICMP BIT(11)
#define TEST_CNT_NS_MD5_NOT_FOUND BIT(12)
#define TEST_CNT_NS_MD5_UNEXPECTED BIT(13)
#define TEST_CNT_NS_MD5_FAILURE BIT(14)
typedef uint16_t test_cnt;
#define _for_each_counter(f) \
do { \
/* per-netns */ \
f(ao.netns_ao_good, TEST_CNT_NS_GOOD); \
f(ao.netns_ao_bad, TEST_CNT_NS_BAD); \
f(ao.netns_ao_key_not_found, TEST_CNT_NS_KEY_NOT_FOUND); \
f(ao.netns_ao_required, TEST_CNT_NS_AO_REQUIRED); \
f(ao.netns_ao_dropped_icmp, TEST_CNT_NS_DROPPED_ICMP); \
/* per-socket */ \
f(ao.ao_info_pkt_good, TEST_CNT_SOCK_GOOD); \
f(ao.ao_info_pkt_bad, TEST_CNT_SOCK_BAD); \
f(ao.ao_info_pkt_key_not_found, TEST_CNT_SOCK_KEY_NOT_FOUND); \
f(ao.ao_info_pkt_ao_required, TEST_CNT_SOCK_AO_REQUIRED); \
f(ao.ao_info_pkt_dropped_icmp, TEST_CNT_SOCK_DROPPED_ICMP); \
/* non-AO */ \
f(netns_md5_notfound, TEST_CNT_NS_MD5_NOT_FOUND); \
f(netns_md5_unexpected, TEST_CNT_NS_MD5_UNEXPECTED); \
f(netns_md5_failure, TEST_CNT_NS_MD5_FAILURE); \
} while (0)
#define TEST_CNT_AO_GOOD (TEST_CNT_SOCK_GOOD | TEST_CNT_NS_GOOD)
#define TEST_CNT_AO_BAD (TEST_CNT_SOCK_BAD | TEST_CNT_NS_BAD)
#define TEST_CNT_AO_KEY_NOT_FOUND (TEST_CNT_SOCK_KEY_NOT_FOUND | \
TEST_CNT_NS_KEY_NOT_FOUND)
#define TEST_CNT_AO_REQUIRED (TEST_CNT_SOCK_AO_REQUIRED | \
TEST_CNT_NS_AO_REQUIRED)
#define TEST_CNT_AO_DROPPED_ICMP (TEST_CNT_SOCK_DROPPED_ICMP | \
TEST_CNT_NS_DROPPED_ICMP)
#define TEST_CNT_GOOD (TEST_CNT_KEY_GOOD | TEST_CNT_AO_GOOD)
#define TEST_CNT_BAD (TEST_CNT_KEY_BAD | TEST_CNT_AO_BAD)
extern test_cnt test_cmp_counters(struct tcp_counters *before,
struct tcp_counters *after);
extern int test_assert_counters_sk(const char *tst_name,
struct tcp_counters *before, struct tcp_counters *after,
test_cnt expected);
extern int test_assert_counters_key(const char *tst_name,
struct tcp_ao_counters *before, struct tcp_ao_counters *after,
test_cnt expected, int sndid, int rcvid);
Annotation
- Immediate include surface: `arpa/inet.h`, `errno.h`, `linux/snmp.h`, `linux/tcp.h`, `netinet/in.h`, `stdarg.h`, `stdbool.h`, `stdlib.h`.
- Detected declarations: `struct tcp_ao_key_counters`, `struct tcp_ao_counters`, `struct tcp_counters`, `struct netstat`, `struct tcp_sock_queue`, `struct tcp_sock_state`, `struct test_ftracer`, `enum test_fault`, `enum test_needs_kconfig`, `enum ftracer_op`.
- 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.