]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_router.h
Merge pull request #4414 from opensourcerouting/feature/fix-isis-warnings
[mirror_frr.git] / zebra / zebra_router.h
CommitLineData
89272910
DS
1/* Zebra Router header.
2 * Copyright (C) 2018 Cumulus Networks, Inc.
3 * Donald Sharp
4 *
5 * This file is part of FRR.
6 *
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
10 * later version.
11 *
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.
16 *
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
20 * 02111-1307, USA.
21 */
22#ifndef __ZEBRA_ROUTER_H__
23#define __ZEBRA_ROUTER_H__
24
e96ba9da
DS
25#include "lib/mlag.h"
26
89272910
DS
27#include "zebra/zebra_ns.h"
28
51e94aa7
EDP
29#ifdef __cplusplus
30extern "C" {
31#endif
32
89272910
DS
33/*
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
36 * perspective.
37 */
38
39struct zebra_router_table {
40 RB_ENTRY(zebra_router_table) zebra_router_table_entry;
41
42 uint32_t tableid;
43 afi_t afi;
44 safi_t safi;
45 ns_id_t ns_id;
46
47 struct route_table *table;
48};
49RB_HEAD(zebra_router_table_head, zebra_router_table);
50RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
51 zebra_router_table_entry, zebra_router_table_entry_compare)
52
e96ba9da
DS
53struct zebra_mlag_info {
54 /* Role this zebra router is playing */
55 enum mlag_role role;
56
57 /* The peerlink being used for mlag */
58 char *peerlink;
59 ifindex_t peerlink_ifindex;
60
61 /* The system mac being used */
62 struct ethaddr mac;
63};
64
89272910 65struct zebra_router {
3801e764
DS
66 /* Thread master */
67 struct thread_master *master;
89272910 68
161e9ab7
DS
69 /* Lists of clients who have connected to us */
70 struct list *client_list;
71
89272910 72 struct zebra_router_table_head tables;
7f0ea8a4 73
89272910
DS
74 /* L3-VNI hash table (for EVPN). Only in default instance */
75 struct hash *l3vni_table;
7f0ea8a4
DS
76
77 struct hash *rules_hash;
62f20a52
DS
78
79 struct hash *ipset_hash;
80
81 struct hash *ipset_entry_hash;
82
83 struct hash *iptable_hash;
a3be9fa1 84
3ce3185a
DS
85#if defined(HAVE_RTADV)
86 struct rtadv rtadv;
87#endif /* HAVE_RTADV */
88
1485bbe7
DS
89 /* A sequence number used for tracking routes */
90 _Atomic uint32_t sequence_num;
b3d43ff4 91
489a9614
DS
92 /* rib work queue */
93#define ZEBRA_RIB_PROCESS_HOLD_TIME 10
94#define ZEBRA_RIB_PROCESS_RETRY_TIME 1
95 struct work_queue *ribq;
ea45a4e7
DS
96
97 /* Meta Queue Information */
98 struct meta_queue *mq;
e2353ec2
DS
99
100 /* LSP work queue */
101 struct work_queue *lsp_process_q;
5ec5a716
DS
102
103#define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000
104 _Atomic uint32_t packets_to_process;
e96ba9da
DS
105
106 /* Mlag information for the router */
107 struct zebra_mlag_info mlag_info;
0fb2ad05
T
108
109 /*
110 * The EVPN instance, if any
111 */
112 struct zebra_vrf *evpn_vrf;
b3f2b590
DS
113
114 uint32_t multipath_num;
d4644d41
DS
115
116 /*
117 * Time for when we sweep the rib from old routes
118 */
119 time_t startup_time;
89272910
DS
120};
121
d4644d41
DS
122#define GRACEFUL_RESTART_TIME 60
123
89272910
DS
124extern struct zebra_router zrouter;
125
126extern void zebra_router_init(void);
127extern void zebra_router_terminate(void);
128
129extern struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf,
130 uint32_t tableid, afi_t afi,
131 safi_t safi);
132extern struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
133 uint32_t tableid, afi_t afi,
134 safi_t safi);
bd4fb615
DS
135extern void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid,
136 afi_t afi, safi_t safi);
89272910
DS
137
138extern int zebra_router_config_write(struct vty *vty);
139
89272910 140extern void zebra_router_sweep_route(void);
ac5aa23f
DS
141
142extern void zebra_router_show_table_summary(struct vty *vty);
1485bbe7
DS
143
144extern uint32_t zebra_router_get_next_sequence(void);
0fb2ad05
T
145
146static inline vrf_id_t zebra_vrf_get_evpn_id(void)
147{
148 return zrouter.evpn_vrf ? zvrf_id(zrouter.evpn_vrf) : VRF_DEFAULT;
149}
150static inline struct zebra_vrf *zebra_vrf_get_evpn(void)
151{
152 return zrouter.evpn_vrf ? zrouter.evpn_vrf
153 : zebra_vrf_lookup_by_id(VRF_DEFAULT);
154}
d074383c 155
51e94aa7
EDP
156#ifdef __cplusplus
157}
158#endif
159
89272910 160#endif