1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IS-IS Rout(e)ing protocol - isis_adjacency.h
4 * IS-IS adjacency handling
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
12 #ifndef _ZEBRA_ISIS_ADJACENCY_H
13 #define _ZEBRA_ISIS_ADJACENCY_H
15 #include "isisd/isis_tlvs.h"
17 DECLARE_MTYPE(ISIS_ADJACENCY_INFO
);
26 enum isis_system_type
{
36 ISIS_ADJ_INITIALIZING
,
42 * we use the following codes to give an indication _why_
43 * a specific adjacency is up or down
45 enum isis_adj_updown_reason
{
46 ISIS_ADJ_REASON_SEENSELF
,
47 ISIS_ADJ_REASON_AREA_MISMATCH
,
48 ISIS_ADJ_REASON_HOLDTIMER_EXPIRED
,
49 ISIS_ADJ_REASON_AUTH_FAILED
,
50 ISIS_ADJ_REASON_CHECKSUM_FAILED
53 #define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
55 struct isis_dis_record
{
56 int dis
; /* is our neighbor the DIS ? */
57 time_t last_dis_change
; /* timestamp for last dis change */
63 struct isis_adjacency
{
64 uint8_t snpa
[ETH_ALEN
]; /* NeighbourSNPAAddress */
65 uint8_t sysid
[ISIS_SYS_ID_LEN
]; /* neighbourSystemIdentifier */
66 uint8_t lanid
[ISIS_SYS_ID_LEN
+ 1]; /* LAN id on bcast circuits */
67 int dischanges
[ISIS_LEVELS
]; /* how many DIS changes ? */
68 /* an array of N levels for M records */
69 struct isis_dis_record dis_record
[DIS_RECORDS
* ISIS_LEVELS
];
70 enum isis_adj_state adj_state
; /* adjacencyState */
71 enum isis_adj_usage adj_usage
; /* adjacencyUsage */
72 struct iso_address
*area_addresses
; /* areaAdressesOfNeighbour */
73 unsigned int area_address_count
;
74 struct nlpids nlpids
; /* protocols spoken ... */
75 struct in_addr
*ipv4_addresses
;
76 unsigned int ipv4_address_count
;
77 struct in_addr router_address
;
78 struct in6_addr
*ll_ipv6_addrs
; /* Link local IPv6 neighbor address */
79 unsigned int ll_ipv6_count
;
80 struct in6_addr
*global_ipv6_addrs
; /* Global IPv6 neighbor address */
81 unsigned int global_ipv6_count
;
82 struct in6_addr router_address6
;
83 uint8_t prio
[ISIS_LEVELS
]; /* priorityOfNeighbour for DIS */
84 int circuit_t
; /* from hello PDU hdr */
85 int level
; /* level (1 or 2) */
86 enum isis_system_type sys_type
; /* neighbourSystemType */
87 uint16_t hold_time
; /* entryRemainingTime */
89 time_t last_flap
; /* last time the adj flapped */
90 enum isis_threeway_state threeway_state
;
91 uint32_t ext_circuit_id
;
92 int flaps
; /* number of adjacency flaps */
93 struct event
*t_expire
; /* expire after hold_time */
94 struct isis_circuit
*circuit
; /* back pointer */
95 uint16_t *mt_set
; /* Topologies this adjacency is valid for */
96 unsigned int mt_count
; /* Number of entries in mt_set */
97 struct bfd_session_params
*bfd_session
;
98 struct list
*adj_sids
; /* Segment Routing Adj-SIDs. */
100 struct listnode
*snmp_list_node
;
103 struct isis_threeway_adj
;
105 struct isis_adjacency
*isis_adj_lookup(const uint8_t *sysid
,
107 struct isis_adjacency
*isis_adj_lookup_snpa(const uint8_t *ssnpa
,
109 struct isis_adjacency
*isis_adj_find(const struct isis_area
*area
, int level
,
110 const uint8_t *sysid
);
111 struct isis_adjacency
*isis_new_adj(const uint8_t *id
, const uint8_t *snpa
,
112 int level
, struct isis_circuit
*circuit
);
113 void isis_delete_adj(void *adj
);
114 void isis_adj_process_threeway(struct isis_adjacency
*adj
,
115 struct isis_threeway_adj
*tw_adj
,
116 enum isis_adj_usage adj_usage
);
117 DECLARE_HOOK(isis_adj_state_change_hook
, (struct isis_adjacency
*adj
), (adj
));
118 DECLARE_HOOK(isis_adj_ip_enabled_hook
,
119 (struct isis_adjacency
* adj
, int family
, bool global
),
120 (adj
, family
, global
));
121 DECLARE_HOOK(isis_adj_ip_disabled_hook
,
122 (struct isis_adjacency
* adj
, int family
, bool global
),
123 (adj
, family
, global
));
124 void isis_log_adj_change(struct isis_adjacency
*adj
,
125 enum isis_adj_state old_state
,
126 enum isis_adj_state new_state
, const char *reason
);
127 void isis_adj_state_change(struct isis_adjacency
**adj
,
128 enum isis_adj_state state
, const char *reason
);
129 void isis_adj_print(struct isis_adjacency
*adj
);
130 const char *isis_adj_yang_state(enum isis_adj_state state
);
131 void isis_adj_expire(struct event
*thread
);
132 void isis_adj_print_vty(struct isis_adjacency
*adj
, struct vty
*vty
,
134 void isis_adj_print_json(struct isis_adjacency
*adj
, struct json_object
*json
,
136 void isis_adj_build_neigh_list(struct list
*adjdb
, struct list
*list
);
137 void isis_adj_build_up_list(struct list
*adjdb
, struct list
*list
);
138 int isis_adj_usage2levels(enum isis_adj_usage usage
);
139 void isis_bfd_startup_timer(struct event
*thread
);
140 const char *isis_adj_name(const struct isis_adjacency
*adj
);
141 #endif /* ISIS_ADJACENCY_H */