include/net/ip6_route.h
Source file repositories/reference/linux-study-clean/include/net/ip6_route.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/ip6_route.h- Extension
.h- Size
- 11360 bytes
- Lines
- 396
- 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/addrconf.hnet/flow.hnet/ip6_fib.hnet/sock.hnet/lwtunnel.hlinux/ip.hlinux/ipv6.hlinux/route.hnet/nexthop.h
Detected Declarations
struct route_infostruct netlink_callbackstruct rt6_rtnl_dump_argfunction rt6_srcprefs2flagsfunction rt6_flags2srcprefsfunction rt6_need_strictfunction rt6_qualify_for_ecmpfunction ip6_route_inputfunction ip6_rt_put_flagsfunction ip6_del_rtfunction ip6_route_get_saddrfunction ip6_dst_storefunction ipv6_unicast_destinationfunction __ipv6_anycast_destinationfunction ipv6_anycast_destinationfunction ip6_fragmentfunction dst6_mtufunction ip6_skb_dst_mtufunction ip6_sk_accept_pmtufunction ip6_sk_ignore_dffunction rt6_duplicate_nexthopfunction ip6_dst_mtu_maybe_forward
Annotated Snippet
struct route_info {
__u8 type;
__u8 length;
__u8 prefix_len;
#if defined(__BIG_ENDIAN_BITFIELD)
__u8 reserved_h:3,
route_pref:2,
reserved_l:3;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
__u8 reserved_l:3,
route_pref:2,
reserved_h:3;
#endif
__be32 lifetime;
__u8 prefix[]; /* 0,8 or 16 */
};
#define RT6_LOOKUP_F_IFACE 0x00000001
#define RT6_LOOKUP_F_REACHABLE 0x00000002
#define RT6_LOOKUP_F_HAS_SADDR 0x00000004
#define RT6_LOOKUP_F_SRCPREF_TMP 0x00000008
#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
#define RT6_LOOKUP_F_IGNORE_LINKSTATE 0x00000040
#define RT6_LOOKUP_F_DST_NOREF 0x00000080
/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
* Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
*/
#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
/*
* rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
* between IPV6_ADDR_PREFERENCES socket option values
* IPV6_PREFER_SRC_TMP = 0x1
* IPV6_PREFER_SRC_PUBLIC = 0x2
* IPV6_PREFER_SRC_COA = 0x4
* and above RT6_LOOKUP_F_SRCPREF_xxx flags.
*/
static inline int rt6_srcprefs2flags(unsigned int srcprefs)
{
return (srcprefs & IPV6_PREFER_SRC_MASK) << 3;
}
static inline unsigned int rt6_flags2srcprefs(int flags)
{
return (flags >> 3) & IPV6_PREFER_SRC_MASK;
}
static inline bool rt6_need_strict(const struct in6_addr *daddr)
{
return ipv6_addr_type(daddr) &
(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
}
/* fib entries using a nexthop object can not be coalesced into
* a multipath route
*/
static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i)
{
/* the RTF_ADDRCONF flag filters out RA's */
return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh &&
f6i->fib6_nh->fib_nh_gw_family;
}
#if IS_ENABLED(CONFIG_IPV6)
void ip6_route_input(struct sk_buff *skb);
#else
static inline void ip6_route_input(struct sk_buff *skb)
{
}
#endif
struct dst_entry *ip6_route_input_lookup(struct net *net,
struct net_device *dev,
struct flowi6 *fl6,
const struct sk_buff *skb, int flags);
struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk,
struct flowi6 *fl6, int flags);
static inline struct dst_entry *ip6_route_output(struct net *net,
const struct sock *sk,
struct flowi6 *fl6)
{
return ip6_route_output_flags(net, sk, fl6, 0);
}
/* Only conditionally release dst if flags indicates
* !RT6_LOOKUP_F_DST_NOREF or dst is in uncached_list.
Annotation
- Immediate include surface: `net/addrconf.h`, `net/flow.h`, `net/ip6_fib.h`, `net/sock.h`, `net/lwtunnel.h`, `linux/ip.h`, `linux/ipv6.h`, `linux/route.h`.
- Detected declarations: `struct route_info`, `struct netlink_callback`, `struct rt6_rtnl_dump_arg`, `function rt6_srcprefs2flags`, `function rt6_flags2srcprefs`, `function rt6_need_strict`, `function rt6_qualify_for_ecmp`, `function ip6_route_input`, `function ip6_rt_put_flags`, `function ip6_del_rt`.
- 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.