diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2020-07-01 19:37:16 +0200 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2020-07-01 21:48:38 +0200 |
commit | 7145d5bb3af5ee67f3f5edefb0a44741d079fc85 (patch) | |
tree | c9e3abd6faa02900b16431b2e9498b230fe92bca /isisd/isis_adjacency.c | |
parent | Merge pull request #6657 from donaldsharp/pbr_disable_on_4.9 (diff) | |
download | frr-7145d5bb3af5ee67f3f5edefb0a44741d079fc85.tar.xz frr-7145d5bb3af5ee67f3f5edefb0a44741d079fc85.zip |
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>
Diffstat (limited to 'isisd/isis_adjacency.c')
-rw-r--r-- | isisd/isis_adjacency.c | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 7be61fdf2..66de11e6f 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -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 |