2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 /* OSPFv3 instance. */
30 /* OSPFv3 thread master. */
31 struct thread_master
*master
;
34 /* ospf6->config_flags */
36 OSPF6_LOG_ADJACENCY_CHANGES
= (1 << 0),
37 OSPF6_LOG_ADJACENCY_DETAIL
= (1 << 1),
40 /* For processing route-map change update in the callback */
41 #define OSPF6_IS_RMAP_CHANGED 0x01
46 /* Redistribute metric info. */
48 int type
; /* External metric type (E1 or E2). */
49 int value
; /* Value for static metric (24-bit).
50 * -1 means metric value is not set.
54 /* For redistribute route map. */
57 struct route_map
*map
;
59 #define ROUTEMAP_NAME(R) (R->route_map.name)
60 #define ROUTEMAP(R) (R->route_map.map)
63 /* OSPFv3 top level data structure */
65 /* The relevant vrf_id */
68 char *name
; /* VRF name */
73 /* static router id */
74 in_addr_t router_id_static
;
76 in_addr_t router_id_zebra
;
79 struct timeval starttime
;
82 struct list
*area_list
;
83 struct ospf6_area
*backbone
;
85 /* AS scope link state database */
86 struct ospf6_lsdb
*lsdb
;
87 struct ospf6_lsdb
*lsdb_self
;
89 struct ospf6_route_table
*route_table
;
90 struct ospf6_route_table
*brouter_table
;
92 struct ospf6_route_table
*external_table
;
93 struct route_table
*external_id_table
;
94 #define OSPF6_EXT_INIT_LS_ID 1
97 /* OSPF6 redistribute configuration */
98 struct list
*redist
[ZEBRA_ROUTE_MAX
+ 1];
101 #define OSPF6_FLAG_ABR 0x04
102 #define OSPF6_FLAG_ASBR 0x08
104 int redistribute
; /* Num of redistributed protocols. */
106 /* Configuration bitmask, refer to enum above */
107 uint8_t config_flags
;
108 int default_originate
; /* Default information originate. */
109 #define DEFAULT_ORIGINATE_NONE 0
110 #define DEFAULT_ORIGINATE_ZEBRA 1
111 #define DEFAULT_ORIGINATE_ALWAYS 2
112 /* LSA timer parameters */
113 unsigned int lsa_minarrival
; /* LSA minimum arrival in milliseconds. */
116 unsigned int spf_delay
; /* SPF delay time. */
117 unsigned int spf_holdtime
; /* SPF hold time. */
118 unsigned int spf_max_holdtime
; /* SPF maximum-holdtime */
120 spf_hold_multiplier
; /* Adaptive multiplier for hold time */
121 unsigned int spf_reason
; /* reason bits while scheduling SPF */
123 struct timeval ts_spf
; /* SPF calculation time stamp. */
124 struct timeval ts_spf_duration
; /* Execution time of last SPF */
125 unsigned int last_spf_reason
; /* Last SPF reason */
129 struct thread
*t_spf_calc
; /* SPF calculation timer. */
130 struct thread
*t_ase_calc
; /* ASE calculation timer. */
131 struct thread
*maxage_remover
;
132 struct thread
*t_distribute_update
; /* Distirbute update timer. */
133 struct thread
*t_ospf6_receive
; /* OSPF6 receive timer */
134 struct thread
*t_external_aggr
; /* OSPF6 aggregation timer */
135 #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
136 struct thread
*t_write
;
138 int write_oi_count
; /* Num of packets sent per thread invocation */
139 uint32_t ref_bandwidth
;
141 /* Distance parameters */
142 uint8_t distance_all
;
143 uint8_t distance_intra
;
144 uint8_t distance_inter
;
145 uint8_t distance_external
;
147 struct route_table
*distance_table
;
149 /* Used during ospf instance going down send LSDB
150 * update to neighbors immediatly */
151 uint8_t inst_shutdown
;
153 /* Max number of multiple paths
156 uint16_t max_multipath
;
157 /* Count of NSSA areas */
159 struct thread
*t_abr_task
; /* ABR task timer. */
160 struct list
*oi_write_q
;
162 uint32_t redist_count
;
164 /* Action for aggregation of external LSAs */
167 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
168 /* For ASBR summary delay timer */
169 int aggr_delay_interval
;
170 /* Table of configured Aggregate addresses */
171 struct route_table
*rt_aggr_tbl
;
175 DECLARE_QOBJ_TYPE(ospf6
);
177 #define OSPF6_DISABLED 0x01
178 #define OSPF6_STUB_ROUTER 0x02
180 /* global pointer for OSPF top data structure */
181 extern struct ospf6
*ospf6
;
182 extern struct ospf6_master
*om6
;
185 extern void ospf6_master_init(struct thread_master
*master
);
186 extern void install_element_ospf6_clear_process(void);
187 extern void ospf6_top_init(void);
188 extern void ospf6_delete(struct ospf6
*o
);
189 extern void ospf6_router_id_update(struct ospf6
*ospf6
);
191 extern void ospf6_maxage_remove(struct ospf6
*o
);
192 extern struct ospf6
*ospf6_instance_create(const char *name
);
193 void ospf6_vrf_link(struct ospf6
*ospf6
, struct vrf
*vrf
);
194 void ospf6_vrf_unlink(struct ospf6
*ospf6
, struct vrf
*vrf
);
195 struct ospf6
*ospf6_lookup_by_vrf_id(vrf_id_t vrf_id
);
196 struct ospf6
*ospf6_lookup_by_vrf_name(const char *name
);
197 const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id
);
198 void ospf6_vrf_init(void);
199 bool ospf6_is_valid_summary_addr(struct vty
*vty
, struct prefix
*p
);
200 #endif /* OSPF6_TOP_H */