]>
Commit | Line | Data |
---|---|---|
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" |
718e3744 | 27 | |
508e53e2 | 28 | /* Debug option */ |
29 | extern unsigned char conf_debug_ospf6_interface; | |
d62a17ae | 30 | #define OSPF6_DEBUG_INTERFACE_ON() (conf_debug_ospf6_interface = 1) |
31 | #define OSPF6_DEBUG_INTERFACE_OFF() (conf_debug_ospf6_interface = 0) | |
32 | #define IS_OSPF6_DEBUG_INTERFACE (conf_debug_ospf6_interface) | |
718e3744 | 33 | |
508e53e2 | 34 | /* Interface structure */ |
d62a17ae | 35 | struct ospf6_interface { |
36 | /* IF info from zebra */ | |
37 | struct interface *interface; | |
718e3744 | 38 | |
d62a17ae | 39 | /* back pointer */ |
40 | struct ospf6_area *area; | |
718e3744 | 41 | |
42cabc55 IR |
42 | uint32_t area_id; |
43 | int area_id_format; | |
44 | ||
d62a17ae | 45 | /* list of ospf6 neighbor */ |
46 | struct list *neighbor_list; | |
718e3744 | 47 | |
d62a17ae | 48 | /* linklocal address of this I/F */ |
49 | struct in6_addr *linklocal_addr; | |
718e3744 | 50 | |
d62a17ae | 51 | /* Interface ID; use interface->ifindex */ |
718e3744 | 52 | |
d62a17ae | 53 | /* ospf6 instance id */ |
d7c0a89a | 54 | uint8_t instance_id; |
718e3744 | 55 | |
d62a17ae | 56 | /* I/F transmission delay */ |
d7c0a89a | 57 | uint32_t transdelay; |
718e3744 | 58 | |
4f7bf1ab PR |
59 | /* Packet send buffer. */ |
60 | struct ospf6_fifo *obuf; /* Output queue */ | |
61 | ||
d62a17ae | 62 | /* Network Type */ |
d7c0a89a | 63 | uint8_t type; |
5aeb4f3c | 64 | bool type_cfg; |
c5926a92 | 65 | |
d62a17ae | 66 | /* Router Priority */ |
d7c0a89a | 67 | uint8_t priority; |
718e3744 | 68 | |
d62a17ae | 69 | /* Time Interval */ |
d7c0a89a QY |
70 | uint16_t hello_interval; |
71 | uint16_t dead_interval; | |
72 | uint32_t rxmt_interval; | |
718e3744 | 73 | |
d7c0a89a | 74 | uint32_t state_change; |
3bc4f84e | 75 | |
d62a17ae | 76 | /* Cost */ |
d7c0a89a | 77 | uint32_t cost; |
718e3744 | 78 | |
d62a17ae | 79 | /* I/F MTU */ |
d7c0a89a | 80 | uint32_t ifmtu; |
718e3744 | 81 | |
d62a17ae | 82 | /* Configured MTU */ |
d7c0a89a | 83 | uint32_t c_ifmtu; |
0c7ef48a | 84 | |
d62a17ae | 85 | /* Interface State */ |
d7c0a89a | 86 | uint8_t state; |
718e3744 | 87 | |
d62a17ae | 88 | /* Interface socket setting trial counter, resets on success */ |
d7c0a89a | 89 | uint8_t sso_try_cnt; |
f80003b0 | 90 | struct thread *thread_sso; |
8e370bfa | 91 | |
d62a17ae | 92 | /* OSPF6 Interface flag */ |
93 | char flag; | |
718e3744 | 94 | |
d62a17ae | 95 | /* MTU mismatch check */ |
d7c0a89a | 96 | uint8_t mtu_ignore; |
d42306d9 | 97 | |
d62a17ae | 98 | /* Decision of DR Election */ |
858f9c08 DL |
99 | in_addr_t drouter; |
100 | in_addr_t bdrouter; | |
101 | in_addr_t prev_drouter; | |
102 | in_addr_t prev_bdrouter; | |
718e3744 | 103 | |
d62a17ae | 104 | /* Linklocal LSA Database: includes Link-LSA */ |
105 | struct ospf6_lsdb *lsdb; | |
106 | struct ospf6_lsdb *lsdb_self; | |
718e3744 | 107 | |
d62a17ae | 108 | struct ospf6_lsdb *lsupdate_list; |
109 | struct ospf6_lsdb *lsack_list; | |
718e3744 | 110 | |
d62a17ae | 111 | /* Ongoing Tasks */ |
112 | struct thread *thread_send_hello; | |
113 | struct thread *thread_send_lsupdate; | |
114 | struct thread *thread_send_lsack; | |
718e3744 | 115 | |
d62a17ae | 116 | struct thread *thread_network_lsa; |
117 | struct thread *thread_link_lsa; | |
118 | struct thread *thread_intra_prefix_lsa; | |
76249532 | 119 | struct thread *thread_as_extern_lsa; |
9ae41e31 | 120 | struct thread *thread_wait_timer; |
718e3744 | 121 | |
d62a17ae | 122 | struct ospf6_route_table *route_connected; |
718e3744 | 123 | |
bb382e24 PR |
124 | /* last hello sent */ |
125 | struct timeval last_hello; | |
126 | ||
d62a17ae | 127 | /* prefix-list name to filter connected prefix */ |
128 | char *plist_name; | |
7f342629 | 129 | |
d62a17ae | 130 | /* BFD information */ |
d06cc416 RZ |
131 | struct { |
132 | bool enabled; | |
133 | uint8_t detection_multiplier; | |
134 | uint32_t min_rx; | |
135 | uint32_t min_tx; | |
1f7be0d2 | 136 | char *profile; |
d06cc416 | 137 | } bfd_config; |
ae19c240 | 138 | |
4f7bf1ab PR |
139 | int on_write_q; |
140 | ||
43855e3d | 141 | /* Statistics Fields */ |
d7c0a89a QY |
142 | uint32_t hello_in; |
143 | uint32_t hello_out; | |
144 | uint32_t db_desc_in; | |
145 | uint32_t db_desc_out; | |
146 | uint32_t ls_req_in; | |
147 | uint32_t ls_req_out; | |
148 | uint32_t ls_upd_in; | |
149 | uint32_t ls_upd_out; | |
150 | uint32_t ls_ack_in; | |
151 | uint32_t ls_ack_out; | |
152 | uint32_t discarded; | |
43855e3d | 153 | |
96244aca | 154 | QOBJ_FIELDS; |
718e3744 | 155 | }; |
96244aca | 156 | DECLARE_QOBJ_TYPE(ospf6_interface); |
718e3744 | 157 | |
508e53e2 | 158 | /* interface state */ |
159 | #define OSPF6_INTERFACE_NONE 0 | |
160 | #define OSPF6_INTERFACE_DOWN 1 | |
161 | #define OSPF6_INTERFACE_LOOPBACK 2 | |
162 | #define OSPF6_INTERFACE_WAITING 3 | |
163 | #define OSPF6_INTERFACE_POINTTOPOINT 4 | |
164 | #define OSPF6_INTERFACE_DROTHER 5 | |
165 | #define OSPF6_INTERFACE_BDR 6 | |
166 | #define OSPF6_INTERFACE_DR 7 | |
167 | #define OSPF6_INTERFACE_MAX 8 | |
168 | ||
2b64873d | 169 | extern const char *const ospf6_interface_state_str[]; |
718e3744 | 170 | |
508e53e2 | 171 | /* flags */ |
172 | #define OSPF6_INTERFACE_DISABLE 0x01 | |
173 | #define OSPF6_INTERFACE_PASSIVE 0x02 | |
c19543b2 | 174 | #define OSPF6_INTERFACE_NOAUTOCOST 0x04 |
718e3744 | 175 | |
b51a3a31 VT |
176 | /* default values */ |
177 | #define OSPF6_INTERFACE_HELLO_INTERVAL 10 | |
178 | #define OSPF6_INTERFACE_DEAD_INTERVAL 40 | |
179 | #define OSPF6_INTERFACE_RXMT_INTERVAL 5 | |
180 | #define OSPF6_INTERFACE_COST 1 | |
181 | #define OSPF6_INTERFACE_PRIORITY 1 | |
182 | #define OSPF6_INTERFACE_TRANSDELAY 1 | |
183 | #define OSPF6_INTERFACE_INSTANCE_ID 0 | |
70bd3c43 DS |
184 | #define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */ |
185 | #define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */ | |
8e370bfa DS |
186 | #define OSPF6_INTERFACE_SSO_RETRY_INT 1 |
187 | #define OSPF6_INTERFACE_SSO_RETRY_MAX 5 | |
b51a3a31 | 188 | |
718e3744 | 189 | /* Function Prototypes */ |
190 | ||
42cabc55 IR |
191 | extern void ospf6_interface_start(struct ospf6_interface *oi); |
192 | extern void ospf6_interface_stop(struct ospf6_interface *oi); | |
193 | ||
c5d28568 K |
194 | extern struct ospf6_interface * |
195 | ospf6_interface_lookup_by_ifindex(ifindex_t, vrf_id_t vrf_id); | |
d62a17ae | 196 | extern struct ospf6_interface *ospf6_interface_create(struct interface *); |
197 | extern void ospf6_interface_delete(struct ospf6_interface *); | |
718e3744 | 198 | |
d62a17ae | 199 | extern void ospf6_interface_enable(struct ospf6_interface *); |
200 | extern void ospf6_interface_disable(struct ospf6_interface *); | |
718e3744 | 201 | |
d62a17ae | 202 | extern void ospf6_interface_state_update(struct interface *); |
203 | extern void ospf6_interface_connected_route_update(struct interface *); | |
f85b7619 | 204 | extern void ospf6_interface_connected_route_add(struct connected *); |
ad500b22 K |
205 | extern struct in6_addr * |
206 | ospf6_interface_get_global_address(struct interface *ifp); | |
508e53e2 | 207 | |
208 | /* interface event */ | |
d62a17ae | 209 | extern int interface_up(struct thread *); |
210 | extern int interface_down(struct thread *); | |
211 | extern int wait_timer(struct thread *); | |
212 | extern int backup_seen(struct thread *); | |
213 | extern int neighbor_change(struct thread *); | |
718e3744 | 214 | |
d62a17ae | 215 | extern void ospf6_interface_init(void); |
f71ed6df | 216 | extern void ospf6_interface_clear(struct interface *ifp); |
718e3744 | 217 | |
d62a17ae | 218 | extern void install_element_ospf6_clear_interface(void); |
a1b11f9b | 219 | |
d62a17ae | 220 | extern int config_write_ospf6_debug_interface(struct vty *vty); |
221 | extern void install_element_ospf6_debug_interface(void); | |
718e3744 | 222 | |
3012671f | 223 | DECLARE_HOOK(ospf6_interface_change, |
d62a17ae | 224 | (struct ospf6_interface * oi, int state, int old_state), |
8451921b | 225 | (oi, state, old_state)); |
3012671f | 226 | |
718e3744 | 227 | #endif /* OSPF6_INTERFACE_H */ |