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