2 * EIGRP Definition of Data Structures.
3 * Copyright (C) 2013-2016
15 * This file is part of GNU Zebra.
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
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.
27 * You should have received a copy of the GNU General Public License
28 * along with GNU Zebra; see the file COPYING. If not, write to the Free
29 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #ifndef _ZEBRA_EIGRP_STRUCTS_H_
34 #define _ZEBRA_EIGRP_STRUCTS_H_
38 #include "eigrpd/eigrp_const.h"
39 #include "eigrpd/eigrp_macros.h"
41 /* EIGRP master for system wide configuration and variables. */
47 /* EIGRP thread master. */
48 struct thread_master
*master
;
50 /* Zebra interface list. */
53 /* EIGRP start time. */
56 /* Various EIGRP global configuration. */
59 #define EIGRP_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
76 u_int16_t AS
; /* Autonomous system number */
77 u_int16_t vrid
; /* Virtual Router ID */
78 u_char k_values
[6]; /*Array for K values configuration*/
79 u_char variance
; /*Metric variance multiplier*/
80 u_char max_paths
; /*Maximum allowed paths for 1 prefix*/
82 /*Name of this EIGRP instance*/
85 /* EIGRP Router ID. */
86 u_int32_t router_id
; /* Configured automatically. */
87 u_int32_t router_id_static
; /* Configured manually. */
89 struct list
*eiflist
; /* eigrp interfaces */
90 u_char passive_interface_default
; /* passive-interface default */
93 unsigned int maxsndbuflen
;
95 u_int32_t sequence_number
; /*Global EIGRP sequence number*/
98 struct list
*oi_write_q
;
101 struct thread
*t_write
;
102 struct thread
*t_read
;
103 struct thread
*t_distribute
; /* timer for distribute list */
105 struct route_table
*networks
; /* EIGRP config networks. */
107 struct list
*topology_table
;
109 u_int64_t serno
; /* Global serial number counter for topology entry changes*/
110 u_int64_t serno_last_update
; /* Highest serial number of information send by last update*/
111 struct list
*topology_changes_internalIPV4
;
112 struct list
*topology_changes_externalIPV4
;
115 struct eigrp_neighbor
*neighbor_self
;
117 /*Configured metric for redistributed routes*/
118 struct eigrp_metrics dmetric
[ZEBRA_ROUTE_MAX
+ 1];
119 int redistribute
; /* Num of redistributed protocols. */
122 struct access_list
*list
[EIGRP_FILTER_MAX
];
124 struct prefix_list
*prefix
[EIGRP_FILTER_MAX
];
126 struct route_map
*routemap
[EIGRP_FILTER_MAX
];
128 /* For redistribute route map. */
132 struct route_map
*map
;
135 } route_map
[ZEBRA_ROUTE_MAX
];
139 DECLARE_QOBJ_TYPE(eigrp
)
140 //------------------------------------------------------------------------------------------------------------------------------------------
142 /*EIGRP interface structure*/
143 struct eigrp_interface
145 /* This interface's parent eigrp instance. */
148 /* Interface data from zebra. */
149 struct interface
*ifp
;
151 /* Packet send buffer. */
152 struct eigrp_fifo
*obuf
; /* Output queue */
154 /* To which multicast groups do we currently belong? */
156 /* Configured varables. */
157 struct eigrp_if_params
*params
;
159 u_char multicast_memberships
;
161 /* EIGRP Network Type. */
164 struct prefix
*address
; /* Interface prefix */
165 struct connected
*connected
; /* Pointer to connected */
167 /* Neighbor information. */
168 struct list
*nbrs
; /* EIGRP Neighbor List */
171 struct thread
*t_hello
; /* timer */
172 struct thread
*t_distribute
; /* timer for distribute list */
176 /* Statistics fields. */
177 u_int32_t hello_in
; /* Hello message input count. */
178 u_int32_t update_in
; /* Update message input count. */
179 u_int32_t query_in
; /* Querry message input count. */
180 u_int32_t reply_in
; /* Reply message input count. */
181 u_int32_t hello_out
; /* Hello message output count. */
182 u_int32_t update_out
; /* Update message output count. */
183 u_int32_t query_out
; /* Query message output count. */
184 u_int32_t reply_out
; /* Reply message output count. */
185 u_int32_t siaQuery_in
;
186 u_int32_t siaQuery_out
;
187 u_int32_t siaReply_in
;
188 u_int32_t siaReply_out
;
192 u_int32_t crypt_seqnum
; /* Cryptographic Sequence Number */
195 struct access_list
*list
[EIGRP_FILTER_MAX
];
197 struct prefix_list
*prefix
[EIGRP_FILTER_MAX
];
199 struct route_map
*routemap
[EIGRP_FILTER_MAX
];
202 struct eigrp_if_params
204 DECLARE_IF_PARAM (u_char
, passive_interface
); /* EIGRP Interface is passive: no sending or receiving (no need to join multicast groups) */
205 DECLARE_IF_PARAM (u_int32_t
, v_hello
); /* Hello Interval */
206 DECLARE_IF_PARAM (u_int16_t
, v_wait
); /* Router Hold Time Interval */
207 DECLARE_IF_PARAM (u_char
, type
); /* type of interface */
208 DECLARE_IF_PARAM (u_int32_t
, bandwidth
);
209 DECLARE_IF_PARAM (u_int32_t
, delay
);
210 DECLARE_IF_PARAM (u_char
, reliability
);
211 DECLARE_IF_PARAM (u_char
, load
);
213 DECLARE_IF_PARAM (char *, auth_keychain
); /* Associated keychain with interface*/
214 DECLARE_IF_PARAM (int, auth_type
); /* EIGRP authentication type */
219 MEMBER_ALLROUTERS
= 0, MEMBER_MAX
,
224 struct eigrp_if_params
*def_params
;
225 struct route_table
*params
;
226 struct route_table
*eifs
;
227 unsigned int membership_counts
[MEMBER_MAX
]; /* multicast group refcnts */
230 //------------------------------------------------------------------------------------------------------------------------------------------
232 /* Determines if it is first or last packet
233 * when packet consists of multiple packet
234 * chunks because of many route TLV
235 * (all won't fit into one packet) */
236 enum Packet_part_type
238 EIGRP_PACKET_PART_NA
,
239 EIGRP_PACKET_PART_FIRST
,
240 EIGRP_PACKET_PART_LAST
243 /* Neighbor Data Structure */
244 struct eigrp_neighbor
246 /* This neighbor's parent eigrp interface. */
247 struct eigrp_interface
*ei
;
249 /* EIGRP neighbor Information */
250 u_char state
; /* neigbor status. */
252 u_int32_t recv_sequence_number
; /* Last received sequence Number. */
253 u_int32_t init_sequence_number
;
255 /*If packet is unacknowledged, we try to send it again 16 times*/
256 u_char retrans_counter
;
258 struct in_addr src
; /* Neighbor Src address. */
260 u_char os_rel_major
; // system version - just for show
261 u_char os_rel_minor
; // system version - just for show
262 u_char tlv_rel_major
; // eigrp version - tells us what TLV format to use
263 u_char tlv_rel_minor
; // eigrp version - tells us what TLV format to use
273 u_int16_t v_holddown
;
276 struct thread
*t_holddown
;
277 struct thread
*t_nbr_send_gr
; /* thread for sending multiple GR packet chunks */
279 struct eigrp_fifo
*retrans_queue
;
280 struct eigrp_fifo
*multicast_queue
;
282 u_int32_t crypt_seqnum
; /* Cryptographic Sequence Number. */
284 /* prefixes not received from neighbor during Graceful restart */
285 struct list
*nbr_gr_prefixes
;
286 /* prefixes not yet send to neighbor during Graceful restart */
287 struct list
*nbr_gr_prefixes_send
;
288 /* if packet is first or last during Graceful restart */
289 enum Packet_part_type nbr_gr_packet_type
;
292 //---------------------------------------------------------------------------------------------------------------------------------------------
297 struct eigrp_packet
*next
;
298 struct eigrp_packet
*previous
;
300 /* Pointer to data stream. */
303 /* IP destination address. */
306 /*Packet retransmission thread*/
307 struct thread
*t_retrans_timer
;
309 /*Packet retransmission counter*/
310 u_char retrans_counter
;
312 u_int32_t sequence_number
;
314 /* EIGRP packet length. */
320 struct eigrp_packet
*head
;
321 struct eigrp_packet
*tail
;
338 }__attribute__((packed
));
342 * Generic TLV type used for packet decoding.
344 * +-----+------------------+
346 * | Type| Len | Vector |
348 * +-----+------------------+
350 struct eigrp_tlv_hdr_type
355 }__attribute__((packed
));
357 struct TLV_Parameter_Type
368 }__attribute__((packed
));
370 struct TLV_MD5_Authentication_Type
375 u_int16_t auth_length
;
377 u_int32_t key_sequence
;
379 u_char digest
[EIGRP_AUTH_TYPE_MD5_LEN
];
381 }__attribute__((packed
));
383 struct TLV_SHA256_Authentication_Type
388 u_int16_t auth_length
;
390 u_int32_t key_sequence
;
392 u_char digest
[EIGRP_AUTH_TYPE_SHA256_LEN
];
394 }__attribute__((packed
));
396 struct TLV_Sequence_Type
401 struct in_addr
*addresses
;
402 }__attribute__((packed
));
404 struct TLV_Next_Multicast_Sequence
408 u_int32_t multicast_sequence
;
409 }__attribute__((packed
));
411 struct TLV_Software_Type
419 }__attribute__((packed
));
421 struct TLV_IPv4_Internal_type
425 struct in_addr forward
;
428 struct eigrp_metrics metric
;
430 u_char prefix_length
;
432 unsigned char destination_part
[4];
433 struct in_addr destination
;
434 }__attribute__((packed
));
436 struct TLV_IPv4_External_type
440 struct in_addr next_hop
;
441 struct in_addr originating_router
;
442 u_int32_t originating_as
;
443 u_int32_t administrative_tag
;
444 u_int32_t external_metric
;
446 u_char external_protocol
;
447 u_char external_flags
;
450 struct eigrp_metrics metric
;
452 u_char prefix_length
;
453 unsigned char destination_part
[4];
454 struct in_addr destination
;
455 }__attribute__((packed
));
457 /* EIGRP Peer Termination TLV - used for hard restart */
458 struct TLV_Peer_Termination_type
463 u_int32_t neighbor_ip
;
464 } __attribute__((packed
));
466 /* Who executed Graceful restart */
473 //---------------------------------------------------------------------------------------------------------------------------------------------
475 /* EIGRP Topology table node structure */
476 struct eigrp_prefix_entry
478 struct list
*entries
, *rij
;
479 u_int32_t fdistance
; // FD
480 u_int32_t rdistance
; // RD
481 u_int32_t distance
; // D
482 struct eigrp_metrics reported_metric
; // RD for sending
484 u_char nt
; //network type
485 u_char state
; //route fsm state
486 u_char af
; // address family
487 u_char req_action
; // required action
489 struct prefix_ipv4
*destination_ipv4
; // pointer to struct with ipv4 address
490 struct prefix_ipv6
*destination_ipv6
; // pointer to struct with ipv6 address
492 //If network type is REMOTE_EXTERNAL, pointer will have reference to its external TLV
493 struct TLV_IPv4_External_type
*extTLV
;
495 u_int64_t serno
; /*Serial number for this entry. Increased with each change of entry*/
498 /* EIGRP Topology table record structure */
499 struct eigrp_neighbor_entry
501 struct eigrp_prefix_entry
*prefix
;
502 u_int32_t reported_distance
; //distance reported by neighbor
503 u_int32_t distance
; //sum of reported distance and link cost to advertised neighbor
505 struct eigrp_metrics reported_metric
;
506 struct eigrp_metrics total_metric
;
508 struct eigrp_neighbor
*adv_router
; //ip address of advertising neighbor
509 u_char flags
; //used for marking successor and FS
511 struct eigrp_interface
*ei
; //pointer for case of connected entry
515 //---------------------------------------------------------------------------------------------------------------------------------------------
517 /* EIGRP Finite State Machine */
519 struct eigrp_fsm_action_message
521 u_char packet_type
; //UPDATE, QUERY, SIAQUERY, SIAREPLY
522 struct eigrp
*eigrp
; // which thread sent mesg
523 struct eigrp_neighbor
*adv_router
; //advertising neighbor
524 struct eigrp_neighbor_entry
*entry
;
525 struct eigrp_prefix_entry
*prefix
;
526 int data_type
; // internal or external tlv type
528 struct TLV_IPv4_External_type
*ipv4_ext_data
;
529 struct TLV_IPv4_Internal_type
*ipv4_int_type
;
533 #endif /* _ZEBRA_EIGRP_STRUCTURES_H_ */