1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __LINUX_NEIGHBOUR_H
3 #define __LINUX_NEIGHBOUR_H
5 #include <linux/types.h>
6 #include <linux/netlink.h>
31 NDA_PROTOCOL, /* Originator of entry */
40 #define NDA_MAX (__NDA_MAX - 1)
43 * Neighbor Cache Entry Flags
46 #define NTF_USE (1 << 0)
47 #define NTF_SELF (1 << 1)
48 #define NTF_MASTER (1 << 2)
49 #define NTF_PROXY (1 << 3) /* == ATF_PUBL */
50 #define NTF_EXT_LEARNED (1 << 4)
51 #define NTF_OFFLOADED (1 << 5)
52 #define NTF_STICKY (1 << 6)
53 #define NTF_ROUTER (1 << 7)
54 /* Extended flags under NDA_FLAGS_EXT: */
55 #define NTF_EXT_MANAGED (1 << 0)
58 * Neighbor Cache Entry States.
61 #define NUD_INCOMPLETE 0x01
62 #define NUD_REACHABLE 0x02
63 #define NUD_STALE 0x04
64 #define NUD_DELAY 0x08
65 #define NUD_PROBE 0x10
66 #define NUD_FAILED 0x20
69 #define NUD_NOARP 0x40
70 #define NUD_PERMANENT 0x80
73 /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change and make no
74 * address resolution or NUD.
76 * NUD_PERMANENT also cannot be deleted by garbage collectors. This holds true
77 * for dynamic entries with NTF_EXT_LEARNED flag as well. However, upon carrier
78 * down event, NUD_PERMANENT entries are not flushed whereas NTF_EXT_LEARNED
79 * flagged entries explicitly are (which is also consistent with the routing
82 * When NTF_EXT_LEARNED is set for a bridge fdb entry the different cache entry
83 * states don't make sense and thus are ignored. Such entries don't age and
86 * NTF_EXT_MANAGED flagged neigbor entries are managed by the kernel on behalf
87 * of a user space control plane, and automatically refreshed so that (if
88 * possible) they remain in NUD_REACHABLE state.
91 struct nda_cacheinfo {
98 /*****************************************************************
99 * Neighbour tables specific messages.
101 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
102 * NLM_F_DUMP flag set. Every neighbour table configuration is
103 * spread over multiple messages to avoid running into message
104 * size limits on systems with many interfaces. The first message
105 * in the sequence transports all not device specific data such as
106 * statistics, configuration, and the default parameter set.
107 * This message is followed by 0..n messages carrying device
108 * specific parameter sets.
109 * Although the ordering should be sufficient, NDTA_NAME can be
110 * used to identify sequences. The initial message can be identified
111 * by checking for NDTA_CONFIG. The device specific messages do
112 * not contain this TLV but have NDTPA_IFINDEX set to the
113 * corresponding interface index.
115 * To change neighbour table attributes, send RTM_SETNEIGHTBL
116 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
117 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
118 * otherwise. Device specific parameter sets can be changed by
119 * setting NDTPA_IFINDEX to the interface index of the corresponding
126 __u64 ndts_hash_grows;
127 __u64 ndts_res_failed;
130 __u64 ndts_rcv_probes_mcast;
131 __u64 ndts_rcv_probes_ucast;
132 __u64 ndts_periodic_gc_runs;
133 __u64 ndts_forced_gc_runs;
134 __u64 ndts_table_fulls;
139 NDTPA_IFINDEX, /* u32, unchangeable */
140 NDTPA_REFCNT, /* u32, read-only */
141 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
142 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
143 NDTPA_RETRANS_TIME, /* u64, msecs */
144 NDTPA_GC_STALETIME, /* u64, msecs */
145 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
146 NDTPA_QUEUE_LEN, /* u32 */
147 NDTPA_APP_PROBES, /* u32 */
148 NDTPA_UCAST_PROBES, /* u32 */
149 NDTPA_MCAST_PROBES, /* u32 */
150 NDTPA_ANYCAST_DELAY, /* u64, msecs */
151 NDTPA_PROXY_DELAY, /* u64, msecs */
152 NDTPA_PROXY_QLEN, /* u32 */
153 NDTPA_LOCKTIME, /* u64, msecs */
154 NDTPA_QUEUE_LENBYTES, /* u32 */
155 NDTPA_MCAST_REPROBES, /* u32 */
157 NDTPA_INTERVAL_PROBE_TIME_MS, /* u64, msecs */
160 #define NDTPA_MAX (__NDTPA_MAX - 1)
170 __u16 ndtc_entry_size;
172 __u32 ndtc_last_flush; /* delta to now in msecs */
173 __u32 ndtc_last_rand; /* delta to now in msecs */
175 __u32 ndtc_hash_mask;
176 __u32 ndtc_hash_chain_gc;
177 __u32 ndtc_proxy_qlen;
182 NDTA_NAME, /* char *, unchangeable */
183 NDTA_THRESH1, /* u32 */
184 NDTA_THRESH2, /* u32 */
185 NDTA_THRESH3, /* u32 */
186 NDTA_CONFIG, /* struct ndt_config, read-only */
187 NDTA_PARMS, /* nested TLV NDTPA_* */
188 NDTA_STATS, /* struct ndt_stats, read-only */
189 NDTA_GC_INTERVAL, /* u64, msecs */
193 #define NDTA_MAX (__NDTA_MAX - 1)
195 /* FDB activity notification bits used in NFEA_ACTIVITY_NOTIFY:
196 * - FDB_NOTIFY_BIT - notify on activity/expire for any entry
197 * - FDB_NOTIFY_INACTIVE_BIT - mark as inactive to avoid multiple notifications
200 FDB_NOTIFY_BIT = (1 << 0),
201 FDB_NOTIFY_INACTIVE_BIT = (1 << 1)
204 /* embedded into NDA_FDB_EXT_ATTRS:
205 * [NDA_FDB_EXT_ATTRS] = {
206 * [NFEA_ACTIVITY_NOTIFY]
212 NFEA_ACTIVITY_NOTIFY,
216 #define NFEA_MAX (__NFEA_MAX - 1)