]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_top.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ospf6d / ospf6_top.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/*
508e53e2 3 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 4 */
5
6#ifndef OSPF6_TOP_H
7#define OSPF6_TOP_H
8
ae19c240 9#include "qobj.h"
718e3744 10#include "routemap.h"
78c6ba61
CS
11struct ospf6_master {
12
beadc736 13 /* OSPFv3 instance. */
14 struct list *ospf6;
15 /* OSPFv3 thread master. */
16 struct thread_master *master;
78c6ba61
CS
17};
18
c572fbfe 19/* ospf6->config_flags */
5b5d66c4
RW
20enum { OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0),
21 OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1),
22 OSPF6_SEND_EXTRA_DATA_TO_ZEBRA = (1 << 2),
c572fbfe
DL
23};
24
2f43e34d
MR
25/* For processing route-map change update in the callback */
26#define OSPF6_IS_RMAP_CHANGED 0x01
a069482f
K
27struct ospf6_redist {
28 uint8_t instance;
b19502d3 29
2f43e34d 30 uint8_t flag;
b19502d3
YR
31 /* Redistribute metric info. */
32 struct {
33 int type; /* External metric type (E1 or E2). */
34 int value; /* Value for static metric (24-bit).
35 * -1 means metric value is not set.
36 */
37 } dmetric;
38
a069482f
K
39 /* For redistribute route map. */
40 struct {
41 char *name;
42 struct route_map *map;
43 } route_map;
44#define ROUTEMAP_NAME(R) (R->route_map.name)
45#define ROUTEMAP(R) (R->route_map.map)
46};
47
71165098
RW
48struct ospf6_gr_info {
49 bool restart_support;
50 bool restart_in_progress;
51 bool prepare_in_progress;
52 bool finishing_restart;
53 uint32_t grace_period;
54 struct thread *t_grace_period;
55};
56
91c169f7 57struct ospf6_gr_helper {
17be83bf 58 /* Graceful restart Helper supported configs*/
91c169f7 59 /* Supported grace interval*/
60 uint32_t supported_grace_time;
61
62 /* Helper support
63 * Supported : True
64 * Not Supported : False.
65 */
66 bool is_helper_supported;
67
68 /* Support for strict LSA check.
69 * if it is set,Helper aborted
70 * upon a TOPO change.
71 */
72 bool strict_lsa_check;
73
74 /* Support as HELPER only for
75 * planned restarts.
76 */
77 bool only_planned_restart;
78
79 /* This list contains the advertisement
80 * routerids for which Helper support is
81 * enabled.
82 */
83 struct hash *enable_rtr_list;
84
85 /* HELPER for number of active
86 * RESTARTERs.
87 */
88 int active_restarter_cnt;
89
90 /* last HELPER exit reason */
91 uint32_t last_exit_reason;
92};
93
508e53e2 94/* OSPFv3 top level data structure */
d62a17ae 95struct ospf6 {
cf319495
DS
96 /* The relevant vrf_id */
97 vrf_id_t vrf_id;
98
7df1f362
K
99 char *name; /* VRF name */
100
d62a17ae 101 /* my router id */
858f9c08 102 in_addr_t router_id;
718e3744 103
d62a17ae 104 /* static router id */
858f9c08 105 in_addr_t router_id_static;
c8a440ec 106
3c5122c5 107 in_addr_t router_id_zebra;
d6927cf3 108
d62a17ae 109 /* start time */
110 struct timeval starttime;
718e3744 111
d62a17ae 112 /* list of areas */
113 struct list *area_list;
114 struct ospf6_area *backbone;
718e3744 115
d62a17ae 116 /* AS scope link state database */
117 struct ospf6_lsdb *lsdb;
118 struct ospf6_lsdb *lsdb_self;
718e3744 119
d62a17ae 120 struct ospf6_route_table *route_table;
121 struct ospf6_route_table *brouter_table;
508e53e2 122
d62a17ae 123 struct ospf6_route_table *external_table;
4dc43886 124#define OSPF6_EXT_INIT_LS_ID 1
d7c0a89a 125 uint32_t external_id;
508e53e2 126
a069482f 127 /* OSPF6 redistribute configuration */
b19502d3 128 struct list *redist[ZEBRA_ROUTE_MAX + 1];
718e3744 129
6735622c
RW
130 /* NSSA default-information-originate */
131 struct {
132 /* # of NSSA areas requesting default information */
133 uint16_t refcnt;
134
135 /*
136 * Whether a default route known through non-OSPF protocol is
137 * present in the RIB.
138 */
139 bool status;
140 } nssa_default_import_check;
141
d7c0a89a 142 uint8_t flag;
ad500b22
K
143#define OSPF6_FLAG_ABR 0x04
144#define OSPF6_FLAG_ASBR 0x08
718e3744 145
b8212e03
YR
146 int redistribute; /* Num of redistributed protocols. */
147
c572fbfe 148 /* Configuration bitmask, refer to enum above */
d7c0a89a 149 uint8_t config_flags;
b19502d3
YR
150 int default_originate; /* Default information originate. */
151#define DEFAULT_ORIGINATE_NONE 0
152#define DEFAULT_ORIGINATE_ZEBRA 1
153#define DEFAULT_ORIGINATE_ALWAYS 2
d62a17ae 154 /* LSA timer parameters */
155 unsigned int lsa_minarrival; /* LSA minimum arrival in milliseconds. */
b6927875 156
d62a17ae 157 /* SPF parameters */
158 unsigned int spf_delay; /* SPF delay time. */
159 unsigned int spf_holdtime; /* SPF hold time. */
160 unsigned int spf_max_holdtime; /* SPF maximum-holdtime */
161 unsigned int
162 spf_hold_multiplier; /* Adaptive multiplier for hold time */
163 unsigned int spf_reason; /* reason bits while scheduling SPF */
3810e06e 164
d62a17ae 165 struct timeval ts_spf; /* SPF calculation time stamp. */
166 struct timeval ts_spf_duration; /* Execution time of last SPF */
167 unsigned int last_spf_reason; /* Last SPF reason */
3810e06e 168
7df1f362 169 int fd;
d62a17ae 170 /* Threads */
171 struct thread *t_spf_calc; /* SPF calculation timer. */
172 struct thread *t_ase_calc; /* ASE calculation timer. */
173 struct thread *maxage_remover;
856ae1eb 174 struct thread *t_distribute_update; /* Distirbute update timer. */
7df1f362 175 struct thread *t_ospf6_receive; /* OSPF6 receive timer */
4dc43886 176 struct thread *t_external_aggr; /* OSPF6 aggregation timer */
3d968031 177#define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
4f7bf1ab 178 struct thread *t_write;
fd500689 179
78156066 180 int write_oi_count; /* Num of packets sent per thread invocation */
d7c0a89a 181 uint32_t ref_bandwidth;
baff583e 182
d62a17ae 183 /* Distance parameters */
d7c0a89a
QY
184 uint8_t distance_all;
185 uint8_t distance_intra;
186 uint8_t distance_inter;
187 uint8_t distance_external;
baff583e 188
d62a17ae 189 struct route_table *distance_table;
ae19c240 190
76249532
CS
191 /* Used during ospf instance going down send LSDB
192 * update to neighbors immediatly */
193 uint8_t inst_shutdown;
194
1958143e
MR
195 /* Max number of multiple paths
196 * to support ECMP.
197 */
198 uint16_t max_multipath;
91c169f7 199
71165098
RW
200 /* OSPF Graceful Restart info (restarting mode) */
201 struct ospf6_gr_info gr_info;
202
91c169f7 203 /*ospf6 Graceful restart helper info */
204 struct ospf6_gr_helper ospf6_helper_cfg;
205
ad500b22
K
206 /* Count of NSSA areas */
207 uint8_t anyNSSA;
208 struct thread *t_abr_task; /* ABR task timer. */
4f7bf1ab 209 struct list *oi_write_q;
1958143e 210
ad500b22 211 uint32_t redist_count;
4dc43886
MR
212
213 /* Action for aggregation of external LSAs */
214 int aggr_action;
215
6cb85350
AR
216 uint32_t seqnum_l; /* lower order Sequence Number */
217 uint32_t seqnum_h; /* higher order Sequence Number */
4dc43886
MR
218#define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
219 /* For ASBR summary delay timer */
74e8311e 220 uint16_t aggr_delay_interval;
4dc43886
MR
221 /* Table of configured Aggregate addresses */
222 struct route_table *rt_aggr_tbl;
223
96244aca 224 QOBJ_FIELDS;
718e3744 225};
96244aca 226DECLARE_QOBJ_TYPE(ospf6);
718e3744 227
508e53e2 228#define OSPF6_DISABLED 0x01
f41b4a02 229#define OSPF6_STUB_ROUTER 0x02
718e3744 230
508e53e2 231/* global pointer for OSPF top data structure */
232extern struct ospf6 *ospf6;
78c6ba61 233extern struct ospf6_master *om6;
718e3744 234
508e53e2 235/* prototypes */
beadc736 236extern void ospf6_master_init(struct thread_master *master);
f71ed6df 237extern void install_element_ospf6_clear_process(void);
d62a17ae 238extern void ospf6_top_init(void);
239extern void ospf6_delete(struct ospf6 *o);
a3049476 240extern bool ospf6_router_id_update(struct ospf6 *ospf6, bool init);
fcd45026 241void ospf6_restart_spf(struct ospf6 *ospf6);
718e3744 242
d62a17ae 243extern void ospf6_maxage_remove(struct ospf6 *o);
beadc736 244extern struct ospf6 *ospf6_instance_create(const char *name);
245void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf);
246void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf);
247struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id);
248struct ospf6 *ospf6_lookup_by_vrf_name(const char *name);
249const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id);
4e8ccd92 250void ospf6_vrf_init(void);
4dc43886 251bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p);
718e3744 252#endif /* OSPF6_TOP_H */