2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
2004-05-18 20:57:06 +02:00
|
|
|
* Copyright (C) 2003 Yasuhiro Ohara
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSPF6_NEIGHBOR_H
|
|
|
|
#define OSPF6_NEIGHBOR_H
|
|
|
|
|
2016-06-12 17:32:23 +02:00
|
|
|
#include "hook.h"
|
|
|
|
|
2021-07-02 18:01:32 +02:00
|
|
|
/* Forward declaration(s). */
|
|
|
|
struct ospf6_area;
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Debug option */
|
|
|
|
extern unsigned char conf_debug_ospf6_neighbor;
|
|
|
|
#define OSPF6_DEBUG_NEIGHBOR_STATE 0x01
|
|
|
|
#define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02
|
|
|
|
#define OSPF6_DEBUG_NEIGHBOR_ON(level) (conf_debug_ospf6_neighbor |= (level))
|
|
|
|
#define OSPF6_DEBUG_NEIGHBOR_OFF(level) (conf_debug_ospf6_neighbor &= ~(level))
|
|
|
|
#define IS_OSPF6_DEBUG_NEIGHBOR(level) \
|
|
|
|
(conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_##level)
|
|
|
|
|
2021-06-25 11:49:47 +02:00
|
|
|
struct ospf6_helper_info {
|
|
|
|
|
|
|
|
/* Grace interval received from
|
|
|
|
* Restarting Router.
|
|
|
|
*/
|
|
|
|
uint32_t recvd_grace_period;
|
|
|
|
|
|
|
|
/* Grace interval used for grace
|
|
|
|
* gracetimer.
|
|
|
|
*/
|
|
|
|
uint32_t actual_grace_period;
|
|
|
|
|
|
|
|
/* Grace timer,This Router acts as
|
|
|
|
* helper until this timer until
|
|
|
|
* this timer expires.
|
|
|
|
*/
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *t_grace_timer;
|
2021-06-25 11:49:47 +02:00
|
|
|
|
|
|
|
/* Helper status */
|
|
|
|
uint32_t gr_helper_status;
|
|
|
|
|
|
|
|
/* Helper exit reason*/
|
|
|
|
uint32_t helper_exit_reason;
|
|
|
|
|
|
|
|
/* Planned/Unplanned restart*/
|
|
|
|
uint32_t gr_restart_reason;
|
|
|
|
|
|
|
|
|
|
|
|
/* Helper rejected reason */
|
|
|
|
uint32_t rejected_reason;
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Neighbor structure */
|
|
|
|
struct ospf6_neighbor {
|
|
|
|
/* Neighbor Router ID String */
|
2018-06-08 01:51:13 +02:00
|
|
|
char name[36];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* OSPFv3 Interface this neighbor belongs to */
|
2004-05-18 20:57:06 +02:00
|
|
|
struct ospf6_interface *ospf6_if;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Neighbor state */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t state;
|
2004-05-18 20:57:06 +02:00
|
|
|
|
|
|
|
/* timestamp of last changing state */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t state_change;
|
2002-12-13 21:15:29 +01:00
|
|
|
struct timeval last_changed;
|
|
|
|
|
2021-04-13 11:37:51 +02:00
|
|
|
/* last received hello */
|
|
|
|
struct timeval last_hello;
|
|
|
|
uint32_t hello_in;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Neighbor Router ID */
|
2020-03-27 13:39:01 +01:00
|
|
|
in_addr_t router_id;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Neighbor Interface ID */
|
2016-01-18 11:12:10 +01:00
|
|
|
ifindex_t ifindex;
|
2004-05-18 20:57:06 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Router Priority of this neighbor */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t priority;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-03-27 13:39:01 +01:00
|
|
|
in_addr_t drouter;
|
|
|
|
in_addr_t bdrouter;
|
|
|
|
in_addr_t prev_drouter;
|
|
|
|
in_addr_t prev_bdrouter;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Options field (Capability) */
|
2002-12-13 21:15:29 +01:00
|
|
|
char options[3];
|
|
|
|
|
2020-09-28 12:48:37 +02:00
|
|
|
/* IPaddr of I/F on neighbour's link */
|
2004-05-18 20:57:06 +02:00
|
|
|
struct in6_addr linklocal_addr;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* For Database Exchange */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t dbdesc_bits;
|
|
|
|
uint32_t dbdesc_seqnum;
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Last received Database Description packet */
|
|
|
|
struct ospf6_dbdesc dbdesc_last;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* LS-list */
|
|
|
|
struct ospf6_lsdb *summary_list;
|
|
|
|
struct ospf6_lsdb *request_list;
|
|
|
|
struct ospf6_lsdb *retrans_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* LSA list for message transmission */
|
|
|
|
struct ospf6_lsdb *dbdesc_list;
|
|
|
|
struct ospf6_lsdb *lsreq_list;
|
|
|
|
struct ospf6_lsdb *lsupdate_list;
|
|
|
|
struct ospf6_lsdb *lsack_list;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2013-08-24 09:55:07 +02:00
|
|
|
struct ospf6_lsa *last_ls_req;
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Inactivity timer */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *inactivity_timer;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2021-03-16 08:45:23 +01:00
|
|
|
/* Timer to release the last dbdesc packet */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *last_dbdesc_release_timer;
|
2021-03-16 08:45:23 +01:00
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Thread for sending message */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *thread_send_dbdesc;
|
|
|
|
struct event *thread_send_lsreq;
|
|
|
|
struct event *thread_send_lsupdate;
|
|
|
|
struct event *thread_send_lsack;
|
|
|
|
struct event *thread_exchange_done;
|
|
|
|
struct event *thread_adj_ok;
|
Support of BFD status in Quagga
Ticket:CM-6802, CM-6952
Reviewed By: Donald, Kanna
Testing Done:
Double commit of b76943235e09472ec174edcf7204fc82d27fe966 from br2.5. But, manually resolved all the compilation errors. Also, modified the shows to support the json format which was not supported in br2.5.
CM-6802 – Currently, BFD session status can be monitored only through ptmctl. There is no way to check the BFD status of a peer/neighbor through Quagga. Debugging becomes easier if BFD status is shown in Quagga too. BFD status is relevant when it is shown against the BGP peer/OSPF neighbor. For, this following code changes have been done:
- Only down messages from PTM were being propagated from Zebra daemon to clients (bgpd, ospfd and ospf6d). Now, both up and down messages are redistributed to the clients from zebra. BFD status field has been added to the messaging. Handling of BFD session up messages has been added to the client code. BGP/OSPF neighbor is brought down only if the old BFD session status is ‘Up’ to handle extra/initial down messages.
- BFD status and last update timestamp fields have been added to the common BFD info structure. Also, common show functions for showing BFD information have been added to BFD lib.
- Modified the BGP neighbor show functions to call common BFD lib functions.
- For ospf and ospf6, BFD information was maintained only at interface level. To show BFD status per neighbor, BFD information has been added at neighbor level too. “show ip ospf interface”, “show ip ospf neighbor detail”, “show ipv6 ospf6 interface” and “show ipv6 ospf6 neighbor detail” output have been modified to show BFD information.
CM-6952 - IBGP peers were always assumed to be multi-hop since there was no easy way to determine whether an IBGP peer was single hop or multihop unlike EBGP. But, this is causing problem with IBGP link local peers since BFD doesn't allow multihop BFD session with link local IP addresses. Link local peers were discovered when the interface peering was enabled. Interface peering is always singlehop. So, added checks to treat all interface based peers as single hop irrespective of whether the peer is IBGP or EBGP.
2015-08-31 23:56:11 +02:00
|
|
|
|
|
|
|
/* BFD information */
|
2021-04-14 17:37:01 +02:00
|
|
|
struct bfd_session_params *bfd_session;
|
2021-06-25 11:49:47 +02:00
|
|
|
|
|
|
|
/* ospf6 graceful restart HELPER info */
|
|
|
|
struct ospf6_helper_info gr_helper_info;
|
2021-05-30 18:33:41 +02:00
|
|
|
|
|
|
|
/* seqnum_h/l is used to compare sequence
|
|
|
|
* number in received packet Auth header
|
|
|
|
*/
|
|
|
|
uint32_t seqnum_h[OSPF6_MESSAGE_TYPE_MAX];
|
|
|
|
uint32_t seqnum_l[OSPF6_MESSAGE_TYPE_MAX];
|
|
|
|
bool auth_present;
|
|
|
|
bool lls_present;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* Neighbor state */
|
|
|
|
#define OSPF6_NEIGHBOR_DOWN 1
|
|
|
|
#define OSPF6_NEIGHBOR_ATTEMPT 2
|
|
|
|
#define OSPF6_NEIGHBOR_INIT 3
|
|
|
|
#define OSPF6_NEIGHBOR_TWOWAY 4
|
|
|
|
#define OSPF6_NEIGHBOR_EXSTART 5
|
|
|
|
#define OSPF6_NEIGHBOR_EXCHANGE 6
|
|
|
|
#define OSPF6_NEIGHBOR_LOADING 7
|
|
|
|
#define OSPF6_NEIGHBOR_FULL 8
|
|
|
|
|
2013-08-26 05:40:16 +02:00
|
|
|
/* Neighbor Events */
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_NO_EVENT 0
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_HELLO_RCVD 1
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD 2
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE 3
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE 4
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_LOADING_DONE 5
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_ADJ_OK 6
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH 7
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_BAD_LSREQ 8
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD 9
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER 10
|
|
|
|
#define OSPF6_NEIGHBOR_EVENT_MAX_EVENT 11
|
|
|
|
|
2019-11-20 17:26:59 +01:00
|
|
|
extern const char *const ospf6_neighbor_event_str[];
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-05-20 03:29:14 +02:00
|
|
|
static inline const char *ospf6_neighbor_event_string(int event)
|
2013-08-26 05:40:16 +02:00
|
|
|
{
|
|
|
|
#define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent"
|
|
|
|
|
|
|
|
if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT)
|
|
|
|
return ospf6_neighbor_event_str[event];
|
|
|
|
return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING;
|
|
|
|
}
|
|
|
|
|
2019-11-20 17:26:59 +01:00
|
|
|
extern const char *const ospf6_neighbor_state_str[];
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Function Prototypes */
|
2004-05-18 20:57:06 +02:00
|
|
|
int ospf6_neighbor_cmp(void *va, void *vb);
|
|
|
|
void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on);
|
|
|
|
|
2021-09-09 22:42:52 +02:00
|
|
|
struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id,
|
|
|
|
struct ospf6_interface *oi);
|
2021-07-02 18:01:32 +02:00
|
|
|
struct ospf6_neighbor *ospf6_area_neighbor_lookup(struct ospf6_area *area,
|
|
|
|
uint32_t router_id);
|
2021-09-09 22:42:52 +02:00
|
|
|
struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id,
|
|
|
|
struct ospf6_interface *oi);
|
|
|
|
void ospf6_neighbor_delete(struct ospf6_neighbor *on);
|
2004-05-18 20:57:06 +02:00
|
|
|
|
|
|
|
/* Neighbor event */
|
2022-03-01 22:18:12 +01:00
|
|
|
extern void hello_received(struct event *thread);
|
|
|
|
extern void twoway_received(struct event *thread);
|
|
|
|
extern void negotiation_done(struct event *thread);
|
|
|
|
extern void exchange_done(struct event *thread);
|
|
|
|
extern void loading_done(struct event *thread);
|
|
|
|
extern void adj_ok(struct event *thread);
|
|
|
|
extern void seqnumber_mismatch(struct event *thread);
|
|
|
|
extern void bad_lsreq(struct event *thread);
|
|
|
|
extern void oneway_received(struct event *thread);
|
|
|
|
extern void inactivity_timer(struct event *thread);
|
2021-09-09 22:42:52 +02:00
|
|
|
extern void ospf6_check_nbr_loading(struct ospf6_neighbor *on);
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
extern void ospf6_neighbor_init(void);
|
|
|
|
extern int config_write_ospf6_debug_neighbor(struct vty *vty);
|
|
|
|
extern void install_element_ospf6_debug_neighbor(void);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2016-06-12 17:32:23 +02:00
|
|
|
DECLARE_HOOK(ospf6_neighbor_change,
|
|
|
|
(struct ospf6_neighbor * on, int state, int next_state),
|
|
|
|
(on, state, next_state));
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* OSPF6_NEIGHBOR_H */
|