]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_adjacency.h
bgpd: fix dereference of null pointer in bgp_attr_aspath
[mirror_frr.git] / isisd / isis_adjacency.h
CommitLineData
eb5d44eb 1/*
d62a17ae 2 * IS-IS Rout(e)ing protocol - isis_adjacency.h
eb5d44eb 3 * IS-IS adjacency handling
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
8 *
9 *
d62a17ae 10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public Licenseas published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
eb5d44eb 13 * any later version.
14 *
d62a17ae 15 * This program is distributed in the hope that it will be useful,but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb5d44eb 18 * more details.
896014f4
DL
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; see the file COPYING; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eb5d44eb 23 */
24
25#ifndef _ZEBRA_ISIS_ADJACENCY_H
26#define _ZEBRA_ISIS_ADJACENCY_H
27
42fe2621
CF
28#include "isisd/isis_tlvs.h"
29
66b9a381
DL
30DECLARE_MTYPE(ISIS_ADJACENCY_INFO);
31
d62a17ae 32enum isis_adj_usage {
33 ISIS_ADJ_NONE,
34 ISIS_ADJ_LEVEL1,
35 ISIS_ADJ_LEVEL2,
36 ISIS_ADJ_LEVEL1AND2
eb5d44eb 37};
38
d62a17ae 39enum isis_system_type {
40 ISIS_SYSTYPE_UNKNOWN,
41 ISIS_SYSTYPE_ES,
42 ISIS_SYSTYPE_IS,
43 ISIS_SYSTYPE_L1_IS,
44 ISIS_SYSTYPE_L2_IS
eb5d44eb 45};
46
d62a17ae 47enum isis_adj_state {
48 ISIS_ADJ_UNKNOWN,
49 ISIS_ADJ_INITIALIZING,
50 ISIS_ADJ_UP,
51 ISIS_ADJ_DOWN
eb5d44eb 52};
53
54/*
55 * we use the following codes to give an indication _why_
56 * a specific adjacency is up or down
57 */
d62a17ae 58enum isis_adj_updown_reason {
59 ISIS_ADJ_REASON_SEENSELF,
60 ISIS_ADJ_REASON_AREA_MISMATCH,
61 ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
62 ISIS_ADJ_REASON_AUTH_FAILED,
63 ISIS_ADJ_REASON_CHECKSUM_FAILED
eb5d44eb 64};
65
f390d2c7 66#define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
eb5d44eb 67
d62a17ae 68struct isis_dis_record {
69 int dis; /* is our neighbor the DIS ? */
70 time_t last_dis_change; /* timestamp for last dis change */
eb5d44eb 71};
72
20a42f01 73struct bfd_session;
26f6acaf 74struct isis_area;
20a42f01 75
d62a17ae 76struct isis_adjacency {
d7c0a89a
QY
77 uint8_t snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
78 uint8_t sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
79 uint8_t lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */
d62a17ae 80 int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */
81 /* an array of N levels for M records */
82 struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS];
0c1bd758
CF
83 enum isis_adj_state adj_state; /* adjacencyState */
84 enum isis_adj_usage adj_usage; /* adjacencyUsage */
85 struct area_addr *area_addresses; /* areaAdressesOfNeighbour */
86 unsigned int area_address_count;
87 struct nlpids nlpids; /* protocols spoken ... */
88 struct in_addr *ipv4_addresses;
89 unsigned int ipv4_address_count;
d62a17ae 90 struct in_addr router_address;
173f8887
OD
91 struct in6_addr *ll_ipv6_addrs; /* Link local IPv6 neighbor address */
92 unsigned int ll_ipv6_count;
93 struct in6_addr *global_ipv6_addrs; /* Global IPv6 neighbor address */
94 unsigned int global_ipv6_count;
d62a17ae 95 struct in6_addr router_address6;
d7c0a89a 96 uint8_t prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
d62a17ae 97 int circuit_t; /* from hello PDU hdr */
98 int level; /* level (1 or 2) */
99 enum isis_system_type sys_type; /* neighbourSystemType */
d7c0a89a 100 uint16_t hold_time; /* entryRemainingTime */
ac716cdf
IR
101 time_t last_upd;
102 time_t last_flap; /* last time the adj flapped */
42fe2621
CF
103 enum isis_threeway_state threeway_state;
104 uint32_t ext_circuit_id;
d62a17ae 105 int flaps; /* number of adjacency flaps */
106 struct thread *t_expire; /* expire after hold_time */
107 struct isis_circuit *circuit; /* back pointer */
108 uint16_t *mt_set; /* Topologies this adjacency is valid for */
109 unsigned int mt_count; /* Number of entries in mt_set */
13bf3830 110 struct bfd_session_params *bfd_session;
26f6acaf 111 struct list *adj_sids; /* Segment Routing Adj-SIDs. */
1ee746d9 112 uint32_t snmp_idx;
113 struct listnode *snmp_list_node;
eb5d44eb 114};
115
42fe2621
CF
116struct isis_threeway_adj;
117
d7c0a89a
QY
118struct isis_adjacency *isis_adj_lookup(const uint8_t *sysid,
119 struct list *adjdb);
120struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa,
d62a17ae 121 struct list *adjdb);
75eddbc3
RW
122struct isis_adjacency *isis_adj_find(const struct isis_area *area, int level,
123 const uint8_t *sysid);
d7c0a89a 124struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa,
d62a17ae 125 int level, struct isis_circuit *circuit);
126void isis_delete_adj(void *adj);
42fe2621
CF
127void isis_adj_process_threeway(struct isis_adjacency *adj,
128 struct isis_threeway_adj *tw_adj,
129 enum isis_adj_usage adj_usage);
8451921b 130DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj));
30563683 131DECLARE_HOOK(isis_adj_ip_enabled_hook,
173f8887
OD
132 (struct isis_adjacency * adj, int family, bool global),
133 (adj, family, global));
30563683 134DECLARE_HOOK(isis_adj_ip_disabled_hook,
173f8887
OD
135 (struct isis_adjacency * adj, int family, bool global),
136 (adj, family, global));
7145d5bb
EDP
137void isis_log_adj_change(struct isis_adjacency *adj,
138 enum isis_adj_state old_state,
139 enum isis_adj_state new_state, const char *reason);
16167b31 140void isis_adj_state_change(struct isis_adjacency **adj,
d62a17ae 141 enum isis_adj_state state, const char *reason);
142void isis_adj_print(struct isis_adjacency *adj);
2a1c520e 143const char *isis_adj_yang_state(enum isis_adj_state state);
cc9f21da 144void isis_adj_expire(struct thread *thread);
d62a17ae 145void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
146 char detail);
a21177f2
JG
147void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json,
148 char detail);
d62a17ae 149void isis_adj_build_neigh_list(struct list *adjdb, struct list *list);
150void isis_adj_build_up_list(struct list *adjdb, struct list *list);
d8fba7d9 151int isis_adj_usage2levels(enum isis_adj_usage usage);
cc9f21da 152void isis_bfd_startup_timer(struct thread *thread);
0d5b1a3a 153const char *isis_adj_name(const struct isis_adjacency *adj);
eb5d44eb 154#endif /* ISIS_ADJACENCY_H */