include/net/ip_fib.h
Source file repositories/reference/linux-study-clean/include/net/ip_fib.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/ip_fib.h- Extension
.h- Size
- 18008 bytes
- Lines
- 666
- 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
net/flow.hlinux/seq_file.hlinux/rcupdate.hnet/fib_notifier.hnet/fib_rules.hnet/inet_dscp.hnet/inetpeer.hlinux/percpu.hlinux/notifier.hlinux/refcount.hlinux/ip.hlinux/in_route.h
Detected Declarations
struct fib_configstruct fib_infostruct rtablestruct fib_nh_exceptionstruct fnhe_hash_bucketstruct fib_nh_commonstruct fib_nhstruct nexthopstruct fib_infostruct fib_rulestruct fib_tablestruct fib_resultstruct fib_result_nlstruct fib_rt_infostruct fib_entry_notifier_infostruct fib_nh_notifier_infostruct fib_tablestruct fib_dump_filterfunction fib_lookupfunction fib4_has_custom_rulesfunction fib4_rule_defaultfunction fib4_rules_dumpfunction fib4_rules_seq_readfunction fib4_rules_early_flow_dissectfunction fib_lookupfunction fib4_has_custom_rulesfunction fib4_rules_early_flow_dissectfunction fib_dscp_masked_matchfunction fib_validate_source_reasonfunction fib_num_tclassid_usersfunction fib_num_tclassid_usersfunction nhc_l3mdev_matches_devfunction fib_multipath_hash_construct_keyfunction fib_multipath_hash_from_keysfunction fib_multipath_hash_from_keysfunction fib_combine_itagfunction fib_info_holdfunction fib_info_hold_safefunction fib_info_putfunction fib_proc_initfunction fib_proc_exit
Annotated Snippet
struct fib_config {
u8 fc_dst_len;
dscp_t fc_dscp;
u8 fc_protocol;
u8 fc_scope;
u8 fc_type;
u8 fc_gw_family;
/* 2 bytes unused */
u32 fc_table;
__be32 fc_dst;
union {
__be32 fc_gw4;
struct in6_addr fc_gw6;
};
int fc_oif;
u32 fc_flags;
u32 fc_priority;
__be32 fc_prefsrc;
u32 fc_nh_id;
struct nlattr *fc_mx;
struct rtnexthop *fc_mp;
int fc_mx_len;
int fc_mp_len;
u32 fc_flow;
u32 fc_nlflags;
struct nl_info fc_nlinfo;
struct nlattr *fc_encap;
u16 fc_encap_type;
};
struct fib_info;
struct rtable;
struct fib_nh_exception {
struct fib_nh_exception __rcu *fnhe_next;
int fnhe_genid;
__be32 fnhe_daddr;
u32 fnhe_pmtu;
bool fnhe_mtu_locked;
__be32 fnhe_gw;
unsigned long fnhe_expires;
struct rtable __rcu *fnhe_rth_input;
struct rtable __rcu *fnhe_rth_output;
unsigned long fnhe_stamp;
struct rcu_head rcu;
};
struct fnhe_hash_bucket {
struct fib_nh_exception __rcu *chain;
};
#define FNHE_HASH_SHIFT 11
#define FNHE_HASH_SIZE (1 << FNHE_HASH_SHIFT)
#define FNHE_RECLAIM_DEPTH 5
struct fib_nh_common {
struct net_device *nhc_dev;
netdevice_tracker nhc_dev_tracker;
int nhc_oif;
unsigned char nhc_scope;
u8 nhc_family;
u8 nhc_gw_family;
unsigned char nhc_flags;
struct lwtunnel_state *nhc_lwtstate;
union {
__be32 ipv4;
struct in6_addr ipv6;
} nhc_gw;
int nhc_weight;
atomic_t nhc_upper_bound;
/* v4 specific, but allows fib6_nh with v4 routes */
struct rtable __rcu * __percpu *nhc_pcpu_rth_output;
struct rtable __rcu *nhc_rth_input;
struct fnhe_hash_bucket __rcu *nhc_exceptions;
};
struct fib_nh {
struct fib_nh_common nh_common;
struct hlist_node nh_hash;
struct fib_info *nh_parent;
#ifdef CONFIG_IP_ROUTE_CLASSID
__u32 nh_tclassid;
#endif
__be32 nh_saddr;
int nh_saddr_genid;
#define fib_nh_family nh_common.nhc_family
#define fib_nh_dev nh_common.nhc_dev
Annotation
- Immediate include surface: `net/flow.h`, `linux/seq_file.h`, `linux/rcupdate.h`, `net/fib_notifier.h`, `net/fib_rules.h`, `net/inet_dscp.h`, `net/inetpeer.h`, `linux/percpu.h`.
- Detected declarations: `struct fib_config`, `struct fib_info`, `struct rtable`, `struct fib_nh_exception`, `struct fnhe_hash_bucket`, `struct fib_nh_common`, `struct fib_nh`, `struct nexthop`, `struct fib_info`, `struct fib_rule`.
- 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.