1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2003 Yasuhiro Ohara
6 #ifndef OSPF6_INTERFACE_H
7 #define OSPF6_INTERFACE_H
14 DECLARE_MTYPE(OSPF6_AUTH_MANUAL_KEY
);
17 extern unsigned char conf_debug_ospf6_interface
;
18 #define OSPF6_DEBUG_INTERFACE_ON() (conf_debug_ospf6_interface = 1)
19 #define OSPF6_DEBUG_INTERFACE_OFF() (conf_debug_ospf6_interface = 0)
20 #define IS_OSPF6_DEBUG_INTERFACE (conf_debug_ospf6_interface)
22 struct ospf6_auth_data
{
24 uint8_t hash_algo
; /* hash algorithm type */
25 uint16_t key_id
; /* key-id used as SA in auth packet */
26 char *auth_key
; /* Auth key */
27 char *keychain
; /* keychain name */
29 /* operational data */
30 uint8_t flags
; /* Flags related to auth config */
32 /* Counters and Statistics */
33 uint32_t tx_drop
; /* Pkt drop due to auth fail while sending */
34 uint32_t rx_drop
; /* Pkt drop due to auth fail while reading */
37 /* Interface structure */
38 struct ospf6_interface
{
39 /* IF info from zebra */
40 struct interface
*interface
;
43 struct ospf6_area
*area
;
48 /* list of ospf6 neighbor */
49 struct list
*neighbor_list
;
51 /* linklocal address of this I/F */
52 struct in6_addr
*linklocal_addr
;
54 /* Interface ID; use interface->ifindex */
56 /* ospf6 instance id */
59 /* I/F transmission delay */
62 /* Packet send buffer. */
63 struct ospf6_fifo
*obuf
; /* Output queue */
73 uint16_t hello_interval
;
74 uint16_t dead_interval
;
75 uint32_t rxmt_interval
;
77 uint32_t state_change
;
91 /* Interface socket setting trial counter, resets on success */
93 struct event
*thread_sso
;
95 /* OSPF6 Interface flag */
98 /* MTU mismatch check */
101 /* Authentication trailer related config */
102 struct ospf6_auth_data at_data
;
104 /* Decision of DR Election */
107 in_addr_t prev_drouter
;
108 in_addr_t prev_bdrouter
;
110 /* Linklocal LSA Database: includes Link-LSA */
111 struct ospf6_lsdb
*lsdb
;
112 struct ospf6_lsdb
*lsdb_self
;
114 struct ospf6_lsdb
*lsupdate_list
;
115 struct ospf6_lsdb
*lsack_list
;
118 struct event
*thread_send_hello
;
119 struct event
*thread_send_lsupdate
;
120 struct event
*thread_send_lsack
;
122 struct event
*thread_network_lsa
;
123 struct event
*thread_link_lsa
;
124 struct event
*thread_intra_prefix_lsa
;
125 struct event
*thread_as_extern_lsa
;
126 struct event
*thread_wait_timer
;
128 struct ospf6_route_table
*route_connected
;
130 /* last hello sent */
131 struct timeval last_hello
;
133 /* prefix-list name to filter connected prefix */
136 /* BFD information */
139 uint8_t detection_multiplier
;
147 /* Statistics Fields */
151 uint32_t db_desc_out
;
162 DECLARE_QOBJ_TYPE(ospf6_interface
);
164 /* interface state */
165 #define OSPF6_INTERFACE_NONE 0
166 #define OSPF6_INTERFACE_DOWN 1
167 #define OSPF6_INTERFACE_LOOPBACK 2
168 #define OSPF6_INTERFACE_WAITING 3
169 #define OSPF6_INTERFACE_POINTTOPOINT 4
170 #define OSPF6_INTERFACE_DROTHER 5
171 #define OSPF6_INTERFACE_BDR 6
172 #define OSPF6_INTERFACE_DR 7
173 #define OSPF6_INTERFACE_MAX 8
175 extern const char *const ospf6_interface_state_str
[];
178 #define OSPF6_INTERFACE_DISABLE 0x01
179 #define OSPF6_INTERFACE_PASSIVE 0x02
180 #define OSPF6_INTERFACE_NOAUTOCOST 0x04
183 #define OSPF6_INTERFACE_HELLO_INTERVAL 10
184 #define OSPF6_INTERFACE_DEAD_INTERVAL 40
185 #define OSPF6_INTERFACE_RXMT_INTERVAL 5
186 #define OSPF6_INTERFACE_COST 1
187 #define OSPF6_INTERFACE_PRIORITY 1
188 #define OSPF6_INTERFACE_TRANSDELAY 1
189 #define OSPF6_INTERFACE_INSTANCE_ID 0
190 #define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
191 #define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
192 #define OSPF6_INTERFACE_SSO_RETRY_INT 1
193 #define OSPF6_INTERFACE_SSO_RETRY_MAX 5
195 /* Function Prototypes */
197 extern void ospf6_interface_start(struct ospf6_interface
*oi
);
198 extern void ospf6_interface_stop(struct ospf6_interface
*oi
);
200 extern struct ospf6_interface
*
201 ospf6_interface_lookup_by_ifindex(ifindex_t
, vrf_id_t vrf_id
);
202 extern struct ospf6_interface
*ospf6_interface_create(struct interface
*ifp
);
203 extern void ospf6_interface_delete(struct ospf6_interface
*oi
);
205 extern void ospf6_interface_enable(struct ospf6_interface
*oi
);
206 extern void ospf6_interface_disable(struct ospf6_interface
*oi
);
208 extern void ospf6_interface_state_update(struct interface
*ifp
);
209 extern void ospf6_interface_connected_route_update(struct interface
*ifp
);
210 extern struct in6_addr
*
211 ospf6_interface_get_global_address(struct interface
*ifp
);
213 /* interface event */
214 extern void interface_up(struct event
*thread
);
215 extern void interface_down(struct event
*thread
);
216 extern void wait_timer(struct event
*thread
);
217 extern void backup_seen(struct event
*thread
);
218 extern void neighbor_change(struct event
*thread
);
220 extern void ospf6_interface_init(void);
221 extern void ospf6_interface_clear(struct interface
*ifp
);
223 extern void install_element_ospf6_clear_interface(void);
225 extern int config_write_ospf6_debug_interface(struct vty
*vty
);
226 extern void install_element_ospf6_debug_interface(void);
227 extern int ospf6_interface_neighbor_count(struct ospf6_interface
*oi
);
228 extern uint8_t dr_election(struct ospf6_interface
*oi
);
230 extern void ospf6_interface_auth_trailer_cmd_init(void);
231 extern void ospf6_auth_write_config(struct vty
*vty
,
232 struct ospf6_auth_data
*at_data
);
233 DECLARE_HOOK(ospf6_interface_change
,
234 (struct ospf6_interface
* oi
, int state
, int old_state
),
235 (oi
, state
, old_state
));
237 #endif /* OSPF6_INTERFACE_H */