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