diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2021-03-18 12:45:23 +0100 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2021-03-18 12:49:10 +0100 |
commit | 0d5b1a3a79d4c026877fd3c0a803ce065852bcf1 (patch) | |
tree | 669970637a568c95f5a17df1b72c37e49895b68a /isisd | |
parent | Merge pull request #8284 from mjstapp/fix_bgp_zero_timers (diff) | |
download | frr-0d5b1a3a79d4c026877fd3c0a803ce065852bcf1.tar.xz frr-0d5b1a3a79d4c026877fd3c0a803ce065852bcf1.zip |
isisd: fix BFD session when IPv6 not configured
A wrong check was silently skipping the initialization of the bfd_session
struct in the adjacency if the router was not configured for IPv6. This
would cause BFD events to be ignored regardless of the configuration.
Also add a function to return the "name" of an adjacency and use it in a
couple of places, including the new log, instead of repeating the same
code in a bunch of places.
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_adjacency.c | 26 | ||||
-rw-r--r-- | isisd/isis_adjacency.h | 1 | ||||
-rw-r--r-- | isisd/isis_bfd.c | 10 |
3 files changed, 22 insertions, 15 deletions
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 3c3a68764..744f5761c 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 3afb7209f..b517a8e03 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 4fac73511..4acdc2c2d 100644 --- a/isisd/isis_bfd.c +++ b/isisd/isis_bfd.c @@ -332,9 +332,15 @@ static void bfd_handle_adj_up(struct isis_adjacency *adj, int command) /* 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 |