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
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
26 extern unsigned char conf_debug_ospf6_brouter
;
27 extern u_int32_t conf_debug_ospf6_brouter_specific_router_id
;
28 extern u_int32_t conf_debug_ospf6_brouter_specific_area_id
;
29 #define OSPF6_DEBUG_BROUTER_SUMMARY 0x01
30 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02
31 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA 0x04
32 #define OSPF6_DEBUG_BROUTER_ON() \
33 (conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SUMMARY)
34 #define OSPF6_DEBUG_BROUTER_OFF() \
35 (conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SUMMARY)
36 #define IS_OSPF6_DEBUG_BROUTER \
37 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SUMMARY)
39 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id) \
41 conf_debug_ospf6_brouter_specific_router_id = (router_id); \
42 conf_debug_ospf6_brouter |= \
43 OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
45 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF() \
47 conf_debug_ospf6_brouter_specific_router_id = 0; \
48 conf_debug_ospf6_brouter &= \
49 ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
51 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \
52 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
53 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(router_id) \
54 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \
55 && conf_debug_ospf6_brouter_specific_router_id == (router_id))
57 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id) \
59 conf_debug_ospf6_brouter_specific_area_id = (area_id); \
60 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
62 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF() \
64 conf_debug_ospf6_brouter_specific_area_id = 0; \
65 conf_debug_ospf6_brouter &= \
66 ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
68 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \
69 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
70 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(area_id) \
71 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \
72 && conf_debug_ospf6_brouter_specific_area_id == (area_id))
75 #define OSPF6_ROUTER_LSA_MIN_SIZE 4U
76 struct ospf6_router_lsa
{
79 /* followed by ospf6_router_lsdesc(s) */
82 /* Link State Description in Router-LSA */
83 #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U
84 struct ospf6_router_lsdesc
{
87 u_int16_t metric
; /* output cost */
88 u_int32_t interface_id
;
89 u_int32_t neighbor_interface_id
;
90 u_int32_t neighbor_router_id
;
93 #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
94 #define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
95 #define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
96 #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
98 enum stub_router_mode
{
99 OSPF6_NOT_STUB_ROUTER
,
100 OSPF6_IS_STUB_ROUTER
,
101 OSPF6_IS_STUB_ROUTER_V6
,
104 #define ROUTER_LSDESC_IS_TYPE(t, x) \
105 ((((struct ospf6_router_lsdesc *)(x))->type \
106 == OSPF6_ROUTER_LSDESC_##t) \
109 #define ROUTER_LSDESC_GET_METRIC(x) \
110 (ntohs(((struct ospf6_router_lsdesc *)(x))->metric))
111 #define ROUTER_LSDESC_GET_IFID(x) \
112 (ntohl(((struct ospf6_router_lsdesc *)(x))->interface_id))
113 #define ROUTER_LSDESC_GET_NBR_IFID(x) \
114 (ntohl(((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
115 #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
116 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
119 #define OSPF6_NETWORK_LSA_MIN_SIZE 4U
120 struct ospf6_network_lsa
{
123 /* followed by ospf6_netowrk_lsd(s) */
126 /* Link State Description in Router-LSA */
127 #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U
128 struct ospf6_network_lsdesc
{
131 #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
132 (((struct ospf6_network_lsdesc *)(x))->router_id)
135 #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */
136 struct ospf6_link_lsa
{
139 struct in6_addr linklocal_addr
;
140 u_int32_t prefix_num
;
141 /* followed by ospf6 prefix(es) */
144 /* Intra-Area-Prefix-LSA */
145 #define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */
146 struct ospf6_intra_prefix_lsa
{
147 u_int16_t prefix_num
;
150 u_int32_t ref_adv_router
;
151 /* followed by ospf6 prefix(es) */
155 #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
157 if (!(oa)->thread_router_lsa \
158 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
159 (oa)->thread_router_lsa = thread_add_event( \
160 master, ospf6_router_lsa_originate, oa, 0); \
162 #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
164 if (!(oi)->thread_network_lsa \
165 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
166 (oi)->thread_network_lsa = thread_add_event( \
167 master, ospf6_network_lsa_originate, oi, 0); \
169 #define OSPF6_LINK_LSA_SCHEDULE(oi) \
171 if (!(oi)->thread_link_lsa \
172 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
173 (oi)->thread_link_lsa = thread_add_event( \
174 master, ospf6_link_lsa_originate, oi, 0); \
176 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
178 if (!(oa)->thread_intra_prefix_lsa \
179 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
180 (oa)->thread_intra_prefix_lsa = thread_add_event( \
181 master, ospf6_intra_prefix_lsa_originate_stub, \
184 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
186 if (!(oi)->thread_intra_prefix_lsa \
187 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
188 (oi)->thread_intra_prefix_lsa = thread_add_event( \
190 ospf6_intra_prefix_lsa_originate_transit, oi, \
194 #define OSPF6_NETWORK_LSA_EXECUTE(oi) \
196 THREAD_OFF((oi)->thread_network_lsa); \
197 thread_execute(master, ospf6_network_lsa_originate, oi, 0); \
199 #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
201 THREAD_OFF((oi)->thread_intra_prefix_lsa); \
202 thread_execute(master, \
203 ospf6_intra_prefix_lsa_originate_transit, oi, \
208 /* Function Prototypes */
209 extern char *ospf6_router_lsdesc_lookup(u_char type
, u_int32_t interface_id
,
210 u_int32_t neighbor_interface_id
,
211 u_int32_t neighbor_router_id
,
212 struct ospf6_lsa
*lsa
);
213 extern char *ospf6_network_lsdesc_lookup(u_int32_t router_id
,
214 struct ospf6_lsa
*lsa
);
216 extern int ospf6_router_is_stub_router(struct ospf6_lsa
*lsa
);
217 extern int ospf6_router_lsa_originate(struct thread
*);
218 extern int ospf6_network_lsa_originate(struct thread
*);
219 extern int ospf6_link_lsa_originate(struct thread
*);
220 extern int ospf6_intra_prefix_lsa_originate_transit(struct thread
*);
221 extern int ospf6_intra_prefix_lsa_originate_stub(struct thread
*);
222 extern void ospf6_intra_prefix_lsa_add(struct ospf6_lsa
*lsa
);
223 extern void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa
*lsa
);
225 extern void ospf6_intra_route_calculation(struct ospf6_area
*oa
);
226 extern void ospf6_intra_brouter_calculation(struct ospf6_area
*oa
);
228 extern void ospf6_intra_init(void);
230 extern int config_write_ospf6_debug_brouter(struct vty
*vty
);
231 extern void install_element_ospf6_debug_brouter(void);
233 #endif /* OSPF6_LSA_H */