net/netfilter/ipvs/ip_vs_sync.c
Source file repositories/reference/linux-study-clean/net/netfilter/ipvs/ip_vs_sync.c
File Facts
- System
- Linux kernel
- Corpus path
net/netfilter/ipvs/ip_vs_sync.c- Extension
.c- Size
- 55763 bytes
- Lines
- 2062
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/slab.hlinux/inetdevice.hlinux/net.hlinux/completion.hlinux/delay.hlinux/skbuff.hlinux/in.hlinux/igmp.hlinux/udp.hlinux/err.hlinux/kthread.hlinux/wait.hlinux/kernel.hlinux/sched/signal.hlinux/unaligned.hnet/ip.hnet/sock.hnet/ip_vs.h
Detected Declarations
struct ip_vs_sync_conn_v0struct ip_vs_sync_conn_optionsstruct ip_vs_sync_v4struct ip_vs_sync_v6struct ip_vs_sync_thread_datastruct ip_vs_sync_mesg_v0struct ip_vs_sync_mesgstruct ip_vs_sync_bufffunction ntoh_seqfunction hton_seqfunction sb_dequeuefunction ip_vs_sync_buff_createfunction ip_vs_sync_buff_releasefunction sb_queue_tailfunction get_curr_sync_bufffunction select_master_thread_idfunction ip_vs_sync_buff_create_v0function in_persistencefunction withfunction ip_vs_sync_conn_v0function ip_vs_sync_connfunction ip_vs_conn_fill_param_syncfunction ip_vs_proc_connfunction ip_vs_process_message_v0function ip_vs_proc_seqoptfunction ip_vs_proc_strfunction ip_vs_proc_sync_connfunction ip_vs_process_messagefunction sndbuffunction set_mcast_loopfunction set_mcast_ttlfunction set_mcast_pmtudiscfunction set_mcast_iffunction join_mcast_groupfunction join_mcast_group6function bind_mcastif_addrfunction get_mcast_sockaddrfunction make_send_sockfunction make_receive_sockfunction ip_vs_send_asyncfunction ip_vs_send_sync_msgfunction ip_vs_receivefunction master_wakeup_work_handlerfunction next_sync_bufffunction sync_thread_masterfunction sync_thread_backupfunction start_sync_threadfunction stop_sync_thread
Annotated Snippet
struct ip_vs_sync_conn_v0 {
__u8 reserved;
/* Protocol, addresses and port numbers */
__u8 protocol; /* Which protocol (TCP/UDP) */
__be16 cport;
__be16 vport;
__be16 dport;
__be32 caddr; /* client address */
__be32 vaddr; /* virtual address */
__be32 daddr; /* destination address */
/* Flags and state transition */
__be16 flags; /* status flags */
__be16 state; /* state info */
/* The sequence options start here */
};
struct ip_vs_sync_conn_options {
struct ip_vs_seq in_seq; /* incoming seq. struct */
struct ip_vs_seq out_seq; /* outgoing seq. struct */
};
/*
Sync Connection format (sync_conn)
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Protocol | Ver. | Size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| State | cport |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| vport | dport |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| fwmark |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timeout (in sec.) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
| IP-Addresses (v4 or v6) |
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Optional Parameters.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Param. Type | Param. Length | Param. data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| ... |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Param Type | Param. Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Param data |
| Last Param data should be padded for 32 bit alignment |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
/*
* Type 0, IPv4 sync connection format
*/
struct ip_vs_sync_v4 {
__u8 type;
__u8 protocol; /* Which protocol (TCP/UDP) */
__be16 ver_size; /* Version msb 4 bits */
/* Flags and state transition */
__be32 flags; /* status flags */
__be16 state; /* state info */
/* Protocol, addresses and port numbers */
__be16 cport;
__be16 vport;
__be16 dport;
__be32 fwmark; /* Firewall mark from skb */
__be32 timeout; /* cp timeout */
__be32 caddr; /* client address */
__be32 vaddr; /* virtual address */
__be32 daddr; /* destination address */
/* The sequence options start here */
/* PE data padded to 32bit alignment after seq. options */
};
/*
* Type 2 messages IPv6
*/
struct ip_vs_sync_v6 {
__u8 type;
__u8 protocol; /* Which protocol (TCP/UDP) */
__be16 ver_size; /* Version msb 4 bits */
/* Flags and state transition */
__be32 flags; /* status flags */
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/inetdevice.h`, `linux/net.h`, `linux/completion.h`, `linux/delay.h`, `linux/skbuff.h`, `linux/in.h`.
- Detected declarations: `struct ip_vs_sync_conn_v0`, `struct ip_vs_sync_conn_options`, `struct ip_vs_sync_v4`, `struct ip_vs_sync_v6`, `struct ip_vs_sync_thread_data`, `struct ip_vs_sync_mesg_v0`, `struct ip_vs_sync_mesg`, `struct ip_vs_sync_buff`, `function ntoh_seq`, `function hton_seq`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.