summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isisd/isis_adjacency.c26
-rw-r--r--isisd/isis_adjacency.h1
-rw-r--r--isisd/isis_bfd.c77
3 files changed, 79 insertions, 25 deletions
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index 3c3a68764e..744f5761c9 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -260,22 +260,26 @@ void isis_adj_process_threeway(struct isis_adjacency *adj,
adj->threeway_state = next_tw_state;
}
-void isis_log_adj_change(struct isis_adjacency *adj,
- enum isis_adj_state old_state,
- enum isis_adj_state new_state, const char *reason)
+const char *isis_adj_name(const struct isis_adjacency *adj)
{
- const char *adj_name;
+ if (!adj)
+ return "NONE";
+
struct isis_dynhn *dyn;
dyn = dynhn_find_by_id(adj->sysid);
if (dyn)
- adj_name = dyn->hostname;
+ return dyn->hostname;
else
- adj_name = sysid_print(adj->sysid);
-
+ return sysid_print(adj->sysid);
+}
+void isis_log_adj_change(struct isis_adjacency *adj,
+ enum isis_adj_state old_state,
+ enum isis_adj_state new_state, const char *reason)
+{
zlog_info(
"%%ADJCHANGE: Adjacency to %s (%s) for %s changed from %s to %s, %s",
- adj_name, adj->circuit->interface->name,
+ isis_adj_name(adj), adj->circuit->interface->name,
adj_level2string(adj->level), adj_state2string(old_state),
adj_state2string(new_state), reason ? reason : "unspecified");
}
@@ -462,11 +466,7 @@ void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty,
struct isis_dynhn *dyn;
int level;
- dyn = dynhn_find_by_id(adj->sysid);
- if (dyn)
- vty_out(vty, " %-20s", dyn->hostname);
- else
- vty_out(vty, " %-20s", sysid_print(adj->sysid));
+ vty_out(vty, " %-20s", isis_adj_name(adj));
if (detail == ISIS_UI_LEVEL_BRIEF) {
if (adj->circuit)
diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h
index 3afb7209f3..b517a8e03f 100644
--- a/isisd/isis_adjacency.h
+++ b/isisd/isis_adjacency.h
@@ -142,5 +142,6 @@ void isis_adj_build_neigh_list(struct list *adjdb, struct list *list);
void isis_adj_build_up_list(struct list *adjdb, struct list *list);
int isis_adj_usage2levels(enum isis_adj_usage usage);
int isis_bfd_startup_timer(struct thread *thread);
+const char *isis_adj_name(const struct isis_adjacency *adj);
#endif /* ISIS_ADJACENCY_H */
diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c
index 4fac73511b..8386ada761 100644
--- a/isisd/isis_bfd.c
+++ b/isisd/isis_bfd.c
@@ -92,22 +92,42 @@ static bool bfd_session_same(const struct bfd_session *session, int family,
static void bfd_adj_event(struct isis_adjacency *adj, struct prefix *dst,
int new_status)
{
- if (!adj->bfd_session)
+ if (!adj->bfd_session) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update for adjacency with %s, could not find bfd session on the adjacency",
+ isis_adj_name(adj));
return;
+ }
- if (adj->bfd_session->family != dst->family)
+ if (adj->bfd_session->family != dst->family) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update for adjacency with %s, address family does not match the family on the adjacency",
+ isis_adj_name(adj));
return;
+ }
switch (adj->bfd_session->family) {
case AF_INET:
if (!IPV4_ADDR_SAME(&adj->bfd_session->dst_ip.ipv4,
- &dst->u.prefix4))
+ &dst->u.prefix4)) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update for adjacency with %s, IPv4 address does not match",
+ isis_adj_name(adj));
return;
+ }
break;
case AF_INET6:
if (!IPV6_ADDR_SAME(&adj->bfd_session->dst_ip.ipv6,
- &dst->u.prefix6))
+ &dst->u.prefix6)) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update for adjacency with %s, IPv6 address does not match",
+ isis_adj_name(adj));
return;
+ }
break;
default:
flog_err(EC_LIB_DEVELOPMENT, "%s: unknown address-family: %u",
@@ -119,8 +139,13 @@ static void bfd_adj_event(struct isis_adjacency *adj, struct prefix *dst,
BFD_SET_CLIENT_STATUS(adj->bfd_session->status, new_status);
- if (old_status == new_status)
+ if (old_status == new_status) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update for adjacency with %s, new status matches current known status",
+ isis_adj_name(adj));
return;
+ }
if (IS_DEBUG_BFD) {
char dst_str[INET6_ADDRSTRLEN];
@@ -166,8 +191,12 @@ static int isis_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
struct isis_circuit *circuit = circuit_scan_by_ifp(ifp);
- if (!circuit)
+ if (!circuit) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: Ignoring update, could not find circuit");
return 0;
+ }
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
@@ -326,15 +355,26 @@ static void bfd_handle_adj_up(struct isis_adjacency *adj, int command)
struct list *local_ips;
struct prefix *local_ip;
- if (!circuit->bfd_info)
+ if (!circuit->bfd_info) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: skipping BFD initialization on adjacency with %s because there is no bfd_info in the circuit",
+ isis_adj_name(adj));
goto out;
+ }
/* If IS-IS IPv6 is configured wait for IPv6 address to be programmed
* before starting up BFD
*/
- if ((circuit->ipv6_router && listcount(circuit->ipv6_link) == 0)
- || adj->ipv6_address_count == 0)
+ if (circuit->ipv6_router
+ && (listcount(circuit->ipv6_link) == 0
+ || adj->ipv6_address_count == 0)) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: skipping BFD initialization on adjacency with %s because IPv6 is enabled but not ready",
+ isis_adj_name(adj));
return;
+ }
/*
* If IS-IS is enabled for both IPv4 and IPv6 on the circuit, prefer
@@ -344,16 +384,24 @@ static void bfd_handle_adj_up(struct isis_adjacency *adj, int command)
family = AF_INET6;
dst_ip.ipv6 = adj->ipv6_addresses[0];
local_ips = circuit->ipv6_link;
- if (!local_ips || list_isempty(local_ips))
+ if (!local_ips || list_isempty(local_ips)) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: skipping BFD initialization: IPv6 enabled and no local IPv6 addresses");
goto out;
+ }
local_ip = listgetdata(listhead(local_ips));
src_ip.ipv6 = local_ip->u.prefix6;
} else if (circuit->ip_router && adj->ipv4_address_count) {
family = AF_INET;
dst_ip.ipv4 = adj->ipv4_addresses[0];
local_ips = fabricd_ip_addrs(adj->circuit);
- if (!local_ips || list_isempty(local_ips))
+ if (!local_ips || list_isempty(local_ips)) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: skipping BFD initialization: IPv4 enabled and no local IPv4 addresses");
goto out;
+ }
local_ip = listgetdata(listhead(local_ips));
src_ip.ipv4 = local_ip->u.prefix4;
} else
@@ -365,8 +413,13 @@ static void bfd_handle_adj_up(struct isis_adjacency *adj, int command)
bfd_handle_adj_down(adj);
}
- if (!adj->bfd_session)
+ if (!adj->bfd_session) {
+ if (IS_DEBUG_BFD)
+ zlog_debug(
+ "ISIS-BFD: creating BFD session for adjacency with %s",
+ isis_adj_name(adj));
adj->bfd_session = bfd_session_new(family, &dst_ip, &src_ip);
+ }
bfd_debug(adj->bfd_session->family, &adj->bfd_session->dst_ip,
&adj->bfd_session->src_ip, circuit->interface->name, command);