mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
isisd: log adj change when circuit goes down
if we shutdown an interface isisd will delete the adjacencies on the corresponding circuit, but it will not log the change. Fix it to make sure that each change is logged. Also specify the level of the adjacency in the log message, while we are at it. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
8f36f59ad9
commit
7145d5bb3a
@ -207,6 +207,22 @@ static const char *adj_state2string(int state)
|
||||
return NULL; /* not reached */
|
||||
}
|
||||
|
||||
static const char *adj_level2string(int level)
|
||||
{
|
||||
switch (level) {
|
||||
case IS_LEVEL_1:
|
||||
return "level-1";
|
||||
case IS_LEVEL_2:
|
||||
return "level-2";
|
||||
case IS_LEVEL_1_AND_2:
|
||||
return "level-1-2";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
return NULL; /* not reached */
|
||||
}
|
||||
|
||||
void isis_adj_process_threeway(struct isis_adjacency *adj,
|
||||
struct isis_threeway_adj *tw_adj,
|
||||
enum isis_adj_usage adj_usage)
|
||||
@ -259,7 +275,25 @@ 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 *adj_name;
|
||||
struct isis_dynhn *dyn;
|
||||
|
||||
dyn = dynhn_find_by_id(adj->sysid);
|
||||
if (dyn)
|
||||
adj_name = dyn->hostname;
|
||||
else
|
||||
adj_name = sysid_print(adj->sysid);
|
||||
|
||||
zlog_info(
|
||||
"%%ADJCHANGE: Adjacency to %s (%s) for %s changed from %s to %s, %s",
|
||||
adj_name, adj->circuit->interface->name,
|
||||
adj_level2string(adj->level), adj_state2string(old_state),
|
||||
adj_state2string(new_state), reason ? reason : "unspecified");
|
||||
}
|
||||
void isis_adj_state_change(struct isis_adjacency **padj,
|
||||
enum isis_adj_state new_state, const char *reason)
|
||||
{
|
||||
@ -280,23 +314,8 @@ void isis_adj_state_change(struct isis_adjacency **padj,
|
||||
reason ? reason : "unspecified");
|
||||
}
|
||||
|
||||
if (circuit->area->log_adj_changes) {
|
||||
const char *adj_name;
|
||||
struct isis_dynhn *dyn;
|
||||
|
||||
dyn = dynhn_find_by_id(adj->sysid);
|
||||
if (dyn)
|
||||
adj_name = dyn->hostname;
|
||||
else
|
||||
adj_name = sysid_print(adj->sysid);
|
||||
|
||||
zlog_info(
|
||||
"%%ADJCHANGE: Adjacency to %s (%s) changed from %s to %s, %s",
|
||||
adj_name, adj->circuit->interface->name,
|
||||
adj_state2string(old_state),
|
||||
adj_state2string(new_state),
|
||||
reason ? reason : "unspecified");
|
||||
}
|
||||
if (circuit->area->log_adj_changes)
|
||||
isis_log_adj_change(adj, old_state, new_state, reason);
|
||||
|
||||
circuit->adj_state_changes++;
|
||||
#ifndef FABRICD
|
||||
|
@ -126,6 +126,9 @@ DECLARE_HOOK(isis_adj_ip_enabled_hook,
|
||||
(struct isis_adjacency *adj, int family), (adj, family))
|
||||
DECLARE_HOOK(isis_adj_ip_disabled_hook,
|
||||
(struct isis_adjacency *adj, int family), (adj, family))
|
||||
void isis_log_adj_change(struct isis_adjacency *adj,
|
||||
enum isis_adj_state old_state,
|
||||
enum isis_adj_state new_state, const char *reason);
|
||||
void isis_adj_state_change(struct isis_adjacency **adj,
|
||||
enum isis_adj_state state, const char *reason);
|
||||
void isis_adj_print(struct isis_adjacency *adj);
|
||||
|
@ -720,6 +720,43 @@ void isis_circuit_down(struct isis_circuit *circuit)
|
||||
isis_notif_if_state_change(circuit, true);
|
||||
#endif /* ifndef FABRICD */
|
||||
|
||||
/* log adjacency changes if configured to do so */
|
||||
if (circuit->area && circuit->area->log_adj_changes) {
|
||||
struct isis_adjacency *adj = NULL;
|
||||
if (circuit->circ_type == CIRCUIT_T_P2P) {
|
||||
adj = circuit->u.p2p.neighbor;
|
||||
if (adj)
|
||||
isis_log_adj_change(
|
||||
adj, adj->adj_state, ISIS_ADJ_DOWN,
|
||||
"circuit is being brought down");
|
||||
} else if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
|
||||
struct list *adj_list;
|
||||
struct listnode *node;
|
||||
if (circuit->u.bc.adjdb[0]) {
|
||||
adj_list = list_new();
|
||||
isis_adj_build_up_list(circuit->u.bc.adjdb[0],
|
||||
adj_list);
|
||||
for (ALL_LIST_ELEMENTS_RO(adj_list, node, adj))
|
||||
isis_log_adj_change(
|
||||
adj, adj->adj_state,
|
||||
ISIS_ADJ_DOWN,
|
||||
"circuit is being brought down");
|
||||
list_delete(&adj_list);
|
||||
}
|
||||
if (circuit->u.bc.adjdb[1]) {
|
||||
adj_list = list_new();
|
||||
isis_adj_build_up_list(circuit->u.bc.adjdb[1],
|
||||
adj_list);
|
||||
for (ALL_LIST_ELEMENTS_RO(adj_list, node, adj))
|
||||
isis_log_adj_change(
|
||||
adj, adj->adj_state,
|
||||
ISIS_ADJ_DOWN,
|
||||
"circuit is being brought down");
|
||||
list_delete(&adj_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the flags for all the lsps of the circuit. */
|
||||
isis_circuit_update_all_srmflags(circuit, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user