]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_interface.h
lib: Remove unnecessary comparison, for linked list
[mirror_frr.git] / ospf6d / ospf6_interface.h
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 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 *
896014f4
DL
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
718e3744 19 */
20
21#ifndef OSPF6_INTERFACE_H
22#define OSPF6_INTERFACE_H
23
ae19c240 24#include "qobj.h"
3012671f 25#include "hook.h"
508e53e2 26#include "if.h"
1a5607ea 27#include "ospf6d.h"
718e3744 28
b592ec5a
AR
29DECLARE_MTYPE(OSPF6_AUTH_MANUAL_KEY);
30
508e53e2 31/* Debug option */
32extern unsigned char conf_debug_ospf6_interface;
d62a17ae 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)
718e3744 36
1a5607ea 37struct ospf6_auth_data {
6cb85350
AR
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 */
1a5607ea
AR
50};
51
508e53e2 52/* Interface structure */
d62a17ae 53struct ospf6_interface {
54 /* IF info from zebra */
55 struct interface *interface;
718e3744 56
d62a17ae 57 /* back pointer */
58 struct ospf6_area *area;
718e3744 59
42cabc55
IR
60 uint32_t area_id;
61 int area_id_format;
62
d62a17ae 63 /* list of ospf6 neighbor */
64 struct list *neighbor_list;
718e3744 65
d62a17ae 66 /* linklocal address of this I/F */
67 struct in6_addr *linklocal_addr;
718e3744 68
d62a17ae 69 /* Interface ID; use interface->ifindex */
718e3744 70
d62a17ae 71 /* ospf6 instance id */
d7c0a89a 72 uint8_t instance_id;
718e3744 73
d62a17ae 74 /* I/F transmission delay */
d7c0a89a 75 uint32_t transdelay;
718e3744 76
4f7bf1ab
PR
77 /* Packet send buffer. */
78 struct ospf6_fifo *obuf; /* Output queue */
79
d62a17ae 80 /* Network Type */
d7c0a89a 81 uint8_t type;
5aeb4f3c 82 bool type_cfg;
c5926a92 83
d62a17ae 84 /* Router Priority */
d7c0a89a 85 uint8_t priority;
718e3744 86
d62a17ae 87 /* Time Interval */
d7c0a89a
QY
88 uint16_t hello_interval;
89 uint16_t dead_interval;
90 uint32_t rxmt_interval;
718e3744 91
d7c0a89a 92 uint32_t state_change;
3bc4f84e 93
d62a17ae 94 /* Cost */
d7c0a89a 95 uint32_t cost;
718e3744 96
d62a17ae 97 /* I/F MTU */
d7c0a89a 98 uint32_t ifmtu;
718e3744 99
d62a17ae 100 /* Configured MTU */
d7c0a89a 101 uint32_t c_ifmtu;
0c7ef48a 102
d62a17ae 103 /* Interface State */
d7c0a89a 104 uint8_t state;
718e3744 105
d62a17ae 106 /* Interface socket setting trial counter, resets on success */
d7c0a89a 107 uint8_t sso_try_cnt;
f80003b0 108 struct thread *thread_sso;
8e370bfa 109
d62a17ae 110 /* OSPF6 Interface flag */
111 char flag;
718e3744 112
d62a17ae 113 /* MTU mismatch check */
d7c0a89a 114 uint8_t mtu_ignore;
d42306d9 115
1a5607ea
AR
116 /* Authentication trailer related config */
117 struct ospf6_auth_data at_data;
118
d62a17ae 119 /* Decision of DR Election */
858f9c08
DL
120 in_addr_t drouter;
121 in_addr_t bdrouter;
122 in_addr_t prev_drouter;
123 in_addr_t prev_bdrouter;
718e3744 124
d62a17ae 125 /* Linklocal LSA Database: includes Link-LSA */
126 struct ospf6_lsdb *lsdb;
127 struct ospf6_lsdb *lsdb_self;
718e3744 128
d62a17ae 129 struct ospf6_lsdb *lsupdate_list;
130 struct ospf6_lsdb *lsack_list;
718e3744 131
d62a17ae 132 /* Ongoing Tasks */
133 struct thread *thread_send_hello;
134 struct thread *thread_send_lsupdate;
135 struct thread *thread_send_lsack;
718e3744 136
d62a17ae 137 struct thread *thread_network_lsa;
138 struct thread *thread_link_lsa;
139 struct thread *thread_intra_prefix_lsa;
76249532 140 struct thread *thread_as_extern_lsa;
9ae41e31 141 struct thread *thread_wait_timer;
718e3744 142
d62a17ae 143 struct ospf6_route_table *route_connected;
718e3744 144
bb382e24
PR
145 /* last hello sent */
146 struct timeval last_hello;
147
d62a17ae 148 /* prefix-list name to filter connected prefix */
149 char *plist_name;
7f342629 150
d62a17ae 151 /* BFD information */
d06cc416
RZ
152 struct {
153 bool enabled;
154 uint8_t detection_multiplier;
155 uint32_t min_rx;
156 uint32_t min_tx;
1f7be0d2 157 char *profile;
d06cc416 158 } bfd_config;
ae19c240 159
4f7bf1ab
PR
160 int on_write_q;
161
43855e3d 162 /* Statistics Fields */
d7c0a89a
QY
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;
43855e3d 174
96244aca 175 QOBJ_FIELDS;
718e3744 176};
96244aca 177DECLARE_QOBJ_TYPE(ospf6_interface);
718e3744 178
508e53e2 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
2b64873d 190extern const char *const ospf6_interface_state_str[];
718e3744 191
508e53e2 192/* flags */
193#define OSPF6_INTERFACE_DISABLE 0x01
194#define OSPF6_INTERFACE_PASSIVE 0x02
c19543b2 195#define OSPF6_INTERFACE_NOAUTOCOST 0x04
718e3744 196
b51a3a31
VT
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
70bd3c43
DS
205#define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
206#define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
8e370bfa
DS
207#define OSPF6_INTERFACE_SSO_RETRY_INT 1
208#define OSPF6_INTERFACE_SSO_RETRY_MAX 5
b51a3a31 209
718e3744 210/* Function Prototypes */
211
42cabc55
IR
212extern void ospf6_interface_start(struct ospf6_interface *oi);
213extern void ospf6_interface_stop(struct ospf6_interface *oi);
214
c5d28568
K
215extern struct ospf6_interface *
216ospf6_interface_lookup_by_ifindex(ifindex_t, vrf_id_t vrf_id);
7932dd93
DS
217extern struct ospf6_interface *ospf6_interface_create(struct interface *ifp);
218extern void ospf6_interface_delete(struct ospf6_interface *oi);
718e3744 219
7932dd93
DS
220extern void ospf6_interface_enable(struct ospf6_interface *oi);
221extern void ospf6_interface_disable(struct ospf6_interface *oi);
718e3744 222
7932dd93
DS
223extern void ospf6_interface_state_update(struct interface *ifp);
224extern void ospf6_interface_connected_route_update(struct interface *ifp);
ad500b22
K
225extern struct in6_addr *
226ospf6_interface_get_global_address(struct interface *ifp);
508e53e2 227
228/* interface event */
cc9f21da
DS
229extern void interface_up(struct thread *thread);
230extern void interface_down(struct thread *thread);
231extern void wait_timer(struct thread *thread);
232extern void backup_seen(struct thread *thread);
233extern void neighbor_change(struct thread *thread);
718e3744 234
d62a17ae 235extern void ospf6_interface_init(void);
f71ed6df 236extern void ospf6_interface_clear(struct interface *ifp);
718e3744 237
d62a17ae 238extern void install_element_ospf6_clear_interface(void);
a1b11f9b 239
d62a17ae 240extern int config_write_ospf6_debug_interface(struct vty *vty);
241extern void install_element_ospf6_debug_interface(void);
9a06f23d 242extern int ospf6_interface_neighbor_count(struct ospf6_interface *oi);
243extern uint8_t dr_election(struct ospf6_interface *oi);
718e3744 244
1a5607ea
AR
245extern void ospf6_interface_auth_trailer_cmd_init(void);
246extern void ospf6_auth_write_config(struct vty *vty,
247 struct ospf6_auth_data *at_data);
3012671f 248DECLARE_HOOK(ospf6_interface_change,
d62a17ae 249 (struct ospf6_interface * oi, int state, int old_state),
8451921b 250 (oi, state, old_state));
3012671f 251
718e3744 252#endif /* OSPF6_INTERFACE_H */