include/net/ndisc.h
Source file repositories/reference/linux-study-clean/include/net/ndisc.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/ndisc.h- Extension
.h- Size
- 13796 bytes
- Lines
- 455
- 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/compiler.hlinux/icmpv6.hlinux/in6.hlinux/types.hlinux/if_arp.hlinux/netdevice.hlinux/hash.hnet/neighbour.h
Detected Declarations
struct ctl_tablestruct inet6_devstruct net_devicestruct net_proto_familystruct sk_buffstruct prefix_infostruct nd_msgstruct rs_msgstruct ra_msgstruct rd_msgstruct nd_opt_hdrstruct ndisc_optionsstruct ndisc_opsfunction ndisc_ops_parse_optionsfunction ndisc_ops_updatefunction ndisc_ops_opt_addr_spacefunction ndisc_ops_redirect_opt_addr_spacefunction ndisc_ops_fill_addr_optionfunction ndisc_ops_fill_redirect_addr_optionfunction ndisc_ops_prefix_rcv_add_addrfunction ndisc_addr_option_padfunction __ndisc_opt_addr_spacefunction ndisc_opt_addr_spacefunction ndisc_redirect_opt_addr_spacefunction ndisc_hashfnfunction __ipv6_confirm_neigh
Annotated Snippet
struct nd_msg {
struct icmp6hdr icmph;
struct in6_addr target;
__u8 opt[];
};
struct rs_msg {
struct icmp6hdr icmph;
__u8 opt[];
};
struct ra_msg {
struct icmp6hdr icmph;
__be32 reachable_time;
__be32 retrans_timer;
};
struct rd_msg {
struct icmp6hdr icmph;
struct in6_addr target;
struct in6_addr dest;
__u8 opt[];
};
struct nd_opt_hdr {
__u8 nd_opt_type;
__u8 nd_opt_len;
} __packed;
/* ND options */
struct ndisc_options {
struct nd_opt_hdr *nd_opt_array[__ND_OPT_ARRAY_MAX];
#ifdef CONFIG_IPV6_ROUTE_INFO
struct nd_opt_hdr *nd_opts_ri;
struct nd_opt_hdr *nd_opts_ri_end;
#endif
struct nd_opt_hdr *nd_useropts;
struct nd_opt_hdr *nd_useropts_end;
#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
struct nd_opt_hdr *nd_802154_opt_array[ND_OPT_TARGET_LL_ADDR + 1];
#endif
};
#define nd_opts_src_lladdr nd_opt_array[ND_OPT_SOURCE_LL_ADDR]
#define nd_opts_tgt_lladdr nd_opt_array[ND_OPT_TARGET_LL_ADDR]
#define nd_opts_pi nd_opt_array[ND_OPT_PREFIX_INFO]
#define nd_opts_pi_end nd_opt_array[__ND_OPT_PREFIX_INFO_END]
#define nd_opts_rh nd_opt_array[ND_OPT_REDIRECT_HDR]
#define nd_opts_mtu nd_opt_array[ND_OPT_MTU]
#define nd_opts_nonce nd_opt_array[ND_OPT_NONCE]
#define nd_802154_opts_src_lladdr nd_802154_opt_array[ND_OPT_SOURCE_LL_ADDR]
#define nd_802154_opts_tgt_lladdr nd_802154_opt_array[ND_OPT_TARGET_LL_ADDR]
#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7)
struct ndisc_options *ndisc_parse_options(const struct net_device *dev,
u8 *opt, int opt_len,
struct ndisc_options *ndopts);
void __ndisc_fill_addr_option(struct sk_buff *skb, int type, const void *data,
int data_len, int pad);
#define NDISC_OPS_REDIRECT_DATA_SPACE 2
/*
* This structure defines the hooks for IPv6 neighbour discovery.
* The following hooks can be defined; unless noted otherwise, they are
* optional and can be filled with a null pointer.
*
* int (*parse_options)(const struct net_device *dev,
* struct nd_opt_hdr *nd_opt,
* struct ndisc_options *ndopts):
* This function is called while parsing ndisc ops and put each position
* as pointer into ndopts. If this function return unequal 0, then this
* function took care about the ndisc option, if 0 then the IPv6 ndisc
* option parser will take care about that option.
*
* void (*update)(const struct net_device *dev, struct neighbour *n,
* u32 flags, u8 icmp6_type,
* const struct ndisc_options *ndopts):
* This function is called when IPv6 ndisc updates the neighbour cache
* entry. Additional options which can be updated may be previously
* parsed by parse_opts callback and accessible over ndopts parameter.
*
* int (*opt_addr_space)(const struct net_device *dev, u8 icmp6_type,
* struct neighbour *neigh, u8 *ha_buf,
* u8 **ha):
* This function is called when the necessary option space will be
* calculated before allocating a skb. The parameters neigh, ha_buf
* abd ha are available on NDISC_REDIRECT messages only.
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/icmpv6.h`, `linux/in6.h`, `linux/types.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/hash.h`, `net/neighbour.h`.
- Detected declarations: `struct ctl_table`, `struct inet6_dev`, `struct net_device`, `struct net_proto_family`, `struct sk_buff`, `struct prefix_info`, `struct nd_msg`, `struct rs_msg`, `struct ra_msg`, `struct rd_msg`.
- 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.