mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:04:32 +00:00
Merge pull request #6665 from volta-networks/fix_isis_adj_log
isisd: log adj change when circuit goes down
This commit is contained in:
commit
b93caca965
@ -207,6 +207,22 @@ static const char *adj_state2string(int state)
|
|||||||
return NULL; /* not reached */
|
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,
|
void isis_adj_process_threeway(struct isis_adjacency *adj,
|
||||||
struct isis_threeway_adj *tw_adj,
|
struct isis_threeway_adj *tw_adj,
|
||||||
enum isis_adj_usage adj_usage)
|
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;
|
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,
|
void isis_adj_state_change(struct isis_adjacency **padj,
|
||||||
enum isis_adj_state new_state, const char *reason)
|
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");
|
reason ? reason : "unspecified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (circuit->area->log_adj_changes) {
|
if (circuit->area->log_adj_changes)
|
||||||
const char *adj_name;
|
isis_log_adj_change(adj, old_state, new_state, reason);
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
circuit->adj_state_changes++;
|
circuit->adj_state_changes++;
|
||||||
#ifndef FABRICD
|
#ifndef FABRICD
|
||||||
|
@ -126,6 +126,9 @@ DECLARE_HOOK(isis_adj_ip_enabled_hook,
|
|||||||
(struct isis_adjacency *adj, int family), (adj, family))
|
(struct isis_adjacency *adj, int family), (adj, family))
|
||||||
DECLARE_HOOK(isis_adj_ip_disabled_hook,
|
DECLARE_HOOK(isis_adj_ip_disabled_hook,
|
||||||
(struct isis_adjacency *adj, int family), (adj, family))
|
(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,
|
void isis_adj_state_change(struct isis_adjacency **adj,
|
||||||
enum isis_adj_state state, const char *reason);
|
enum isis_adj_state state, const char *reason);
|
||||||
void isis_adj_print(struct isis_adjacency *adj);
|
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);
|
isis_notif_if_state_change(circuit, true);
|
||||||
#endif /* ifndef FABRICD */
|
#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. */
|
/* Clear the flags for all the lsps of the circuit. */
|
||||||
isis_circuit_update_all_srmflags(circuit, 0);
|
isis_circuit_update_all_srmflags(circuit, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user