1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef __LINUX_NEIGHBOUR_H 2 #ifndef __LINUX_NEIGHBOUR_H 3 #define __LINUX_NEIGHBOUR_H 3 #define __LINUX_NEIGHBOUR_H 4 4 5 #include <linux/types.h> 5 #include <linux/types.h> 6 #include <linux/netlink.h> 6 #include <linux/netlink.h> 7 7 8 struct ndmsg { 8 struct ndmsg { 9 __u8 ndm_family; 9 __u8 ndm_family; 10 __u8 ndm_pad1; 10 __u8 ndm_pad1; 11 __u16 ndm_pad2; 11 __u16 ndm_pad2; 12 __s32 ndm_ifindex; 12 __s32 ndm_ifindex; 13 __u16 ndm_state; 13 __u16 ndm_state; 14 __u8 ndm_flags; 14 __u8 ndm_flags; 15 __u8 ndm_type; 15 __u8 ndm_type; 16 }; 16 }; 17 17 18 enum { 18 enum { 19 NDA_UNSPEC, 19 NDA_UNSPEC, 20 NDA_DST, 20 NDA_DST, 21 NDA_LLADDR, 21 NDA_LLADDR, 22 NDA_CACHEINFO, 22 NDA_CACHEINFO, 23 NDA_PROBES, 23 NDA_PROBES, 24 NDA_VLAN, 24 NDA_VLAN, 25 NDA_PORT, 25 NDA_PORT, 26 NDA_VNI, 26 NDA_VNI, 27 NDA_IFINDEX, 27 NDA_IFINDEX, 28 NDA_MASTER, 28 NDA_MASTER, 29 NDA_LINK_NETNSID, 29 NDA_LINK_NETNSID, 30 NDA_SRC_VNI, 30 NDA_SRC_VNI, 31 NDA_PROTOCOL, /* Originator of entry 31 NDA_PROTOCOL, /* Originator of entry */ 32 NDA_NH_ID, 32 NDA_NH_ID, 33 NDA_FDB_EXT_ATTRS, 33 NDA_FDB_EXT_ATTRS, 34 NDA_FLAGS_EXT, 34 NDA_FLAGS_EXT, 35 NDA_NDM_STATE_MASK, << 36 NDA_NDM_FLAGS_MASK, << 37 __NDA_MAX 35 __NDA_MAX 38 }; 36 }; 39 37 40 #define NDA_MAX (__NDA_MAX - 1) 38 #define NDA_MAX (__NDA_MAX - 1) 41 39 42 /* 40 /* 43 * Neighbor Cache Entry Flags 41 * Neighbor Cache Entry Flags 44 */ 42 */ 45 43 46 #define NTF_USE (1 << 0) 44 #define NTF_USE (1 << 0) 47 #define NTF_SELF (1 << 1) 45 #define NTF_SELF (1 << 1) 48 #define NTF_MASTER (1 << 2) 46 #define NTF_MASTER (1 << 2) 49 #define NTF_PROXY (1 << 3) /* == 47 #define NTF_PROXY (1 << 3) /* == ATF_PUBL */ 50 #define NTF_EXT_LEARNED (1 << 4) 48 #define NTF_EXT_LEARNED (1 << 4) 51 #define NTF_OFFLOADED (1 << 5) 49 #define NTF_OFFLOADED (1 << 5) 52 #define NTF_STICKY (1 << 6) 50 #define NTF_STICKY (1 << 6) 53 #define NTF_ROUTER (1 << 7) 51 #define NTF_ROUTER (1 << 7) 54 /* Extended flags under NDA_FLAGS_EXT: */ 52 /* Extended flags under NDA_FLAGS_EXT: */ 55 #define NTF_EXT_MANAGED (1 << 0) !! 53 #define NTF_EXT_MANAGED (1 << 0) 56 #define NTF_EXT_LOCKED (1 << 1) << 57 54 58 /* 55 /* 59 * Neighbor Cache Entry States. 56 * Neighbor Cache Entry States. 60 */ 57 */ 61 58 62 #define NUD_INCOMPLETE 0x01 59 #define NUD_INCOMPLETE 0x01 63 #define NUD_REACHABLE 0x02 60 #define NUD_REACHABLE 0x02 64 #define NUD_STALE 0x04 61 #define NUD_STALE 0x04 65 #define NUD_DELAY 0x08 62 #define NUD_DELAY 0x08 66 #define NUD_PROBE 0x10 63 #define NUD_PROBE 0x10 67 #define NUD_FAILED 0x20 64 #define NUD_FAILED 0x20 68 65 69 /* Dummy states */ 66 /* Dummy states */ 70 #define NUD_NOARP 0x40 67 #define NUD_NOARP 0x40 71 #define NUD_PERMANENT 0x80 68 #define NUD_PERMANENT 0x80 72 #define NUD_NONE 0x00 69 #define NUD_NONE 0x00 73 70 74 /* NUD_NOARP & NUD_PERMANENT are pseudostates, 71 /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change and make no 75 * address resolution or NUD. 72 * address resolution or NUD. 76 * 73 * 77 * NUD_PERMANENT also cannot be deleted by gar 74 * NUD_PERMANENT also cannot be deleted by garbage collectors. This holds true 78 * for dynamic entries with NTF_EXT_LEARNED fl 75 * for dynamic entries with NTF_EXT_LEARNED flag as well. However, upon carrier 79 * down event, NUD_PERMANENT entries are not f 76 * down event, NUD_PERMANENT entries are not flushed whereas NTF_EXT_LEARNED 80 * flagged entries explicitly are (which is al 77 * flagged entries explicitly are (which is also consistent with the routing 81 * subsystem). 78 * subsystem). 82 * 79 * 83 * When NTF_EXT_LEARNED is set for a bridge fd 80 * When NTF_EXT_LEARNED is set for a bridge fdb entry the different cache entry 84 * states don't make sense and thus are ignore 81 * states don't make sense and thus are ignored. Such entries don't age and 85 * can roam. 82 * can roam. 86 * 83 * 87 * NTF_EXT_MANAGED flagged neigbor entries are 84 * NTF_EXT_MANAGED flagged neigbor entries are managed by the kernel on behalf 88 * of a user space control plane, and automati 85 * of a user space control plane, and automatically refreshed so that (if 89 * possible) they remain in NUD_REACHABLE stat 86 * possible) they remain in NUD_REACHABLE state. 90 * << 91 * NTF_EXT_LOCKED flagged bridge FDB entries a << 92 * bridge in response to a host trying to comm << 93 * with MAB enabled. Their purpose is to notif << 94 * authentication. << 95 */ 87 */ 96 88 97 struct nda_cacheinfo { 89 struct nda_cacheinfo { 98 __u32 ndm_confirmed; 90 __u32 ndm_confirmed; 99 __u32 ndm_used; 91 __u32 ndm_used; 100 __u32 ndm_updated; 92 __u32 ndm_updated; 101 __u32 ndm_refcnt; 93 __u32 ndm_refcnt; 102 }; 94 }; 103 95 104 /********************************************* 96 /***************************************************************** 105 * Neighbour tables specific mess 97 * Neighbour tables specific messages. 106 * 98 * 107 * To retrieve the neighbour tables send RTM_G 99 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the 108 * NLM_F_DUMP flag set. Every neighbour table 100 * NLM_F_DUMP flag set. Every neighbour table configuration is 109 * spread over multiple messages to avoid runn 101 * spread over multiple messages to avoid running into message 110 * size limits on systems with many interfaces 102 * size limits on systems with many interfaces. The first message 111 * in the sequence transports all not device s 103 * in the sequence transports all not device specific data such as 112 * statistics, configuration, and the default 104 * statistics, configuration, and the default parameter set. 113 * This message is followed by 0..n messages c 105 * This message is followed by 0..n messages carrying device 114 * specific parameter sets. 106 * specific parameter sets. 115 * Although the ordering should be sufficient, 107 * Although the ordering should be sufficient, NDTA_NAME can be 116 * used to identify sequences. The initial mes 108 * used to identify sequences. The initial message can be identified 117 * by checking for NDTA_CONFIG. The device spe 109 * by checking for NDTA_CONFIG. The device specific messages do 118 * not contain this TLV but have NDTPA_IFINDEX 110 * not contain this TLV but have NDTPA_IFINDEX set to the 119 * corresponding interface index. 111 * corresponding interface index. 120 * 112 * 121 * To change neighbour table attributes, send 113 * To change neighbour table attributes, send RTM_SETNEIGHTBL 122 * with NDTA_NAME set. Changeable attribute in 114 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], 123 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARM 115 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked 124 * otherwise. Device specific parameter sets c 116 * otherwise. Device specific parameter sets can be changed by 125 * setting NDTPA_IFINDEX to the interface inde 117 * setting NDTPA_IFINDEX to the interface index of the corresponding 126 * device. 118 * device. 127 ****/ 119 ****/ 128 120 129 struct ndt_stats { 121 struct ndt_stats { 130 __u64 ndts_allocs; 122 __u64 ndts_allocs; 131 __u64 ndts_destroys; 123 __u64 ndts_destroys; 132 __u64 ndts_hash_grows; 124 __u64 ndts_hash_grows; 133 __u64 ndts_res_failed; 125 __u64 ndts_res_failed; 134 __u64 ndts_lookups; 126 __u64 ndts_lookups; 135 __u64 ndts_hits; 127 __u64 ndts_hits; 136 __u64 ndts_rcv_probes_mcast; 128 __u64 ndts_rcv_probes_mcast; 137 __u64 ndts_rcv_probes_ucast; 129 __u64 ndts_rcv_probes_ucast; 138 __u64 ndts_periodic_gc_runs; 130 __u64 ndts_periodic_gc_runs; 139 __u64 ndts_forced_gc_runs; 131 __u64 ndts_forced_gc_runs; 140 __u64 ndts_table_fulls; 132 __u64 ndts_table_fulls; 141 }; 133 }; 142 134 143 enum { 135 enum { 144 NDTPA_UNSPEC, 136 NDTPA_UNSPEC, 145 NDTPA_IFINDEX, /* u32 137 NDTPA_IFINDEX, /* u32, unchangeable */ 146 NDTPA_REFCNT, /* u32 138 NDTPA_REFCNT, /* u32, read-only */ 147 NDTPA_REACHABLE_TIME, /* u64 139 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ 148 NDTPA_BASE_REACHABLE_TIME, /* u64 140 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ 149 NDTPA_RETRANS_TIME, /* u64 141 NDTPA_RETRANS_TIME, /* u64, msecs */ 150 NDTPA_GC_STALETIME, /* u64 142 NDTPA_GC_STALETIME, /* u64, msecs */ 151 NDTPA_DELAY_PROBE_TIME, /* u64 143 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ 152 NDTPA_QUEUE_LEN, /* u32 144 NDTPA_QUEUE_LEN, /* u32 */ 153 NDTPA_APP_PROBES, /* u32 145 NDTPA_APP_PROBES, /* u32 */ 154 NDTPA_UCAST_PROBES, /* u32 146 NDTPA_UCAST_PROBES, /* u32 */ 155 NDTPA_MCAST_PROBES, /* u32 147 NDTPA_MCAST_PROBES, /* u32 */ 156 NDTPA_ANYCAST_DELAY, /* u64 148 NDTPA_ANYCAST_DELAY, /* u64, msecs */ 157 NDTPA_PROXY_DELAY, /* u64 149 NDTPA_PROXY_DELAY, /* u64, msecs */ 158 NDTPA_PROXY_QLEN, /* u32 150 NDTPA_PROXY_QLEN, /* u32 */ 159 NDTPA_LOCKTIME, /* u64 151 NDTPA_LOCKTIME, /* u64, msecs */ 160 NDTPA_QUEUE_LENBYTES, /* u32 152 NDTPA_QUEUE_LENBYTES, /* u32 */ 161 NDTPA_MCAST_REPROBES, /* u32 153 NDTPA_MCAST_REPROBES, /* u32 */ 162 NDTPA_PAD, 154 NDTPA_PAD, 163 NDTPA_INTERVAL_PROBE_TIME_MS, /* u64 << 164 __NDTPA_MAX 155 __NDTPA_MAX 165 }; 156 }; 166 #define NDTPA_MAX (__NDTPA_MAX - 1) 157 #define NDTPA_MAX (__NDTPA_MAX - 1) 167 158 168 struct ndtmsg { 159 struct ndtmsg { 169 __u8 ndtm_family; 160 __u8 ndtm_family; 170 __u8 ndtm_pad1; 161 __u8 ndtm_pad1; 171 __u16 ndtm_pad2; 162 __u16 ndtm_pad2; 172 }; 163 }; 173 164 174 struct ndt_config { 165 struct ndt_config { 175 __u16 ndtc_key_len; 166 __u16 ndtc_key_len; 176 __u16 ndtc_entry_size; 167 __u16 ndtc_entry_size; 177 __u32 ndtc_entries; 168 __u32 ndtc_entries; 178 __u32 ndtc_last_flush; 169 __u32 ndtc_last_flush; /* delta to now in msecs */ 179 __u32 ndtc_last_rand; 170 __u32 ndtc_last_rand; /* delta to now in msecs */ 180 __u32 ndtc_hash_rnd; 171 __u32 ndtc_hash_rnd; 181 __u32 ndtc_hash_mask; 172 __u32 ndtc_hash_mask; 182 __u32 ndtc_hash_chain_gc; 173 __u32 ndtc_hash_chain_gc; 183 __u32 ndtc_proxy_qlen; 174 __u32 ndtc_proxy_qlen; 184 }; 175 }; 185 176 186 enum { 177 enum { 187 NDTA_UNSPEC, 178 NDTA_UNSPEC, 188 NDTA_NAME, /* cha 179 NDTA_NAME, /* char *, unchangeable */ 189 NDTA_THRESH1, /* u32 180 NDTA_THRESH1, /* u32 */ 190 NDTA_THRESH2, /* u32 181 NDTA_THRESH2, /* u32 */ 191 NDTA_THRESH3, /* u32 182 NDTA_THRESH3, /* u32 */ 192 NDTA_CONFIG, /* str 183 NDTA_CONFIG, /* struct ndt_config, read-only */ 193 NDTA_PARMS, /* nes 184 NDTA_PARMS, /* nested TLV NDTPA_* */ 194 NDTA_STATS, /* str 185 NDTA_STATS, /* struct ndt_stats, read-only */ 195 NDTA_GC_INTERVAL, /* u64 186 NDTA_GC_INTERVAL, /* u64, msecs */ 196 NDTA_PAD, 187 NDTA_PAD, 197 __NDTA_MAX 188 __NDTA_MAX 198 }; 189 }; 199 #define NDTA_MAX (__NDTA_MAX - 1) 190 #define NDTA_MAX (__NDTA_MAX - 1) 200 191 201 /* FDB activity notification bits used in NFE 192 /* FDB activity notification bits used in NFEA_ACTIVITY_NOTIFY: 202 * - FDB_NOTIFY_BIT - notify on activity/expi 193 * - FDB_NOTIFY_BIT - notify on activity/expire for any entry 203 * - FDB_NOTIFY_INACTIVE_BIT - mark as inacti 194 * - FDB_NOTIFY_INACTIVE_BIT - mark as inactive to avoid multiple notifications 204 */ 195 */ 205 enum { 196 enum { 206 FDB_NOTIFY_BIT = (1 << 0), 197 FDB_NOTIFY_BIT = (1 << 0), 207 FDB_NOTIFY_INACTIVE_BIT = (1 << 1) 198 FDB_NOTIFY_INACTIVE_BIT = (1 << 1) 208 }; 199 }; 209 200 210 /* embedded into NDA_FDB_EXT_ATTRS: 201 /* embedded into NDA_FDB_EXT_ATTRS: 211 * [NDA_FDB_EXT_ATTRS] = { 202 * [NDA_FDB_EXT_ATTRS] = { 212 * [NFEA_ACTIVITY_NOTIFY] 203 * [NFEA_ACTIVITY_NOTIFY] 213 * ... 204 * ... 214 * } 205 * } 215 */ 206 */ 216 enum { 207 enum { 217 NFEA_UNSPEC, 208 NFEA_UNSPEC, 218 NFEA_ACTIVITY_NOTIFY, 209 NFEA_ACTIVITY_NOTIFY, 219 NFEA_DONT_REFRESH, 210 NFEA_DONT_REFRESH, 220 __NFEA_MAX 211 __NFEA_MAX 221 }; 212 }; 222 #define NFEA_MAX (__NFEA_MAX - 1) 213 #define NFEA_MAX (__NFEA_MAX - 1) 223 214 224 #endif 215 #endif 225 216
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.