]> git.proxmox.com Git - mirror_frr.git/blob - eigrpd/eigrp_const.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / eigrpd / eigrp_const.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * EIGRP Definition of Constants.
4 * Copyright (C) 2013-2016
5 * Authors:
6 * Donnie Savage
7 * Jan Janovic
8 * Matej Perina
9 * Peter Orsag
10 * Peter Paluch
11 * Frantisek Gazo
12 * Tomas Hvorkovy
13 * Martin Kontsek
14 * Lukas Koribsky
15 */
16
17 #ifndef _ZEBRA_EIGRP_CONST_H_
18 #define _ZEBRA_EIGRP_CONST_H_
19
20 #define EIGRP_NEIGHBOR_DOWN 0
21 #define EIGRP_NEIGHBOR_PENDING 1
22 #define EIGRP_NEIGHBOR_UP 2
23 #define EIGRP_NEIGHBOR_STATE_MAX 3
24
25 /*Packet requiring ack will be retransmitted again after this time*/
26 #define EIGRP_PACKET_RETRANS_TIME 2 /* in seconds */
27 #define EIGRP_PACKET_RETRANS_MAX 16 /* number of retrans attempts */
28 #define PLAINTEXT_LENGTH 81
29
30 /*Metric variance multiplier*/
31 #define EIGRP_VARIANCE_DEFAULT 1
32 #define EIGRP_MAX_PATHS_DEFAULT 4
33
34 /* Return values of functions involved in packet verification */
35 #define MSG_OK 0
36 #define MSG_NG 1
37
38 #define EIGRP_HEADER_VERSION 2
39
40 /* Default protocol, port number. */
41 #ifndef IPPROTO_EIGRPIGP
42 #define IPPROTO_EIGRPIGP 88
43 #endif /* IPPROTO_EIGRPIGP */
44
45 #define EIGRP_AUTH_MD5_TLV_SIZE 40
46 #define EIGRP_AUTH_SHA256_TLV_SIZE 56
47
48 /*Cisco routers use only first 44 bytes of basic hello for their MD5
49 * calculations*/
50 #define EIGRP_MD5_BASIC_COMPUTE 44
51 #define EIGRP_MD5_UPDATE_INIT_COMPUTE 40
52
53 #define EIGRP_AUTH_BASIC_HELLO_FLAG 0x01
54 #define EIGRP_AUTH_TID_HELLO_FLAG 0x02
55 #define EIGRP_AUTH_UPDATE_INIT_FLAG 0x04
56 #define EIGRP_AUTH_UPDATE_FLAG 0x08
57 #define EIGRP_AUTH_EXTRA_SALT_FLAG 0x10
58
59 #define EIGRP_NEXT_SEQUENCE_TLV_SIZE 8
60
61 /* IP TTL for EIGRP protocol. */
62 #define EIGRP_IP_TTL 1
63
64 /* VTY port number. */
65 #define EIGRP_VTY_PORT 2613
66
67 /* Default configuration file name for eigrp. */
68 #define EIGRP_DEFAULT_CONFIG "eigrpd.conf"
69
70 #define EIGRP_HELLO_INTERVAL_DEFAULT 5
71 #define EIGRP_HOLD_INTERVAL_DEFAULT 15
72 #define EIGRP_BANDWIDTH_DEFAULT 100000
73 #define EIGRP_DELAY_DEFAULT 10
74 #define EIGRP_RELIABILITY_DEFAULT 255
75 #define EIGRP_LOAD_DEFAULT 1
76
77 #define EIGRP_MULTICAST_ADDRESS 0xe000000A /*224.0.0.10*/
78
79 #define EIGRP_MAX_METRIC 0xffffffffU /*4294967295*/
80 enum metric_change { METRIC_DECREASE, METRIC_SAME, METRIC_INCREASE };
81
82 #define DEFAULT_ROUTE ZEBRA_ROUTE_MAX
83 #define DEFAULT_ROUTE_TYPE(T) ((T) == DEFAULT_ROUTE)
84
85 #define INTERFACE_DOWN_BY_ZEBRA 1
86 #define INTERFACE_DOWN_BY_VTY 2
87 #define INTERFACE_DOWN_BY_FINAL 3
88
89 #define EIGRP_HELLO_NORMAL 0x00
90 #define EIGRP_HELLO_GRACEFUL_SHUTDOWN 0x01
91 #define EIGRP_HELLO_ADD_SEQUENCE 0x02
92 #define EIGRP_HELLO_GRACEFUL_SHUTDOWN_NBR 0x04
93
94 /* EIGRP Network Type. */
95 #define EIGRP_IFTYPE_NONE 0
96 #define EIGRP_IFTYPE_POINTOPOINT 1
97 #define EIGRP_IFTYPE_BROADCAST 2
98 #define EIGRP_IFTYPE_LOOPBACK 3
99 #define EIGRP_IFTYPE_MAX 4
100
101 #define EIGRP_IF_ACTIVE 0
102 #define EIGRP_IF_PASSIVE 1
103
104 /* EIGRP TT destination type */
105 #define EIGRP_TOPOLOGY_TYPE_CONNECTED 0 // Connected network
106 #define EIGRP_TOPOLOGY_TYPE_REMOTE 1 // Remote internal network
107 #define EIGRP_TOPOLOGY_TYPE_REMOTE_EXTERNAL 2 // Remote external network
108
109 /*EIGRP TT entry flags*/
110 #define EIGRP_ROUTE_DESCRIPTOR_SUCCESSOR_FLAG (1 << 0)
111 #define EIGRP_ROUTE_DESCRIPTOR_FSUCCESSOR_FLAG (1 << 1)
112 #define EIGRP_ROUTE_DESCRIPTOR_INTABLE_FLAG (1 << 2)
113 #define EIGRP_ROUTE_DESCRIPTOR_EXTERNAL_FLAG (1 << 3)
114
115 /*EIGRP FSM state count, event count*/
116 #define EIGRP_FSM_STATE_MAX 5
117 #define EIGRP_FSM_EVENT_MAX 16
118
119 /*EEGRP FSM states*/
120 enum eigrp_fsm_states {
121 EIGRP_FSM_STATE_PASSIVE,
122 EIGRP_FSM_STATE_ACTIVE_0,
123 EIGRP_FSM_STATE_ACTIVE_1,
124 EIGRP_FSM_STATE_ACTIVE_2,
125 EIGRP_FSM_STATE_ACTIVE_3,
126 };
127
128 /*EIGRP FSM events return values*/
129 #define EIGRP_FSM_NEED_UPDATE 1
130 #define EIGRP_FSM_NEED_QUERY 2
131
132 /*EIGRP FSM events*/
133 enum eigrp_fsm_events {
134 /*
135 * Input event other than query from succ,
136 * FC is not satisfied
137 */
138 EIGRP_FSM_EVENT_NQ_FCN,
139
140 /* last reply, FD is reset */
141 EIGRP_FSM_EVENT_LR,
142
143 /* Query from succ, FC not satisfied */
144 EIGRP_FSM_EVENT_Q_FCN,
145
146 /* last reply, FC satisifed with current value of FDij */
147 EIGRP_FSM_EVENT_LR_FCS,
148
149 /* distance increase while in a active state */
150 EIGRP_FSM_EVENT_DINC,
151
152 /* Query from succ while in active state */
153 EIGRP_FSM_EVENT_QACT,
154
155 /* last reply, FC not satisfied */
156 EIGRP_FSM_EVENT_LR_FCN,
157
158 /*
159 * state not changed
160 * usually by receiving not last reply
161 */
162 EIGRP_FSM_KEEP_STATE,
163 };
164
165 /**
166 * External routes originate from some other protocol - these are them
167 */
168 #define NULL_PROTID 0 /*!< unknown protocol */
169 #define IGRP_PROTID 1 /*!< IGRP.. whos your daddy! */
170 #define EIGRP_PROTID 2 /*!< EIGRP - Just flat out the best */
171 #define STATIC_PROTID 3 /*!< Staticly configured source */
172 #define RIP_PROTID 4 /*!< Routing Information Protocol */
173 #define HELLO_PROTID 5 /*!< Hello? RFC-891 you there? */
174 #define OSPF_PROTID 6 /*!< OSPF - Open Shortest Path First */
175 #define ISIS_PROTID 7 /*!< Intermediate System To Intermediate System */
176 #define EGP_PROTID 8 /*!< Exterior Gateway Protocol */
177 #define BGP_PROTID 9 /*!< Border Gateway Protocol */
178 #define IDRP_PROTID 10 /*!< InterDomain Routing Protocol */
179 #define CONN_PROTID 11 /*!< Connected source */
180
181 /*
182 * metric k-value defaults
183 */
184 #define EIGRP_K1_DEFAULT 1 //!< unweighed inverse bandwidth
185 #define EIGRP_K2_DEFAULT 0 //!< no loading term
186 #define EIGRP_K3_DEFAULT 1 //!< unweighted delay
187 #define EIGRP_K4_DEFAULT 0 //!< no reliability term
188 #define EIGRP_K5_DEFAULT 0 //!< no reliability term
189 #define EIGRP_K6_DEFAULT 0 //!< do not add in extended metrics
190
191 /*
192 * EIGRP Fixed header
193 */
194 #define EIGRP_HEADER_LEN 20U
195 #define EIGRP_PACKET_MAX_LEN 65535U /* includes IP Header size. */
196
197 #define EIGRP_TLV_HDR_LENGTH 4
198
199 /**
200 * EIGRP Packet Opcodes
201 */
202 #define EIGRP_OPC_UPDATE 1 /*!< packet containing routing information */
203 #define EIGRP_OPC_REQUEST 2 /*!< sent to request one or more routes */
204 #define EIGRP_OPC_QUERY 3 /*!< sent when a routing is in active start */
205 #define EIGRP_OPC_REPLY 4 /*!< sent in response to a query */
206 #define EIGRP_OPC_HELLO 5 /*!< sent to maintain a peering session */
207 #define EIGRP_OPC_IPXSAP 6 /*!< IPX SAP information */
208 #define EIGRP_OPC_PROBE 7 /*!< for test purposes */
209 #define EIGRP_OPC_ACK 8 /*!< acknowledge */
210 #define EIGRP_OPC_SIAQUERY 10 /*!< QUERY - with relaxed restrictions */
211 #define EIGRP_OPC_SIAREPLY 11 /*!< REPLY - may contain old routing information */
212
213 /**
214 * EIGRP TLV Range definitions
215 * PDM TLV Range
216 * General 0x0000
217 * IPv4 0x0100 ** TLVs for one and all
218 * ATALK 0x0200 ** legacy
219 * IPX 0x0300 ** discontinued
220 * IPv6 0x0400 ** legacy
221 * Multiprotocol 0x0600 ** wide metrics
222 * MultiTopology 0x00f0 ** deprecated
223 */
224 #define EIGRP_TLV_RANGEMASK 0xfff0 /*!< should be 0xff00 - opps */
225 #define EIGRP_TLV_GENERAL 0x0000
226
227 /**
228 * 1.2 TLV Definitions ** legacy
229 * These are considered legacyu and are only used for backward compability with
230 * older Cisco Routers. They should not be your first choice for packet codings
231 */
232 #define EIGRP_TLV_IPv4 0x0100 /*!< Classic IPv4 TLV encoding */
233 #define EIGRP_TLV_ATALK 0x0200 /*!< Classic Appletalk TLV encoding*/
234 #define EIGRP_TLV_IPX 0x0300 /*!< Classic IPX TLV encoding */
235 #define EIGRP_TLV_IPv6 0x0400 /*!< Classic IPv6 TLV encoding */
236
237 /**
238 * 2.0 Multi-Protocol TLV Definitions
239 * These are the current packet formats and should be used for packets
240 */
241 #define EIGRP_TLV_MP 0x0600 /*!< Non-PDM specific encoding */
242
243 /**
244 * TLV type definitions. Generic (protocol-independent) TLV types are
245 * defined here. Protocol-specific ones are defined elsewhere.
246 */
247 #define EIGRP_TLV_PARAMETER (EIGRP_TLV_GENERAL | 0x0001) /*!< eigrp parameters */
248 #define EIGRP_TLV_PARAMETER_LEN (12U)
249 #define EIGRP_TLV_AUTH (EIGRP_TLV_GENERAL | 0x0002) /*!< authentication */
250 #define EIGRP_TLV_SEQ (EIGRP_TLV_GENERAL | 0x0003) /*!< sequenced packet */
251 #define EIGRP_TLV_SEQ_BASE_LEN (5U)
252 #define EIGRP_TLV_SW_VERSION (EIGRP_TLV_GENERAL | 0x0004) /*!< software version */
253 #define EIGRP_TLV_SW_VERSION_LEN (8U)
254 #define EIGRP_TLV_NEXT_MCAST_SEQ (EIGRP_TLV_GENERAL | 0x0005) /*!< sequence number */
255 #define EIGRP_TLV_PEER_TERMINATION (EIGRP_TLV_GENERAL | 0x0007) /*!< peer termination */
256 #define EIGRP_TLV_PEER_TERMINATION_LEN (9U)
257 #define EIGRP_TLV_PEER_TIDLIST (EIGRP_TLV_GENERAL | 0x0008) /*!< peer sub-topology list */
258
259 /* Older cisco routers send TIDLIST value wrong, adding for backwards
260 * compatabily */
261 #define EIGRP_TLV_PEER_MTRLIST (EIGRP_TLV_GENERAL | 0x00f5)
262
263 /**
264 * Route Based TLVs
265 */
266 #define EIGRP_TLV_REQUEST 0x0001
267 #define EIGRP_TLV_INTERNAL 0x0002
268 #define EIGRP_TLV_EXTERNAL 0x0003
269 #define EIGRP_TLV_COMMUNITY 0x0004
270 #define EIGRP_TLV_TYPEMASK 0x000f
271
272 #define EIGRP_TLV_IPv4_REQ (EIGRP_TLV_IPv4 | EIGRP_TLV_REQUEST)
273 #define EIGRP_TLV_IPv4_INT (EIGRP_TLV_IPv4 | EIGRP_TLV_INTERNAL)
274 #define EIGRP_TLV_IPv4_EXT (EIGRP_TLV_IPv4 | EIGRP_TLV_EXTERNAL)
275 #define EIGRP_TLV_IPv4_COM (EIGRP_TLV_IPv4 | EIGRP_TLV_COMMUNITY)
276
277 #define EIGRP_TLV_IPV4_SIZE_GRT_24_BIT 0x001D
278 #define EIGRP_TLV_IPV4_SIZE_GRT_16_BIT 0x001C
279 #define EIGRP_TLV_IPV4_SIZE_GRT_8_BIT 0x001B
280 #define EIGRP_TLV_IPV4_SIZE_GRT_0_BIT 0x001A
281 #define EIGRP_TLV_MAX_IPV4_BYTE EIGRP_TLV_IPV4_SIZE_GRT_24_BIT
282
283 /* max number of TLV IPv4 prefixes in packet */
284 #define EIGRP_TLV_MAX_IPv4 25
285
286 /**
287 *
288 * extdata flag field definitions
289 */
290 #define EIGRP_OPAQUE_EXT 0x01 /*!< Route is external */
291 #define EIGRP_OPAQUE_CD 0x02 /*!< Candidate default route */
292
293 /**
294 * Address-Family types are taken from:
295 * http://www.iana.org/assignments/address-family-numbers
296 * to provide a standards based exchange of AFI information between
297 * EIGRP routers.
298 */
299 #define EIGRP_AF_IPv4 1 /*!< IPv4 (IP version 4) */
300 #define EIGRP_AF_IPv6 2 /*!< IPv6 (IP version 6) */
301 #define EIGRP_AF_IPX 11 /*!< IPX */
302 #define EIGRP_AF_ATALK 12 /*!< Appletalk */
303 #define EIGRP_SF_COMMON 16384 /*!< Cisco Service Family */
304 #define EIGRP_SF_IPv4 16385 /*!< Cisco IPv4 Service Family */
305 #define EIGRP_SF_IPv6 16386 /*!< Cisco IPv6 Service Family */
306
307 /**
308 * Authentication types supported by EIGRP
309 */
310 #define EIGRP_AUTH_TYPE_NONE 0
311 #define EIGRP_AUTH_TYPE_TEXT 1
312 #define EIGRP_AUTH_TYPE_MD5 2
313 #define EIGRP_AUTH_TYPE_MD5_LEN 16
314 #define EIGRP_AUTH_TYPE_SHA256 3
315 #define EIGRP_AUTH_TYPE_SHA256_LEN 32
316
317 /**
318 * opaque flag field definitions
319 */
320 #define EIGRP_OPAQUE_SRCWD 0x01 /*!< Route Source Withdraw */
321 #define EIGRP_OPAQUE_ACTIVE 0x04 /*!< Route is currently in active state */
322 #define EIGRP_OPAQUE_REPL 0x08 /*!< Route is replicated from different tableid */
323
324 /**
325 * pak flag bit field definitions - 0 (none)-7 source priority
326 */
327 #define EIGRP_PRIV_DEFAULT 0x00 /* 0 (none)-7 source priority */
328 #define EIGRP_PRIV_LOW 0x01
329 #define EIGRP_PRIV_MEDIUM 0x04
330 #define EIGRP_PRIV_HIGH 0x07
331
332 /*
333 * Init bit definition. First unicast transmitted Update has this
334 * bit set in the flags field of the fixed header. It tells the neighbor
335 * to down-load his topology table.
336 */
337 #define EIGRP_INIT_FLAG 0x01
338
339 /*
340 * CR bit (Conditionally Received) definition in flags field on header. Any
341 * packets with the CR-bit set can be accepted by an EIGRP speaker if and
342 * only if a previous Hello was received with the SEQUENCE_TYPE TLV present.
343 *
344 * This allows multicasts to be transmitted in order and reliably at the
345 * same time as unicasts are transmitted.
346 */
347 #define EIGRP_CR_FLAG 0x02
348
349 /*
350 * RS bit. The Restart flag is set in the hello and the init
351 * update packets during the nsf signaling period. A nsf-aware
352 * router looks at the RS flag to detect if a peer is restarting
353 * and maintain the adjacency. A restarting router looks at
354 * this flag to determine if the peer is helping out with the restart.
355 */
356 #define EIGRP_RS_FLAG 0x04
357
358 /*
359 * EOT bit. The End-of-Table flag marks the end of the start-up updates
360 * sent to a new peer. A nsf restarting router looks at this flag to
361 * determine if it has finished receiving the start-up updates from all
362 * peers. A nsf-aware router waits for this flag before cleaning up
363 * the stale routes from the restarting peer.
364 */
365 #define EIGRP_EOT_FLAG 0x08
366
367 /**
368 * EIGRP Virtual Router ID
369 *
370 * Define values to deal with EIGRP virtual router ids. Virtual
371 * router IDs are stored in the upper short of the EIGRP fixed packet
372 * header. The lower short of the packet header continues to be used
373 * as asystem number.
374 *
375 * Virtual Router IDs are PDM-independent. All PDMs will use
376 * VRID_BASE to indicate the 'base' or 'legacy' EIGRP instance.
377 * All PDMs need to initialize their vrid to VRID_BASE for compatibility
378 * with legacy routers.
379 * Once IPv6 supports 'MTR Multicast', it will use the same VRID as
380 * IPv4. No current plans to support VRIDs on IPX. :)
381 * Initial usage of VRID is to signal usage of Multicast topology for
382 * MTR.
383 *
384 * VRID_MCAST is a well known constant, other VRIDs will be determined
385 * programmatic...
386 *
387 * With the addition of SAF the VRID space has been divided into two
388 * segments 0x0000-0x7fff is for EIGRP and vNets, 0x8000-0xffff is
389 * for saf and its associated vNets.
390 */
391 #define EIGRP_VRID_MASK 0x8001
392 #define EIGRP_VRID_AF_BASE 0x0000
393 #define EIGRP_VRID_MCAST_BASE 0x0001
394 #define EIGRP_VRID_SF_BASE 0x8000
395
396 /* Extended Attributes for a destination */
397 #define EIGRP_ATTR_HDRLEN (2)
398 #define EIGRP_ATTR_MAXDATA (512)
399
400 #define EIGRP_ATTR_NOOP 0 /*!< No-Op used as offset padding */
401 #define EIGRP_ATTR_SCALED 1 /*!< Scaled metric values */
402 #define EIGRP_ATTR_TAG 2 /*!< Tag assigned by Admin for dest */
403 #define EIGRP_ATTR_COMM 3 /*!< Community attribute for dest */
404 #define EIGRP_ATTR_JITTER 4 /*!< Variation in path delay */
405 #define EIGRP_ATTR_QENERGY 5 /*!< Non-Active energy usage along path */
406 #define EIGRP_ATTR_ENERGY 6 /*!< Active energy usage along path */
407
408 /*
409 * Begin EIGRP-BGP interoperability communities
410 */
411 #define EIGRP_EXTCOMM_SOO_ASFMT 0x0003 /* Site-of-Origin, BGP AS format */
412 #define EIGRP_EXTCOMM_SOO_ADRFMT 0x0103 /* Site-of-Origin, BGP/EIGRP addr format */
413
414 /*
415 * EIGRP Specific communities
416 */
417 #define EIGRP_EXTCOMM_EIGRP 0x8800 /* EIGRP route information appended*/
418 #define EIGRP_EXTCOMM_DAD 0x8801 /* EIGRP AS + Delay */
419 #define EIGRP_EXTCOMM_VRHB 0x8802 /* EIGRP Vector: Reliability + Hop + BW */
420 #define EIGRP_EXTCOMM_SRLM 0x8803 /* EIGRP System: Reserve +Load + MTU */
421 #define EIGRP_EXTCOMM_SAR 0x8804 /* EIGRP System: Remote AS + Remote ID */
422 #define EIGRP_EXTCOMM_RPM 0x8805 /* EIGRP Remote: Protocol + Metric */
423 #define EIGRP_EXTCOMM_VRR 0x8806 /* EIGRP Vecmet: Rsvd + (internal) Routerid */
424
425 /*
426 * EIGRP Filter constants
427 */
428 #define EIGRP_FILTER_IN 0
429 #define EIGRP_FILTER_OUT 1
430 #define EIGRP_FILTER_MAX 2
431
432 /*
433 * EIGRP Filter constants
434 */
435 #define EIGRP_HSROLE_DEFAULT EIGRP_HSROLE_SPOKE
436 #define EIGRP_HSROLE_HUB 0x01
437 #define EIGRP_HSROLE_SPOKE 0x02
438
439 #endif /* _ZEBRA_EIGRP_CONST_H_ */