]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_interface.h
Merge pull request #13297 from donaldsharp/ospf6_missing_nh
[mirror_frr.git] / ospf6d / ospf6_interface.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2003 Yasuhiro Ohara
4 */
5
6 #ifndef OSPF6_INTERFACE_H
7 #define OSPF6_INTERFACE_H
8
9 #include "qobj.h"
10 #include "hook.h"
11 #include "if.h"
12 #include "ospf6d.h"
13
14 DECLARE_MTYPE(OSPF6_AUTH_MANUAL_KEY);
15
16 /* Debug option */
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)
21
22 struct ospf6_auth_data {
23 /* config 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 */
28
29 /* operational data */
30 uint8_t flags; /* Flags related to auth config */
31
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 */
35 };
36
37 /* Interface structure */
38 struct ospf6_interface {
39 /* IF info from zebra */
40 struct interface *interface;
41
42 /* back pointer */
43 struct ospf6_area *area;
44
45 uint32_t area_id;
46 int area_id_format;
47
48 /* list of ospf6 neighbor */
49 struct list *neighbor_list;
50
51 /* linklocal address of this I/F */
52 struct in6_addr *linklocal_addr;
53
54 /* Interface ID; use interface->ifindex */
55
56 /* ospf6 instance id */
57 uint8_t instance_id;
58
59 /* I/F transmission delay */
60 uint32_t transdelay;
61
62 /* Packet send buffer. */
63 struct ospf6_fifo *obuf; /* Output queue */
64
65 /* Network Type */
66 uint8_t type;
67 bool type_cfg;
68
69 /* Router Priority */
70 uint8_t priority;
71
72 /* Time Interval */
73 uint16_t hello_interval;
74 uint16_t dead_interval;
75 uint32_t rxmt_interval;
76
77 uint32_t state_change;
78
79 /* Cost */
80 uint32_t cost;
81
82 /* I/F MTU */
83 uint32_t ifmtu;
84
85 /* Configured MTU */
86 uint32_t c_ifmtu;
87
88 /* Interface State */
89 uint8_t state;
90
91 /* Interface socket setting trial counter, resets on success */
92 uint8_t sso_try_cnt;
93 struct event *thread_sso;
94
95 /* OSPF6 Interface flag */
96 char flag;
97
98 /* MTU mismatch check */
99 uint8_t mtu_ignore;
100
101 /* Authentication trailer related config */
102 struct ospf6_auth_data at_data;
103
104 /* Decision of DR Election */
105 in_addr_t drouter;
106 in_addr_t bdrouter;
107 in_addr_t prev_drouter;
108 in_addr_t prev_bdrouter;
109
110 /* Linklocal LSA Database: includes Link-LSA */
111 struct ospf6_lsdb *lsdb;
112 struct ospf6_lsdb *lsdb_self;
113
114 struct ospf6_lsdb *lsupdate_list;
115 struct ospf6_lsdb *lsack_list;
116
117 /* Ongoing Tasks */
118 struct event *thread_send_hello;
119 struct event *thread_send_lsupdate;
120 struct event *thread_send_lsack;
121
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;
127
128 struct ospf6_route_table *route_connected;
129
130 /* last hello sent */
131 struct timeval last_hello;
132
133 /* prefix-list name to filter connected prefix */
134 char *plist_name;
135
136 /* BFD information */
137 struct {
138 bool enabled;
139 uint8_t detection_multiplier;
140 uint32_t min_rx;
141 uint32_t min_tx;
142 char *profile;
143 } bfd_config;
144
145 int on_write_q;
146
147 /* Statistics Fields */
148 uint32_t hello_in;
149 uint32_t hello_out;
150 uint32_t db_desc_in;
151 uint32_t db_desc_out;
152 uint32_t ls_req_in;
153 uint32_t ls_req_out;
154 uint32_t ls_upd_in;
155 uint32_t ls_upd_out;
156 uint32_t ls_ack_in;
157 uint32_t ls_ack_out;
158 uint32_t discarded;
159
160 QOBJ_FIELDS;
161 };
162 DECLARE_QOBJ_TYPE(ospf6_interface);
163
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
174
175 extern const char *const ospf6_interface_state_str[];
176
177 /* flags */
178 #define OSPF6_INTERFACE_DISABLE 0x01
179 #define OSPF6_INTERFACE_PASSIVE 0x02
180 #define OSPF6_INTERFACE_NOAUTOCOST 0x04
181
182 /* default values */
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
194
195 /* Function Prototypes */
196
197 extern void ospf6_interface_start(struct ospf6_interface *oi);
198 extern void ospf6_interface_stop(struct ospf6_interface *oi);
199
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);
204
205 extern void ospf6_interface_enable(struct ospf6_interface *oi);
206 extern void ospf6_interface_disable(struct ospf6_interface *oi);
207
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);
212
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);
219
220 extern void ospf6_interface_init(void);
221 extern void ospf6_interface_clear(struct interface *ifp);
222
223 extern void install_element_ospf6_clear_interface(void);
224
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);
229
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));
236
237 #endif /* OSPF6_INTERFACE_H */