fabricd_initial_sync_hello(adj->circuit);
if (next_tw_state == ISIS_THREEWAY_DOWN) {
- isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Neighbor restarted");
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN,
+ "Neighbor restarted");
return;
}
if (next_tw_state == ISIS_THREEWAY_UP) {
if (adj->adj_state != ISIS_ADJ_UP) {
- isis_adj_state_change(adj, ISIS_ADJ_UP, NULL);
+ isis_adj_state_change(&adj, ISIS_ADJ_UP, NULL);
adj->adj_usage = adj_usage;
}
}
adj->threeway_state = next_tw_state;
}
-void isis_adj_state_change(struct isis_adjacency *adj,
+void isis_adj_state_change(struct isis_adjacency **padj,
enum isis_adj_state new_state, const char *reason)
{
+ struct isis_adjacency *adj = *padj;
enum isis_adj_state old_state = adj->adj_state;
struct isis_circuit *circuit = adj->circuit;
- bool del;
+ bool del = false;
adj->adj_state = new_state;
if (new_state != old_state) {
#endif /* ifndef FABRICD */
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
- del = false;
for (int level = IS_LEVEL_1; level <= IS_LEVEL_2; level++) {
if ((adj->level & level) == 0)
continue;
lsp_regenerate_schedule_pseudo(circuit, level);
}
- if (del)
- isis_delete_adj(adj);
-
} else if (circuit->circ_type == CIRCUIT_T_P2P) {
- del = false;
for (int level = IS_LEVEL_1; level <= IS_LEVEL_2; level++) {
if ((adj->level & level) == 0)
continue;
del = true;
}
}
+ }
- if (del)
- isis_delete_adj(adj);
+ if (del) {
+ isis_delete_adj(adj);
+ *padj = NULL;
}
}
adj->t_expire = NULL;
/* trigger the adj expire event */
- isis_adj_state_change(adj, ISIS_ADJ_DOWN, "holding time expired");
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "holding time expired");
return 0;
}
if (memcmp(iih->sys_id, adj->sysid, ISIS_SYS_ID_LEN)) {
zlog_debug(
"hello source and adjacency do not match, set adj down\n");
- isis_adj_state_change(adj, ISIS_ADJ_DOWN,
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN,
"adj do not exist");
return ISIS_OK;
}
* adjacency entry getting added to the lsp tlv neighbor list.
*/
adj->circuit_t = iih->circ_type;
- isis_adj_state_change(adj, ISIS_ADJ_INITIALIZING, NULL);
+ isis_adj_state_change(&adj, ISIS_ADJ_INITIALIZING, NULL);
adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
}
return ISIS_WARNING;
} else if (adj->adj_usage == ISIS_ADJ_LEVEL1) {
/* (6) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
|| (adj->adj_usage
== ISIS_ADJ_LEVEL2)) {
/* (8) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
|| (adj->adj_usage
== ISIS_ADJ_LEVEL1AND2)) {
/* (8) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
|| (adj->adj_usage
== ISIS_ADJ_LEVEL2)) {
/* (8) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
|| (adj->adj_usage
== ISIS_ADJ_LEVEL2)) {
/* (6) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
} else if (adj->adj_usage
== ISIS_ADJ_LEVEL1AND2) {
/* (6) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
if (iih->circuit->area->is_type == IS_LEVEL_1) {
/* 8.2.5.2 b) 1) is_type L1 and adj is not up */
if (adj->adj_state != ISIS_ADJ_UP) {
- isis_adj_state_change(adj, ISIS_ADJ_DOWN,
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN,
"Area Mismatch");
/* 8.2.5.2 b) 2)is_type L1 and adj is up */
} else {
- isis_adj_state_change(adj, ISIS_ADJ_DOWN,
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN,
"Down - Area Mismatch");
}
}
return ISIS_WARNING;
} else if (adj->adj_usage == ISIS_ADJ_LEVEL1) {
/* (7) down - area mismatch */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Area Mismatch");
|| (adj->adj_usage
== ISIS_ADJ_LEVEL2)) {
/* (7) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
}
ISIS_ADJ_LEVEL2);
} else if (adj->adj_usage == ISIS_ADJ_LEVEL1) {
/* (7) down - wrong system */
- isis_adj_state_change(adj,
+ isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
"Wrong System");
} else if (adj->adj_usage
if (iih->circ_type == IS_LEVEL_2) {
/* (7) down - wrong system */
isis_adj_state_change(
- adj, ISIS_ADJ_DOWN,
+ &adj, ISIS_ADJ_DOWN,
"Wrong System");
} else {
/* (7) down - area mismatch */
isis_adj_state_change(
- adj, ISIS_ADJ_DOWN,
+ &adj, ISIS_ADJ_DOWN,
"Area Mismatch");
}
}
}
} else {
/* down - area mismatch */
- isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Area Mismatch");
+ isis_adj_state_change(&adj, ISIS_ADJ_DOWN, "Area Mismatch");
}
- if (adj->adj_state == ISIS_ADJ_UP && changed) {
- lsp_regenerate_schedule(adj->circuit->area,
- isis_adj_usage2levels(adj->adj_usage),
- 0);
- }
+ if (adj) {
+ if (adj->adj_state == ISIS_ADJ_UP && changed) {
+ lsp_regenerate_schedule(
+ adj->circuit->area,
+ isis_adj_usage2levels(adj->adj_usage), 0);
+ }
- /* 8.2.5.2 c) if the action was up - comparing circuit IDs */
- /* FIXME - Missing parts */
+ /* 8.2.5.2 c) if the action was up - comparing circuit IDs */
+ /* FIXME - Missing parts */
- /* some of my own understanding of the ISO, why the heck does
- * it not say what should I change the system_type to...
- */
- switch (adj->adj_usage) {
- case ISIS_ADJ_LEVEL1:
- adj->sys_type = ISIS_SYSTYPE_L1_IS;
- break;
- case ISIS_ADJ_LEVEL2:
- adj->sys_type = ISIS_SYSTYPE_L2_IS;
- break;
- case ISIS_ADJ_LEVEL1AND2:
- adj->sys_type = ISIS_SYSTYPE_L2_IS;
- break;
- case ISIS_ADJ_NONE:
- adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
- break;
+ /* some of my own understanding of the ISO, why the heck does
+ * it not say what should I change the system_type to...
+ */
+ switch (adj->adj_usage) {
+ case ISIS_ADJ_LEVEL1:
+ adj->sys_type = ISIS_SYSTYPE_L1_IS;
+ break;
+ case ISIS_ADJ_LEVEL2:
+ adj->sys_type = ISIS_SYSTYPE_L2_IS;
+ break;
+ case ISIS_ADJ_LEVEL1AND2:
+ adj->sys_type = ISIS_SYSTYPE_L2_IS;
+ break;
+ case ISIS_ADJ_NONE:
+ adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
+ break;
+ }
}
if (isis->debugs & DEBUG_ADJ_PACKETS) {
}
adj->level = iih->level;
}
- isis_adj_state_change(adj, ISIS_ADJ_INITIALIZING, NULL);
+ isis_adj_state_change(&adj, ISIS_ADJ_INITIALIZING, NULL);
if (iih->level == IS_LEVEL_1)
adj->sys_type = ISIS_SYSTYPE_L1_IS;
if (adj->adj_state != ISIS_ADJ_UP) {
if (own_snpa_found) {
isis_adj_state_change(
- adj, ISIS_ADJ_UP,
+ &adj, ISIS_ADJ_UP,
"own SNPA found in LAN Neighbours TLV");
}
} else {
if (!own_snpa_found) {
isis_adj_state_change(
- adj, ISIS_ADJ_INITIALIZING,
+ &adj, ISIS_ADJ_INITIALIZING,
"own SNPA not found in LAN Neighbours TLV");
}
}