include/net/ip_vs.h
Source file repositories/reference/linux-study-clean/include/net/ip_vs.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/ip_vs.h- Extension
.h- Size
- 66547 bytes
- Lines
- 2224
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ip_vs.hasm/types.hlinux/list.hlinux/rculist_bl.hlinux/spinlock.hlinux/atomic.hlinux/refcount.hlinux/workqueue.hlinux/compiler.hlinux/timer.hlinux/bug.hnet/checksum.hlinux/netfilter.hlinux/ip.hlinux/ipv6.hnet/ipv6.hnet/netfilter/nf_conntrack.hnet/net_namespace.hlinux/sched/isolation.hlinux/siphash.hlinux/net.h
Detected Declarations
struct ip_vs_iphdrstruct ip_vs_aligned_lockstruct ip_vs_seqstruct ip_vs_countersstruct ip_vs_cpu_statsstruct ip_vs_estimatorstruct ip_vs_kstatsstruct ip_vs_statsstruct ip_vs_stats_rcustruct ip_vs_est_tick_datastruct ip_vs_est_kt_datastruct ip_vs_rhtstruct dst_entrystruct iphdrstruct ip_vs_connstruct ip_vs_appstruct sk_buffstruct ip_vs_proto_datastruct ip_vs_protocolstruct ip_vs_proto_datastruct ip_vs_conn_paramstruct ip_vs_conn_hnodestruct ip_vs_connstruct ip_vs_service_user_kernstruct ip_vs_dest_user_kernstruct ip_vs_servicestruct ip_vs_dest_dststruct ip_vs_deststruct ip_vs_schedulerstruct ip_vs_pestruct ip_vs_appstruct ipvs_master_sync_statestruct ip_vs_sync_thread_datastruct ipvs_sync_daemon_cfgstruct netns_ipvsenum ip_vs_sctp_statesfunction ip_vs_fill_iph_skb_offfunction ip_vs_fill_iph_skb_icmpfunction ip_vs_fill_iph_skbfunction ip_vs_iph_inversefunction ip_vs_iph_icmpfunction ip_vs_addr_copyfunction ip_vs_addr_setfunction ip_vs_addr_equalfunction ip_vs_af_indexfunction ip_vs_rht_walk_bucketsfunction ip_vs_rht_build_hash_keyfunction sysctl_conn_max
Annotated Snippet
struct ip_vs_iphdr {
int hdr_flags; /* ipvs flags */
__u32 off; /* Where IP or IPv4 header starts */
__u32 len; /* IPv4 simply where L4 starts
* IPv6 where L4 Transport Header starts */
__u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
__s16 protocol;
__s32 flags;
union nf_inet_addr saddr;
union nf_inet_addr daddr;
};
static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
int len, void *buffer)
{
return skb_header_pointer(skb, offset, len, buffer);
}
/* This function handles filling *ip_vs_iphdr, both for IPv4 and IPv6.
* IPv6 requires some extra work, as finding proper header position,
* depend on the IPv6 extension headers.
*/
static inline int
ip_vs_fill_iph_skb_off(int af, const struct sk_buff *skb, int offset,
int hdr_flags, struct ip_vs_iphdr *iphdr)
{
iphdr->hdr_flags = hdr_flags;
iphdr->off = offset;
#ifdef CONFIG_IP_VS_IPV6
if (af == AF_INET6) {
struct ipv6hdr _iph;
const struct ipv6hdr *iph = skb_header_pointer(
skb, offset, sizeof(_iph), &_iph);
if (!iph)
return 0;
iphdr->saddr.in6 = iph->saddr;
iphdr->daddr.in6 = iph->daddr;
/* ipv6_find_hdr() updates len, flags */
iphdr->len = offset;
iphdr->flags = 0;
iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
&iphdr->fragoffs,
&iphdr->flags);
if (iphdr->protocol < 0)
return 0;
} else
#endif
{
struct iphdr _iph;
const struct iphdr *iph = skb_header_pointer(
skb, offset, sizeof(_iph), &_iph);
if (!iph)
return 0;
iphdr->len = offset + iph->ihl * 4;
iphdr->fragoffs = 0;
iphdr->protocol = iph->protocol;
iphdr->saddr.ip = iph->saddr;
iphdr->daddr.ip = iph->daddr;
}
return 1;
}
static inline int
ip_vs_fill_iph_skb_icmp(int af, const struct sk_buff *skb, int offset,
bool inverse, struct ip_vs_iphdr *iphdr)
{
int hdr_flags = IP_VS_HDR_ICMP;
if (inverse)
hdr_flags |= IP_VS_HDR_INVERSE;
return ip_vs_fill_iph_skb_off(af, skb, offset, hdr_flags, iphdr);
}
static inline int
ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, bool inverse,
struct ip_vs_iphdr *iphdr)
{
int hdr_flags = 0;
if (inverse)
hdr_flags |= IP_VS_HDR_INVERSE;
return ip_vs_fill_iph_skb_off(af, skb, skb_network_offset(skb),
hdr_flags, iphdr);
}
Annotation
- Immediate include surface: `linux/ip_vs.h`, `asm/types.h`, `linux/list.h`, `linux/rculist_bl.h`, `linux/spinlock.h`, `linux/atomic.h`, `linux/refcount.h`, `linux/workqueue.h`.
- Detected declarations: `struct ip_vs_iphdr`, `struct ip_vs_aligned_lock`, `struct ip_vs_seq`, `struct ip_vs_counters`, `struct ip_vs_cpu_stats`, `struct ip_vs_estimator`, `struct ip_vs_kstats`, `struct ip_vs_stats`, `struct ip_vs_stats_rcu`, `struct ip_vs_est_tick_data`.
- 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.