]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_neighbor.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ospf6d / ospf6_neighbor.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/*
508e53e2 3 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 4 */
5
6#ifndef OSPF6_NEIGHBOR_H
7#define OSPF6_NEIGHBOR_H
8
3012671f
DL
9#include "hook.h"
10
71165098
RW
11/* Forward declaration(s). */
12struct ospf6_area;
13
508e53e2 14/* Debug option */
15extern unsigned char conf_debug_ospf6_neighbor;
16#define OSPF6_DEBUG_NEIGHBOR_STATE 0x01
17#define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02
d62a17ae 18#define OSPF6_DEBUG_NEIGHBOR_ON(level) (conf_debug_ospf6_neighbor |= (level))
19#define OSPF6_DEBUG_NEIGHBOR_OFF(level) (conf_debug_ospf6_neighbor &= ~(level))
20#define IS_OSPF6_DEBUG_NEIGHBOR(level) \
21 (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_##level)
508e53e2 22
91c169f7 23struct ospf6_helper_info {
24
25 /* Grace interval received from
26 * Restarting Router.
27 */
28 uint32_t recvd_grace_period;
29
30 /* Grace interval used for grace
31 * gracetimer.
32 */
33 uint32_t actual_grace_period;
34
35 /* Grace timer,This Router acts as
36 * helper until this timer until
37 * this timer expires.
38 */
39 struct thread *t_grace_timer;
40
41 /* Helper status */
42 uint32_t gr_helper_status;
43
44 /* Helper exit reason*/
45 uint32_t helper_exit_reason;
46
47 /* Planned/Unplanned restart*/
48 uint32_t gr_restart_reason;
49
50
51 /* Helper rejected reason */
52 uint32_t rejected_reason;
53};
54
718e3744 55/* Neighbor structure */
d62a17ae 56struct ospf6_neighbor {
57 /* Neighbor Router ID String */
ff44f570 58 char name[36];
718e3744 59
d62a17ae 60 /* OSPFv3 Interface this neighbor belongs to */
61 struct ospf6_interface *ospf6_if;
718e3744 62
d62a17ae 63 /* Neighbor state */
d7c0a89a 64 uint8_t state;
508e53e2 65
d62a17ae 66 /* timestamp of last changing state */
d7c0a89a 67 uint32_t state_change;
d62a17ae 68 struct timeval last_changed;
718e3744 69
bb382e24
PR
70 /* last received hello */
71 struct timeval last_hello;
72 uint32_t hello_in;
73
d62a17ae 74 /* Neighbor Router ID */
858f9c08 75 in_addr_t router_id;
718e3744 76
d62a17ae 77 /* Neighbor Interface ID */
78 ifindex_t ifindex;
508e53e2 79
d62a17ae 80 /* Router Priority of this neighbor */
d7c0a89a 81 uint8_t priority;
718e3744 82
858f9c08
DL
83 in_addr_t drouter;
84 in_addr_t bdrouter;
85 in_addr_t prev_drouter;
86 in_addr_t prev_bdrouter;
718e3744 87
d62a17ae 88 /* Options field (Capability) */
89 char options[3];
718e3744 90
6a5bb300 91 /* IPaddr of I/F on neighbour's link */
d62a17ae 92 struct in6_addr linklocal_addr;
718e3744 93
d62a17ae 94 /* For Database Exchange */
d7c0a89a
QY
95 uint8_t dbdesc_bits;
96 uint32_t dbdesc_seqnum;
d62a17ae 97 /* Last received Database Description packet */
98 struct ospf6_dbdesc dbdesc_last;
718e3744 99
d62a17ae 100 /* LS-list */
101 struct ospf6_lsdb *summary_list;
102 struct ospf6_lsdb *request_list;
103 struct ospf6_lsdb *retrans_list;
718e3744 104
d62a17ae 105 /* LSA list for message transmission */
106 struct ospf6_lsdb *dbdesc_list;
107 struct ospf6_lsdb *lsreq_list;
108 struct ospf6_lsdb *lsupdate_list;
109 struct ospf6_lsdb *lsack_list;
718e3744 110
d62a17ae 111 struct ospf6_lsa *last_ls_req;
eb82e9ee 112
d62a17ae 113 /* Inactivity timer */
114 struct thread *inactivity_timer;
718e3744 115
bc09f3e6
YR
116 /* Timer to release the last dbdesc packet */
117 struct thread *last_dbdesc_release_timer;
118
d62a17ae 119 /* Thread for sending message */
120 struct thread *thread_send_dbdesc;
121 struct thread *thread_send_lsreq;
122 struct thread *thread_send_lsupdate;
123 struct thread *thread_send_lsack;
9318fc6a 124 struct thread *thread_exchange_done;
81e06dd3 125 struct thread *thread_adj_ok;
68fe91d6 126
d62a17ae 127 /* BFD information */
d06cc416 128 struct bfd_session_params *bfd_session;
91c169f7 129
130 /* ospf6 graceful restart HELPER info */
131 struct ospf6_helper_info gr_helper_info;
6cb85350
AR
132
133 /* seqnum_h/l is used to compare sequence
134 * number in received packet Auth header
135 */
136 uint32_t seqnum_h[OSPF6_MESSAGE_TYPE_MAX];
137 uint32_t seqnum_l[OSPF6_MESSAGE_TYPE_MAX];
138 bool auth_present;
139 bool lls_present;
718e3744 140};
141
508e53e2 142/* Neighbor state */
143#define OSPF6_NEIGHBOR_DOWN 1
144#define OSPF6_NEIGHBOR_ATTEMPT 2
145#define OSPF6_NEIGHBOR_INIT 3
146#define OSPF6_NEIGHBOR_TWOWAY 4
147#define OSPF6_NEIGHBOR_EXSTART 5
148#define OSPF6_NEIGHBOR_EXCHANGE 6
149#define OSPF6_NEIGHBOR_LOADING 7
150#define OSPF6_NEIGHBOR_FULL 8
151
3d35ca48
DD
152/* Neighbor Events */
153#define OSPF6_NEIGHBOR_EVENT_NO_EVENT 0
154#define OSPF6_NEIGHBOR_EVENT_HELLO_RCVD 1
155#define OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD 2
156#define OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE 3
157#define OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE 4
158#define OSPF6_NEIGHBOR_EVENT_LOADING_DONE 5
159#define OSPF6_NEIGHBOR_EVENT_ADJ_OK 6
160#define OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH 7
161#define OSPF6_NEIGHBOR_EVENT_BAD_LSREQ 8
162#define OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD 9
163#define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER 10
164#define OSPF6_NEIGHBOR_EVENT_MAX_EVENT 11
165
2b64873d 166extern const char *const ospf6_neighbor_event_str[];
d62a17ae 167
168static inline const char *ospf6_neighbor_event_string(int event)
3d35ca48 169{
d62a17ae 170#define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent"
3d35ca48 171
d62a17ae 172 if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT)
173 return ospf6_neighbor_event_str[event];
174 return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING;
3d35ca48
DD
175}
176
2b64873d 177extern const char *const ospf6_neighbor_state_str[];
718e3744 178
6b0655a2 179
718e3744 180/* Function Prototypes */
d62a17ae 181int ospf6_neighbor_cmp(void *va, void *vb);
182void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on);
508e53e2 183
7932dd93
DS
184struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id,
185 struct ospf6_interface *oi);
71165098
RW
186struct ospf6_neighbor *ospf6_area_neighbor_lookup(struct ospf6_area *area,
187 uint32_t router_id);
7932dd93
DS
188struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id,
189 struct ospf6_interface *oi);
190void ospf6_neighbor_delete(struct ospf6_neighbor *on);
508e53e2 191
192/* Neighbor event */
cc9f21da
DS
193extern void hello_received(struct thread *thread);
194extern void twoway_received(struct thread *thread);
195extern void negotiation_done(struct thread *thread);
196extern void exchange_done(struct thread *thread);
197extern void loading_done(struct thread *thread);
198extern void adj_ok(struct thread *thread);
199extern void seqnumber_mismatch(struct thread *thread);
200extern void bad_lsreq(struct thread *thread);
201extern void oneway_received(struct thread *thread);
202extern void inactivity_timer(struct thread *thread);
7932dd93 203extern void ospf6_check_nbr_loading(struct ospf6_neighbor *on);
d62a17ae 204
205extern void ospf6_neighbor_init(void);
206extern int config_write_ospf6_debug_neighbor(struct vty *vty);
207extern void install_element_ospf6_debug_neighbor(void);
718e3744 208
3012671f 209DECLARE_HOOK(ospf6_neighbor_change,
d62a17ae 210 (struct ospf6_neighbor * on, int state, int next_state),
8451921b 211 (on, state, next_state));
3012671f 212
718e3744 213#endif /* OSPF6_NEIGHBOR_H */