void isis_adj_print (struct isis_adjacency *adj) { struct isis_dynhn *dyn; struct listnode *node; struct in_addr *ipv4_addr; #ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; u_char ip6[INET6_ADDRSTRLEN]; #endif /* HAVE_IPV6 */ if (!adj) return; dyn = dynhn_find_by_id (adj->sysid); if (dyn) zlog_debug ("%s", dyn->name.name); zlog_debug ("SystemId %20s SNPA %s, level %d\nHolding Time %d", adj->sysid ? sysid_print (adj->sysid) : "unknown", snpa_print (adj->snpa), adj->level, adj->hold_time); if (adj->ipv4_addrs && listcount (adj->ipv4_addrs) > 0) { zlog_debug ("IPv4 Address(es):"); for (ALL_LIST_ELEMENTS_RO (adj->ipv4_addrs, node, ipv4_addr)) zlog_debug ("%s", inet_ntoa (*ipv4_addr)); }
static const char * vid2string (struct isis_vertex *vertex, u_char * buff) { switch (vertex->type) { case VTYPE_PSEUDO_IS: case VTYPE_PSEUDO_TE_IS: return rawlspid_print (vertex->N.id); break; case VTYPE_NONPSEUDO_IS: case VTYPE_NONPSEUDO_TE_IS: case VTYPE_ES: return sysid_print (vertex->N.id); break; case VTYPE_IPREACH_INTERNAL: case VTYPE_IPREACH_EXTERNAL: case VTYPE_IPREACH_TE: #ifdef HAVE_IPV6 case VTYPE_IP6REACH_INTERNAL: case VTYPE_IP6REACH_EXTERNAL: #endif /* HAVE_IPV6 */ prefix2str ((struct prefix *) &vertex->N.prefix, (char *) buff, BUFSIZ); break; default: return "UNKNOWN"; } return (char *) buff; }
void isis_event_auth_failure (char *area_tag, const char *error_string, u_char *sysid) { Log(LOG_DEBUG, "DEBUG (default/core/ISIS ): ISIS-Evt (%s) Authentication failure %s from %s\n", area_tag, error_string, sysid_print (sysid)); return; }
/* * Level System ID Dynamic Hostname (notag) * 2 0000.0000.0001 foo-gw * 2 0000.0000.0002 bar-gw * * 0000.0000.0004 this-gw */ void dynhn_print_all (struct vty *vty) { struct listnode *node; struct isis_dynhn *dyn; vty_out (vty, "Level System ID Dynamic Hostname%s", VTY_NEWLINE); for (ALL_LIST_ELEMENTS_RO (dyn_cache, node, dyn)) { vty_out (vty, "%-7d", dyn->level); vty_out (vty, "%-15s%-15s%s", sysid_print (dyn->id), dyn->name.name, VTY_NEWLINE); } vty_out (vty, " * %s %s%s", sysid_print (isis->sysid), unix_hostname (), VTY_NEWLINE); return; }
void isis_event_auth_failure (char *area_tag, const char *error_string, u_char *sysid) { if (isis->debugs & DEBUG_EVENTS) zlog_debug ("ISIS-Evt (%s) Authentication failure %s from %s", area_tag, error_string, sysid_print (sysid)); return; }
void isis_adj_print (struct isis_adjacency *adj) { struct isis_dynhn *dyn; struct listnode *node; struct in_addr *ipv4_addr; #ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; u_char ip6[INET6_ADDRSTRLEN]; #endif /* HAVE_IPV6 */ if (!adj) return; dyn = dynhn_find_by_id (adj->sysid); if (dyn) zlog_debug ("%s", dyn->name.name); zlog_debug ("SystemId %20s SNPA %s, level %d\nHolding Time %d", adj->sysid ? sysid_print (adj->sysid) : "unknown", snpa_print (adj->snpa), adj->level, adj->hold_time); if (adj->ipv4_addrs && listcount (adj->ipv4_addrs) > 0) { zlog_debug ("IPv4 Addresses:"); for (node = listhead (adj->ipv4_addrs); node; nextnode (node)) { ipv4_addr = getdata (node); zlog_debug ("%s", inet_ntoa (*ipv4_addr)); } } #ifdef HAVE_IPV6 if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0) { zlog_debug ("IPv6 Addresses:"); for (node = listhead (adj->ipv6_addrs); node; nextnode (node)) { ipv6_addr = getdata (node); inet_ntop (AF_INET6, ipv6_addr, (char *)ip6, INET6_ADDRSTRLEN); zlog_debug ("%s", ip6); } } #endif /* HAVE_IPV6 */ zlog_debug ("Speaks: %s", nlpid2string (&adj->nlpids)); 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; }
void isis_adj_state_change (struct isis_adjacency *adj, enum isis_adj_state new_state, const char *reason) { int old_state; int level; struct isis_circuit *circuit; old_state = adj->adj_state; adj->adj_state = new_state; circuit = adj->circuit; if (isis->debugs & DEBUG_ADJ_PACKETS) { zlog_debug ("ISIS-Adj (%s): Adjacency state change %d->%d: %s", circuit->area->area_tag, old_state, new_state, 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 = (const char *)dyn->name.name; else adj_name = adj->sysid ? sysid_print (adj->sysid) : "unknown"; 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->circ_type == CIRCUIT_T_BROADCAST) { for (level = IS_LEVEL_1; level <= IS_LEVEL_2; level++) { if ((adj->level & level) == 0) continue; if (new_state == ISIS_ADJ_UP) { circuit->upadjcount[level - 1]++; isis_event_adjacency_state_change (adj, new_state); /* update counter & timers for debugging purposes */ adj->last_flap = time (NULL); adj->flaps++; } else if (new_state == ISIS_ADJ_DOWN) { listnode_delete (circuit->u.bc.adjdb[level - 1], adj); circuit->upadjcount[level - 1]--; if (circuit->upadjcount[level - 1] == 0) { /* Clean lsp_queue when no adj is up. */ if (circuit->lsp_queue) list_delete_all_node (circuit->lsp_queue); } isis_event_adjacency_state_change (adj, new_state); isis_delete_adj (adj); } if (circuit->u.bc.lan_neighs[level - 1]) { list_delete_all_node (circuit->u.bc.lan_neighs[level - 1]); isis_adj_build_neigh_list (circuit->u.bc.adjdb[level - 1], circuit->u.bc.lan_neighs[level - 1]); } /* On adjacency state change send new pseudo LSP if we are the DR */ if (circuit->u.bc.is_dr[level - 1]) lsp_regenerate_schedule_pseudo (circuit, level); } } else if (circuit->circ_type == CIRCUIT_T_P2P) { for (level = IS_LEVEL_1; level <= IS_LEVEL_2; level++) { if ((adj->level & level) == 0) continue; if (new_state == ISIS_ADJ_UP) { circuit->upadjcount[level - 1]++; isis_event_adjacency_state_change (adj, new_state); if (adj->sys_type == ISIS_SYSTYPE_UNKNOWN) send_hello (circuit, level); /* update counter & timers for debugging purposes */ adj->last_flap = time (NULL); adj->flaps++; /* 7.3.17 - going up on P2P -> send CSNP */ /* FIXME: yup, I know its wrong... but i will do it! (for now) */ send_csnp (circuit, level); } else if (new_state == ISIS_ADJ_DOWN) { if (adj->circuit->u.p2p.neighbor == adj) adj->circuit->u.p2p.neighbor = NULL; circuit->upadjcount[level - 1]--; if (circuit->upadjcount[level - 1] == 0) { /* Clean lsp_queue when no adj is up. */ if (circuit->lsp_queue) list_delete_all_node (circuit->lsp_queue); } isis_event_adjacency_state_change (adj, new_state); isis_delete_adj (adj); } } } return; }
int area_net_title (struct isis_area *area, const u_char *net_title) { struct area_addr *addr; struct area_addr *addrp; struct listnode *node; u_char buff[255]; if (!area) { Log(LOG_WARNING, "WARN ( %s/core/ISIS ): Can't find ISIS instance\n", config.name); return TRUE; } /* We check that we are not over the maximal number of addresses */ if (listcount (area->area_addrs) >= isis->max_area_addrs) { Log(LOG_WARNING, "WARN ( %s/core/ISIS ): Maximum of area addresses (%d) already reached\n", config.name, isis->max_area_addrs); return TRUE; } addr = calloc(1, sizeof (struct area_addr)); addr->addr_len = dotformat2buff (buff, net_title); memcpy (addr->area_addr, buff, addr->addr_len); if (addr->addr_len < 8 || addr->addr_len > 20) { Log(LOG_WARNING, "WARN ( %s/core/ISIS ): area address must be at least 8..20 octets long (%d)\n", config.name, addr->addr_len); free(addr); return TRUE; } if (isis->sysid_set == 0) { /* * First area address - get the SystemID for this router */ memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN); isis->sysid_set = 1; Log(LOG_DEBUG, "DEBUG ( %s/core/ISIS ): Router has SystemID %s\n", config.name, sysid_print (isis->sysid)); } else { /* * Check that the SystemID portions match */ if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN)) { Log(LOG_WARNING, "WARN ( %s/core/ISIS ): System ID must not change when defining additional area addresses\n", config.name); free(addr); return TRUE; } /* now we see that we don't already have this address */ for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp)) { if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len)) continue; if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len)) { free(addr); return FALSE; /* silent fail */ } } } /* * Forget the systemID part of the address */ addr->addr_len -= (ISIS_SYS_ID_LEN + 1); isis_listnode_add (area->area_addrs, addr); /* Only now we can safely generate our LSPs for this area */ if (listcount (area->area_addrs) > 0) { lsp_l1_generate (area); lsp_l2_generate (area); } return FALSE; }