void isis_circuit_is_type_set (struct isis_circuit *circuit, int newtype) { if (circuit->state != C_STATE_UP) { circuit->is_type = newtype; return; } if (isis->debugs & DEBUG_EVENTS) zlog_debug ("ISIS-Evt (%s) circuit type change %s -> %s", circuit->area->area_tag, circuit_t2string (circuit->is_type), circuit_t2string (newtype)); if (circuit->is_type == newtype) return; /* No change */ if (!(newtype & circuit->area->is_type)) { zlog_err ("ISIS-Evt (%s) circuit type change - invalid level %s because" " area is %s", circuit->area->area_tag, circuit_t2string (newtype), circuit_t2string (circuit->area->is_type)); return; } if (! circuit->is_passive) { switch (circuit->is_type) { case IS_LEVEL_1: if (newtype == IS_LEVEL_2) circuit_resign_level (circuit, 1); circuit_commence_level (circuit, 2); break; case IS_LEVEL_1_AND_2: if (newtype == IS_LEVEL_1) circuit_resign_level (circuit, 2); else circuit_resign_level (circuit, 1); break; case IS_LEVEL_2: if (newtype == IS_LEVEL_1) circuit_resign_level (circuit, 2); circuit_commence_level (circuit, 1); break; default: break; } } circuit->is_type = newtype; lsp_regenerate_schedule (circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0); return; }
void isis_event_circuit_type_change (struct isis_circuit *circuit, int newtype) { Log(LOG_DEBUG, "DEBUG (default/core/ISIS ): ISIS-Evt (%s) circuit type change %s -> %s\n", circuit->area->area_tag, circuit_t2string (circuit->circuit_is_type), circuit_t2string (newtype)); if (circuit->circuit_is_type == newtype) return; /* No change */ if (!(newtype & circuit->area->is_type)) { Log(LOG_ERR, "ERROR (default/core/ISIS ): ISIS-Evt (%s) circuit type change - invalid level %s because area is %s\n", circuit->area->area_tag, circuit_t2string (newtype), circuit_t2string (circuit->area->is_type)); return; } switch (circuit->circuit_is_type) { case IS_LEVEL_1: if (newtype == IS_LEVEL_2) circuit_resign_level (circuit, 1); circuit_commence_level (circuit, 2); break; case IS_LEVEL_1_AND_2: if (newtype == IS_LEVEL_1) circuit_resign_level (circuit, 2); else circuit_resign_level (circuit, 1); break; case IS_LEVEL_2: if (newtype == IS_LEVEL_1) circuit_resign_level (circuit, 2); circuit_commence_level (circuit, 1); break; default: break; } circuit->circuit_is_type = newtype; lsp_regenerate_schedule (circuit->area); return; }
void isis_event_system_type_change (struct isis_area *area, int newtype) { struct listnode *node; struct isis_circuit *circuit; Log(LOG_DEBUG, "DEBUG (default/core/ISIS ): ISIS-Evt (%s) system type change %s -> %s\n", area->area_tag, circuit_t2string (area->is_type), circuit_t2string (newtype)); if (area->is_type == newtype) return; /* No change */ switch (area->is_type) { case IS_LEVEL_1: if (area->lspdb[1] == NULL) area->lspdb[1] = lsp_db_init (); lsp_l2_generate (area); break; case IS_LEVEL_1_AND_2: if (newtype == IS_LEVEL_1) { lsp_db_destroy (area->lspdb[1]); } else { lsp_db_destroy (area->lspdb[0]); } break; case IS_LEVEL_2: if (area->lspdb[0] == NULL) area->lspdb[0] = lsp_db_init (); lsp_l1_generate (area); break; default: break; } area->is_type = newtype; for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit)) isis_event_circuit_type_change (circuit, newtype); spftree_area_init (area); lsp_regenerate_schedule (area); return; }
/* * show clns/isis neighbor (detail) */ void isis_adj_print_vty2 (struct isis_adjacency *adj, struct vty *vty, char detail) { #ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; u_char ip6[INET6_ADDRSTRLEN]; #endif /* HAVE_IPV6 */ struct in_addr *ip_addr; time_t now; struct isis_dynhn *dyn; int level; struct listnode *node; dyn = dynhn_find_by_id (adj->sysid); if (dyn) vty_out (vty, " %-20s", dyn->name.name); else if (adj->sysid) { vty_out (vty, " %-20s", sysid_print (adj->sysid)); } else { vty_out (vty, " unknown "); } if (detail == ISIS_UI_LEVEL_BRIEF) { if (adj->circuit) vty_out (vty, "%-12s", adj->circuit->interface->name); else vty_out (vty, "NULL circuit!"); vty_out (vty, "%-3u", adj->level); /* level */ vty_out (vty, "%-13s", adj_state2string (adj->adj_state)); now = time (NULL); if (adj->last_upd) vty_out (vty, "%-9lu", adj->last_upd + adj->hold_time - now); else vty_out (vty, "- "); vty_out (vty, "%-10s", snpa_print (adj->snpa)); vty_out (vty, "%s", VTY_NEWLINE); } if (detail == ISIS_UI_LEVEL_DETAIL) { level = adj->level; if (adj->circuit) vty_out (vty, "%s Interface: %s", VTY_NEWLINE, adj->circuit->interface->name); /* interface name */ else vty_out (vty, "NULL circuit!%s", VTY_NEWLINE); vty_out (vty, ", Level: %u", adj->level); /* level */ vty_out (vty, ", State: %s", adj_state2string (adj->adj_state)); now = time (NULL); if (adj->last_upd) vty_out (vty, ", Expires in %s", time2string (adj->last_upd + adj->hold_time - now)); else vty_out (vty, ", Expires in %s", time2string (adj->hold_time)); vty_out (vty, "%s Adjacency flaps: %u", VTY_NEWLINE, adj->flaps); vty_out (vty, ", Last: %s ago", time2string (now - adj->last_flap)); vty_out (vty, "%s Circuit type: %s", VTY_NEWLINE, circuit_t2string (adj->circuit_t)); vty_out (vty, ", Speaks: %s", nlpid2string (&adj->nlpids)); vty_out (vty, "%s SNPA: %s", VTY_NEWLINE, snpa_print (adj->snpa)); dyn = dynhn_find_by_id (adj->lanid); if (dyn) vty_out (vty, ", LAN id: %s.%02x", dyn->name.name, adj->lanid[ISIS_SYS_ID_LEN]); else vty_out (vty, ", LAN id: %s.%02x", sysid_print (adj->lanid), adj->lanid[ISIS_SYS_ID_LEN]); vty_out (vty, "%s Priority: %u", VTY_NEWLINE, adj->prio[adj->level - 1]); vty_out (vty, ", %s, DIS flaps: %u, Last: %s ago%s", isis_disflag2string (adj->dis_record[ISIS_LEVELS + level - 1]. dis), adj->dischanges[level - 1], time2string (now - (adj->dis_record[ISIS_LEVELS + level - 1]. last_dis_change)), VTY_NEWLINE); if (adj->ipv4_addrs && listcount (adj->ipv4_addrs) > 0) { vty_out (vty, " IPv4 Addresses:%s", VTY_NEWLINE); for (node = listhead (adj->ipv4_addrs); node; nextnode (node)) { ip_addr = getdata (node); vty_out (vty, " %s%s", inet_ntoa (*ip_addr), VTY_NEWLINE); } } #ifdef HAVE_IPV6 if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0) { vty_out (vty, " IPv6 Addresses:%s", VTY_NEWLINE); for (node = listhead (adj->ipv6_addrs); node; nextnode (node)) { ipv6_addr = getdata (node); inet_ntop (AF_INET6, ipv6_addr, (char *)ip6, INET6_ADDRSTRLEN); vty_out (vty, " %s%s", ip6, VTY_NEWLINE); } } #endif /* HAVE_IPV6 */ vty_out (vty, "%s", VTY_NEWLINE); } return; }