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
25 extern unsigned char conf_debug_ospf6_brouter
;
26 extern u_int32_t conf_debug_ospf6_brouter_specific_router_id
;
27 extern u_int32_t conf_debug_ospf6_brouter_specific_area_id
;
28 #define OSPF6_DEBUG_BROUTER_SUMMARY 0x01
29 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02
30 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA 0x04
31 #define OSPF6_DEBUG_BROUTER_ON() \
32 (conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SUMMARY)
33 #define OSPF6_DEBUG_BROUTER_OFF() \
34 (conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SUMMARY)
35 #define IS_OSPF6_DEBUG_BROUTER \
36 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SUMMARY)
38 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id) \
40 conf_debug_ospf6_brouter_specific_router_id = (router_id); \
41 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
43 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF() \
45 conf_debug_ospf6_brouter_specific_router_id = 0; \
46 conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
48 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \
49 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
50 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(router_id) \
51 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER && \
52 conf_debug_ospf6_brouter_specific_router_id == (router_id))
54 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id) \
56 conf_debug_ospf6_brouter_specific_area_id = (area_id); \
57 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
59 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF() \
61 conf_debug_ospf6_brouter_specific_area_id = 0; \
62 conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
64 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \
65 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
66 #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(area_id) \
67 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA && \
68 conf_debug_ospf6_brouter_specific_area_id == (area_id))
71 #define OSPF6_ROUTER_LSA_MIN_SIZE 4U
72 struct ospf6_router_lsa
76 /* followed by ospf6_router_lsdesc(s) */
79 /* Link State Description in Router-LSA */
80 #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U
81 struct ospf6_router_lsdesc
85 u_int16_t metric
; /* output cost */
86 u_int32_t interface_id
;
87 u_int32_t neighbor_interface_id
;
88 u_int32_t neighbor_router_id
;
91 #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
92 #define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
93 #define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
94 #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
98 OSPF6_NOT_STUB_ROUTER
,
100 OSPF6_IS_STUB_ROUTER_V6
,
103 #define ROUTER_LSDESC_IS_TYPE(t,x) \
104 ((((struct ospf6_router_lsdesc *)(x))->type == \
105 OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
106 #define ROUTER_LSDESC_GET_METRIC(x) \
107 (ntohs (((struct ospf6_router_lsdesc *)(x))->metric))
108 #define ROUTER_LSDESC_GET_IFID(x) \
109 (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id))
110 #define ROUTER_LSDESC_GET_NBR_IFID(x) \
111 (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
112 #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
113 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
116 #define OSPF6_NETWORK_LSA_MIN_SIZE 4U
117 struct ospf6_network_lsa
121 /* followed by ospf6_netowrk_lsd(s) */
124 /* Link State Description in Router-LSA */
125 #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U
126 struct ospf6_network_lsdesc
130 #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
131 (((struct ospf6_network_lsdesc *)(x))->router_id)
134 #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */
135 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
148 u_int16_t prefix_num
;
151 u_int32_t ref_adv_router
;
152 /* followed by ospf6 prefix(es) */
156 #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
158 if (CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
159 thread_add_event (master, ospf6_router_lsa_originate, oa, 0, &(oa)->thread_router_lsa); \
161 #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
163 if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
164 thread_add_event (master, ospf6_network_lsa_originate, oi, 0, &(oi)->thread_network_lsa); \
166 #define OSPF6_LINK_LSA_SCHEDULE(oi) \
168 if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
169 thread_add_event (master, ospf6_link_lsa_originate, oi, 0, &(oi)->thread_link_lsa); \
171 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
173 if (CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
174 thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
175 oa, 0, &(oa)->thread_intra_prefix_lsa); \
177 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
179 if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
180 thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
181 oi, 0, &(oi)->thread_intra_prefix_lsa); \
184 #define OSPF6_NETWORK_LSA_EXECUTE(oi) \
186 THREAD_OFF ((oi)->thread_network_lsa); \
187 thread_execute (master, ospf6_network_lsa_originate, oi, 0); \
189 #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
191 THREAD_OFF ((oi)->thread_intra_prefix_lsa); \
192 thread_execute (master, ospf6_intra_prefix_lsa_originate_transit, oi, 0); \
196 /* Function Prototypes */
197 extern char *ospf6_router_lsdesc_lookup (u_char type
, u_int32_t interface_id
,
198 u_int32_t neighbor_interface_id
,
199 u_int32_t neighbor_router_id
,
200 struct ospf6_lsa
*lsa
);
201 extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id
,
202 struct ospf6_lsa
*lsa
);
204 extern int ospf6_router_is_stub_router (struct ospf6_lsa
*lsa
);
205 extern int ospf6_router_lsa_originate (struct thread
*);
206 extern int ospf6_network_lsa_originate (struct thread
*);
207 extern int ospf6_link_lsa_originate (struct thread
*);
208 extern int ospf6_intra_prefix_lsa_originate_transit (struct thread
*);
209 extern int ospf6_intra_prefix_lsa_originate_stub (struct thread
*);
210 extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa
*lsa
);
211 extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa
*lsa
);
213 extern void ospf6_intra_route_calculation (struct ospf6_area
*oa
);
214 extern void ospf6_intra_brouter_calculation (struct ospf6_area
*oa
);
216 extern void ospf6_intra_init (void);
218 extern int config_write_ospf6_debug_brouter (struct vty
*vty
);
219 extern void install_element_ospf6_debug_brouter (void);
221 #endif /* OSPF6_LSA_H */