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
21 #ifndef OSPF6_INTERFACE_H
22 #define OSPF6_INTERFACE_H
29 DECLARE_MTYPE(OSPF6_AUTH_MANUAL_KEY
);
32 extern unsigned char conf_debug_ospf6_interface
;
33 #define OSPF6_DEBUG_INTERFACE_ON() (conf_debug_ospf6_interface = 1)
34 #define OSPF6_DEBUG_INTERFACE_OFF() (conf_debug_ospf6_interface = 0)
35 #define IS_OSPF6_DEBUG_INTERFACE (conf_debug_ospf6_interface)
37 struct ospf6_auth_data
{
39 uint8_t hash_algo
; /* hash algorithm type */
40 uint16_t key_id
; /* key-id used as SA in auth packet */
41 char *auth_key
; /* Auth key */
42 char *keychain
; /* keychain name */
44 /* operational data */
45 uint8_t flags
; /* Flags related to auth config */
47 /* Counters and Statistics */
48 uint32_t tx_drop
; /* Pkt drop due to auth fail while sending */
49 uint32_t rx_drop
; /* Pkt drop due to auth fail while reading */
52 /* Interface structure */
53 struct ospf6_interface
{
54 /* IF info from zebra */
55 struct interface
*interface
;
58 struct ospf6_area
*area
;
63 /* list of ospf6 neighbor */
64 struct list
*neighbor_list
;
66 /* linklocal address of this I/F */
67 struct in6_addr
*linklocal_addr
;
69 /* Interface ID; use interface->ifindex */
71 /* ospf6 instance id */
74 /* I/F transmission delay */
77 /* Packet send buffer. */
78 struct ospf6_fifo
*obuf
; /* Output queue */
88 uint16_t hello_interval
;
89 uint16_t dead_interval
;
90 uint32_t rxmt_interval
;
92 uint32_t state_change
;
103 /* Interface State */
106 /* Interface socket setting trial counter, resets on success */
108 struct thread
*thread_sso
;
110 /* OSPF6 Interface flag */
113 /* MTU mismatch check */
116 /* Authentication trailer related config */
117 struct ospf6_auth_data at_data
;
119 /* Decision of DR Election */
122 in_addr_t prev_drouter
;
123 in_addr_t prev_bdrouter
;
125 /* Linklocal LSA Database: includes Link-LSA */
126 struct ospf6_lsdb
*lsdb
;
127 struct ospf6_lsdb
*lsdb_self
;
129 struct ospf6_lsdb
*lsupdate_list
;
130 struct ospf6_lsdb
*lsack_list
;
133 struct thread
*thread_send_hello
;
134 struct thread
*thread_send_lsupdate
;
135 struct thread
*thread_send_lsack
;
137 struct thread
*thread_network_lsa
;
138 struct thread
*thread_link_lsa
;
139 struct thread
*thread_intra_prefix_lsa
;
140 struct thread
*thread_as_extern_lsa
;
141 struct thread
*thread_wait_timer
;
143 struct ospf6_route_table
*route_connected
;
145 /* last hello sent */
146 struct timeval last_hello
;
148 /* prefix-list name to filter connected prefix */
151 /* BFD information */
154 uint8_t detection_multiplier
;
162 /* Statistics Fields */
166 uint32_t db_desc_out
;
177 DECLARE_QOBJ_TYPE(ospf6_interface
);
179 /* interface state */
180 #define OSPF6_INTERFACE_NONE 0
181 #define OSPF6_INTERFACE_DOWN 1
182 #define OSPF6_INTERFACE_LOOPBACK 2
183 #define OSPF6_INTERFACE_WAITING 3
184 #define OSPF6_INTERFACE_POINTTOPOINT 4
185 #define OSPF6_INTERFACE_DROTHER 5
186 #define OSPF6_INTERFACE_BDR 6
187 #define OSPF6_INTERFACE_DR 7
188 #define OSPF6_INTERFACE_MAX 8
190 extern const char *const ospf6_interface_state_str
[];
193 #define OSPF6_INTERFACE_DISABLE 0x01
194 #define OSPF6_INTERFACE_PASSIVE 0x02
195 #define OSPF6_INTERFACE_NOAUTOCOST 0x04
198 #define OSPF6_INTERFACE_HELLO_INTERVAL 10
199 #define OSPF6_INTERFACE_DEAD_INTERVAL 40
200 #define OSPF6_INTERFACE_RXMT_INTERVAL 5
201 #define OSPF6_INTERFACE_COST 1
202 #define OSPF6_INTERFACE_PRIORITY 1
203 #define OSPF6_INTERFACE_TRANSDELAY 1
204 #define OSPF6_INTERFACE_INSTANCE_ID 0
205 #define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
206 #define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
207 #define OSPF6_INTERFACE_SSO_RETRY_INT 1
208 #define OSPF6_INTERFACE_SSO_RETRY_MAX 5
210 /* Function Prototypes */
212 extern void ospf6_interface_start(struct ospf6_interface
*oi
);
213 extern void ospf6_interface_stop(struct ospf6_interface
*oi
);
215 extern struct ospf6_interface
*
216 ospf6_interface_lookup_by_ifindex(ifindex_t
, vrf_id_t vrf_id
);
217 extern struct ospf6_interface
*ospf6_interface_create(struct interface
*ifp
);
218 extern void ospf6_interface_delete(struct ospf6_interface
*oi
);
220 extern void ospf6_interface_enable(struct ospf6_interface
*oi
);
221 extern void ospf6_interface_disable(struct ospf6_interface
*oi
);
223 extern void ospf6_interface_state_update(struct interface
*ifp
);
224 extern void ospf6_interface_connected_route_update(struct interface
*ifp
);
225 extern struct in6_addr
*
226 ospf6_interface_get_global_address(struct interface
*ifp
);
228 /* interface event */
229 extern void interface_up(struct thread
*thread
);
230 extern void interface_down(struct thread
*thread
);
231 extern void wait_timer(struct thread
*thread
);
232 extern void backup_seen(struct thread
*thread
);
233 extern void neighbor_change(struct thread
*thread
);
235 extern void ospf6_interface_init(void);
236 extern void ospf6_interface_clear(struct interface
*ifp
);
238 extern void install_element_ospf6_clear_interface(void);
240 extern int config_write_ospf6_debug_interface(struct vty
*vty
);
241 extern void install_element_ospf6_debug_interface(void);
242 extern int ospf6_interface_neighbor_count(struct ospf6_interface
*oi
);
243 extern uint8_t dr_election(struct ospf6_interface
*oi
);
245 extern void ospf6_interface_auth_trailer_cmd_init(void);
246 extern void ospf6_auth_write_config(struct vty
*vty
,
247 struct ospf6_auth_data
*at_data
);
248 DECLARE_HOOK(ospf6_interface_change
,
249 (struct ospf6_interface
* oi
, int state
, int old_state
),
250 (oi
, state
, old_state
));
252 #endif /* OSPF6_INTERFACE_H */