]>
Commit | Line | Data |
---|---|---|
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 | ||
29 | /* | |
30 | * This header file contains the idea of a router and as such | |
31 | * owns data that is associated with a router from zebra's | |
32 | * perspective. | |
33 | */ | |
34 | ||
35 | struct zebra_router_table { | |
36 | RB_ENTRY(zebra_router_table) zebra_router_table_entry; | |
37 | ||
38 | uint32_t tableid; | |
39 | afi_t afi; | |
40 | safi_t safi; | |
41 | ns_id_t ns_id; | |
42 | ||
43 | struct route_table *table; | |
44 | }; | |
45 | RB_HEAD(zebra_router_table_head, zebra_router_table); | |
46 | RB_PROTOTYPE(zebra_router_table_head, zebra_router_table, | |
47 | zebra_router_table_entry, zebra_router_table_entry_compare) | |
48 | ||
e96ba9da DS |
49 | struct zebra_mlag_info { |
50 | /* Role this zebra router is playing */ | |
51 | enum mlag_role role; | |
52 | ||
53 | /* The peerlink being used for mlag */ | |
54 | char *peerlink; | |
55 | ifindex_t peerlink_ifindex; | |
56 | ||
57 | /* The system mac being used */ | |
58 | struct ethaddr mac; | |
59 | }; | |
60 | ||
89272910 | 61 | struct zebra_router { |
3801e764 DS |
62 | /* Thread master */ |
63 | struct thread_master *master; | |
89272910 | 64 | |
161e9ab7 DS |
65 | /* Lists of clients who have connected to us */ |
66 | struct list *client_list; | |
67 | ||
89272910 | 68 | struct zebra_router_table_head tables; |
7f0ea8a4 | 69 | |
89272910 DS |
70 | /* L3-VNI hash table (for EVPN). Only in default instance */ |
71 | struct hash *l3vni_table; | |
7f0ea8a4 DS |
72 | |
73 | struct hash *rules_hash; | |
62f20a52 DS |
74 | |
75 | struct hash *ipset_hash; | |
76 | ||
77 | struct hash *ipset_entry_hash; | |
78 | ||
79 | struct hash *iptable_hash; | |
a3be9fa1 DS |
80 | |
81 | #if defined(HAVE_RTADV) | |
82 | struct rtadv rtadv; | |
83 | #endif /* HAVE_RTADV */ | |
1485bbe7 DS |
84 | |
85 | /* A sequence number used for tracking routes */ | |
86 | _Atomic uint32_t sequence_num; | |
b3d43ff4 DS |
87 | |
88 | /* The default table used for this router */ | |
89 | uint32_t rtm_table_default; | |
489a9614 DS |
90 | |
91 | /* rib work queue */ | |
92 | #define ZEBRA_RIB_PROCESS_HOLD_TIME 10 | |
93 | #define ZEBRA_RIB_PROCESS_RETRY_TIME 1 | |
94 | struct work_queue *ribq; | |
ea45a4e7 DS |
95 | |
96 | /* Meta Queue Information */ | |
97 | struct meta_queue *mq; | |
e2353ec2 DS |
98 | |
99 | /* LSP work queue */ | |
100 | struct work_queue *lsp_process_q; | |
5ec5a716 DS |
101 | |
102 | #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 1000 | |
103 | _Atomic uint32_t packets_to_process; | |
e96ba9da DS |
104 | |
105 | /* Mlag information for the router */ | |
106 | struct zebra_mlag_info mlag_info; | |
89272910 DS |
107 | }; |
108 | ||
109 | extern struct zebra_router zrouter; | |
110 | ||
111 | extern void zebra_router_init(void); | |
112 | extern void zebra_router_terminate(void); | |
113 | ||
114 | extern struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf, | |
115 | uint32_t tableid, afi_t afi, | |
116 | safi_t safi); | |
117 | extern struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf, | |
118 | uint32_t tableid, afi_t afi, | |
119 | safi_t safi); | |
bd4fb615 DS |
120 | extern void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid, |
121 | afi_t afi, safi_t safi); | |
89272910 DS |
122 | |
123 | extern int zebra_router_config_write(struct vty *vty); | |
124 | ||
125 | extern unsigned long zebra_router_score_proto(uint8_t proto, | |
126 | unsigned short instance); | |
127 | extern void zebra_router_sweep_route(void); | |
ac5aa23f DS |
128 | |
129 | extern void zebra_router_show_table_summary(struct vty *vty); | |
1485bbe7 DS |
130 | |
131 | extern uint32_t zebra_router_get_next_sequence(void); | |
89272910 | 132 | #endif |