1 /* Zebra Router header.
2 * Copyright (C) 2018 Cumulus Networks, Inc.
5 * This file is part of FRR.
7 * FRR is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * FRR is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with FRR; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __ZEBRA_ROUTER_H__
23 #define __ZEBRA_ROUTER_H__
27 #include "zebra/zebra_ns.h"
34 * This header file contains the idea of a router and as such
35 * owns data that is associated with a router from zebra's
39 struct zebra_router_table
{
40 RB_ENTRY(zebra_router_table
) zebra_router_table_entry
;
47 struct route_table
*table
;
49 RB_HEAD(zebra_router_table_head
, zebra_router_table
);
50 RB_PROTOTYPE(zebra_router_table_head
, zebra_router_table
,
51 zebra_router_table_entry
, zebra_router_table_entry_compare
)
53 struct zebra_mlag_info
{
54 /* Role this zebra router is playing */
57 /* The peerlink being used for mlag */
59 ifindex_t peerlink_ifindex
;
61 /* The system mac being used */
67 struct thread_master
*master
;
69 /* Lists of clients who have connected to us */
70 struct list
*client_list
;
72 struct zebra_router_table_head tables
;
74 /* L3-VNI hash table (for EVPN). Only in default instance */
75 struct hash
*l3vni_table
;
77 struct hash
*rules_hash
;
79 struct hash
*ipset_hash
;
81 struct hash
*ipset_entry_hash
;
83 struct hash
*iptable_hash
;
85 #if defined(HAVE_RTADV)
87 #endif /* HAVE_RTADV */
89 /* A sequence number used for tracking routes */
90 _Atomic
uint32_t sequence_num
;
93 #define ZEBRA_RIB_PROCESS_HOLD_TIME 10
94 #define ZEBRA_RIB_PROCESS_RETRY_TIME 1
95 struct work_queue
*ribq
;
97 /* Meta Queue Information */
98 struct meta_queue
*mq
;
101 struct work_queue
*lsp_process_q
;
103 #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000
104 _Atomic
uint32_t packets_to_process
;
106 /* Mlag information for the router */
107 struct zebra_mlag_info mlag_info
;
110 * The EVPN instance, if any
112 struct zebra_vrf
*evpn_vrf
;
114 uint32_t multipath_num
;
117 extern struct zebra_router zrouter
;
119 extern void zebra_router_init(void);
120 extern void zebra_router_terminate(void);
122 extern struct route_table
*zebra_router_find_table(struct zebra_vrf
*zvrf
,
123 uint32_t tableid
, afi_t afi
,
125 extern struct route_table
*zebra_router_get_table(struct zebra_vrf
*zvrf
,
126 uint32_t tableid
, afi_t afi
,
128 extern void zebra_router_release_table(struct zebra_vrf
*zvrf
, uint32_t tableid
,
129 afi_t afi
, safi_t safi
);
131 extern int zebra_router_config_write(struct vty
*vty
);
133 extern void zebra_router_sweep_route(void);
135 extern void zebra_router_show_table_summary(struct vty
*vty
);
137 extern uint32_t zebra_router_get_next_sequence(void);
139 static inline vrf_id_t
zebra_vrf_get_evpn_id(void)
141 return zrouter
.evpn_vrf
? zvrf_id(zrouter
.evpn_vrf
) : VRF_DEFAULT
;
143 static inline struct zebra_vrf
*zebra_vrf_get_evpn(void)
145 return zrouter
.evpn_vrf
? zrouter
.evpn_vrf
146 : zebra_vrf_lookup_by_id(VRF_DEFAULT
);