net/ipv6/tcp_ao.c
Source file repositories/reference/linux-study-clean/net/ipv6/tcp_ao.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/tcp_ao.c- Extension
.c- Size
- 3986 bytes
- Lines
- 144
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/tcp.hnet/tcp.hnet/ipv6.h
Detected Declarations
struct kdf_input_blockfunction Optionfunction tcp_v6_ao_calc_key_skbfunction tcp_v6_ao_calc_key_skfunction tcp_v6_ao_calc_key_rskfunction tcp_v6_ao_hash_pseudoheaderfunction tcp_v6_ao_hash_skbfunction tcp_v6_parse_aofunction tcp_v6_ao_synack_hash
Annotated Snippet
struct kdf_input_block {
u8 counter;
u8 label[6];
struct tcp6_ao_context ctx;
__be16 outlen;
} __packed input = {
.counter = 1,
.label = "TCP-AO",
.ctx = {
.saddr = *saddr,
.daddr = *daddr,
.sport = sport,
.dport = dport,
.sisn = sisn,
.disn = disn,
},
.outlen = htons(tcp_ao_digest_size(mkt) * 8), /* in bits */
};
tcp_ao_calc_traffic_key(mkt, key, &input, sizeof(input));
}
void tcp_v6_ao_calc_key_skb(struct tcp_ao_key *mkt, u8 *key,
const struct sk_buff *skb, __be32 sisn, __be32 disn)
{
const struct ipv6hdr *iph = ipv6_hdr(skb);
const struct tcphdr *th = tcp_hdr(skb);
tcp_v6_ao_calc_key(mkt, key, &iph->saddr, &iph->daddr, th->source,
th->dest, sisn, disn);
}
void tcp_v6_ao_calc_key_sk(struct tcp_ao_key *mkt, u8 *key,
const struct sock *sk, __be32 sisn,
__be32 disn, bool send)
{
if (send)
tcp_v6_ao_calc_key(mkt, key, &sk->sk_v6_rcv_saddr,
&sk->sk_v6_daddr, htons(sk->sk_num),
sk->sk_dport, sisn, disn);
else
tcp_v6_ao_calc_key(mkt, key, &sk->sk_v6_daddr,
&sk->sk_v6_rcv_saddr, sk->sk_dport,
htons(sk->sk_num), disn, sisn);
}
void tcp_v6_ao_calc_key_rsk(struct tcp_ao_key *mkt, u8 *key,
struct request_sock *req)
{
struct inet_request_sock *ireq = inet_rsk(req);
tcp_v6_ao_calc_key(mkt, key,
&ireq->ir_v6_loc_addr, &ireq->ir_v6_rmt_addr,
htons(ireq->ir_num), ireq->ir_rmt_port,
htonl(tcp_rsk(req)->snt_isn),
htonl(tcp_rsk(req)->rcv_isn));
}
struct tcp_ao_key *tcp_v6_ao_lookup(const struct sock *sk,
struct sock *addr_sk,
int sndid, int rcvid)
{
int l3index = l3mdev_master_ifindex_by_index(sock_net(sk),
addr_sk->sk_bound_dev_if);
struct in6_addr *addr = &addr_sk->sk_v6_daddr;
return tcp_ao_do_lookup(sk, l3index, (union tcp_ao_addr *)addr,
AF_INET6, sndid, rcvid);
}
struct tcp_ao_key *tcp_v6_ao_lookup_rsk(const struct sock *sk,
struct request_sock *req,
int sndid, int rcvid)
{
struct inet_request_sock *ireq = inet_rsk(req);
struct in6_addr *addr = &ireq->ir_v6_rmt_addr;
int l3index;
l3index = l3mdev_master_ifindex_by_index(sock_net(sk), ireq->ir_iif);
return tcp_ao_do_lookup(sk, l3index, (union tcp_ao_addr *)addr,
AF_INET6, sndid, rcvid);
}
void tcp_v6_ao_hash_pseudoheader(struct tcp_ao_mac_ctx *mac_ctx,
const struct in6_addr *daddr,
const struct in6_addr *saddr, int nbytes)
{
/* 1. TCP pseudo-header (RFC2460) */
struct tcp6_pseudohdr phdr = {
.saddr = *saddr,
Annotation
- Immediate include surface: `linux/tcp.h`, `net/tcp.h`, `net/ipv6.h`.
- Detected declarations: `struct kdf_input_block`, `function Option`, `function tcp_v6_ao_calc_key_skb`, `function tcp_v6_ao_calc_key_sk`, `function tcp_v6_ao_calc_key_rsk`, `function tcp_v6_ao_hash_pseudoheader`, `function tcp_v6_ao_hash_skb`, `function tcp_v6_parse_ao`, `function tcp_v6_ao_synack_hash`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.