]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_adjacency.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / isisd / isis_adjacency.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
eb5d44eb 2/*
d62a17ae 3 * IS-IS Rout(e)ing protocol - isis_adjacency.h
eb5d44eb 4 * IS-IS adjacency handling
5 *
6 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 7 * Tampere University of Technology
eb5d44eb 8 * Institute of Communications Engineering
9 *
eb5d44eb 10 */
11
12#ifndef _ZEBRA_ISIS_ADJACENCY_H
13#define _ZEBRA_ISIS_ADJACENCY_H
14
42fe2621
CF
15#include "isisd/isis_tlvs.h"
16
66b9a381
DL
17DECLARE_MTYPE(ISIS_ADJACENCY_INFO);
18
d62a17ae 19enum isis_adj_usage {
20 ISIS_ADJ_NONE,
21 ISIS_ADJ_LEVEL1,
22 ISIS_ADJ_LEVEL2,
23 ISIS_ADJ_LEVEL1AND2
eb5d44eb 24};
25
d62a17ae 26enum isis_system_type {
27 ISIS_SYSTYPE_UNKNOWN,
28 ISIS_SYSTYPE_ES,
29 ISIS_SYSTYPE_IS,
30 ISIS_SYSTYPE_L1_IS,
31 ISIS_SYSTYPE_L2_IS
eb5d44eb 32};
33
d62a17ae 34enum isis_adj_state {
35 ISIS_ADJ_UNKNOWN,
36 ISIS_ADJ_INITIALIZING,
37 ISIS_ADJ_UP,
38 ISIS_ADJ_DOWN
eb5d44eb 39};
40
41/*
42 * we use the following codes to give an indication _why_
43 * a specific adjacency is up or down
44 */
d62a17ae 45enum 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
eb5d44eb 51};
52
f390d2c7 53#define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
eb5d44eb 54
d62a17ae 55struct isis_dis_record {
56 int dis; /* is our neighbor the DIS ? */
57 time_t last_dis_change; /* timestamp for last dis change */
eb5d44eb 58};
59
20a42f01 60struct bfd_session;
26f6acaf 61struct isis_area;
20a42f01 62
d62a17ae 63struct isis_adjacency {
d7c0a89a
QY
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 */
d62a17ae 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];
0c1bd758
CF
70 enum isis_adj_state adj_state; /* adjacencyState */
71 enum isis_adj_usage adj_usage; /* adjacencyUsage */
72 struct area_addr *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;
d62a17ae 77 struct in_addr router_address;
173f8887
OD
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;
d62a17ae 82 struct in6_addr router_address6;
d7c0a89a 83 uint8_t prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
d62a17ae 84 int circuit_t; /* from hello PDU hdr */
85 int level; /* level (1 or 2) */
86 enum isis_system_type sys_type; /* neighbourSystemType */
d7c0a89a 87 uint16_t hold_time; /* entryRemainingTime */
ac716cdf
IR
88 time_t last_upd;
89 time_t last_flap; /* last time the adj flapped */
42fe2621
CF
90 enum isis_threeway_state threeway_state;
91 uint32_t ext_circuit_id;
d62a17ae 92 int flaps; /* number of adjacency flaps */
93 struct thread *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 */
13bf3830 97 struct bfd_session_params *bfd_session;
26f6acaf 98 struct list *adj_sids; /* Segment Routing Adj-SIDs. */
1ee746d9 99 uint32_t snmp_idx;
100 struct listnode *snmp_list_node;
eb5d44eb 101};
102
42fe2621
CF
103struct isis_threeway_adj;
104
d7c0a89a
QY
105struct isis_adjacency *isis_adj_lookup(const uint8_t *sysid,
106 struct list *adjdb);
107struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa,
d62a17ae 108 struct list *adjdb);
75eddbc3
RW
109struct isis_adjacency *isis_adj_find(const struct isis_area *area, int level,
110 const uint8_t *sysid);
d7c0a89a 111struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa,
d62a17ae 112 int level, struct isis_circuit *circuit);
113void isis_delete_adj(void *adj);
42fe2621
CF
114void isis_adj_process_threeway(struct isis_adjacency *adj,
115 struct isis_threeway_adj *tw_adj,
116 enum isis_adj_usage adj_usage);
8451921b 117DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj));
30563683 118DECLARE_HOOK(isis_adj_ip_enabled_hook,
173f8887
OD
119 (struct isis_adjacency * adj, int family, bool global),
120 (adj, family, global));
30563683 121DECLARE_HOOK(isis_adj_ip_disabled_hook,
173f8887
OD
122 (struct isis_adjacency * adj, int family, bool global),
123 (adj, family, global));
7145d5bb
EDP
124void 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);
16167b31 127void isis_adj_state_change(struct isis_adjacency **adj,
d62a17ae 128 enum isis_adj_state state, const char *reason);
129void isis_adj_print(struct isis_adjacency *adj);
2a1c520e 130const char *isis_adj_yang_state(enum isis_adj_state state);
cc9f21da 131void isis_adj_expire(struct thread *thread);
d62a17ae 132void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
133 char detail);
a21177f2
JG
134void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json,
135 char detail);
d62a17ae 136void isis_adj_build_neigh_list(struct list *adjdb, struct list *list);
137void isis_adj_build_up_list(struct list *adjdb, struct list *list);
d8fba7d9 138int isis_adj_usage2levels(enum isis_adj_usage usage);
cc9f21da 139void isis_bfd_startup_timer(struct thread *thread);
0d5b1a3a 140const char *isis_adj_name(const struct isis_adjacency *adj);
eb5d44eb 141#endif /* ISIS_ADJACENCY_H */