int isis_area_get (const char *area_tag) { struct isis_area *area; area = isis_area_lookup (area_tag); if (area) { return FALSE; } area = isis_area_create (); area->area_tag = strdup (area_tag); isis_listnode_add (isis->area_list, area); Log(LOG_DEBUG, "DEBUG ( %s/core/ISIS ): New IS-IS area instance %s\n", config.name, area->area_tag); return FALSE; }
int isis_area_destroy (const char *area_tag) { struct isis_area *area; struct listnode *node, *nnode; struct isis_circuit *circuit; area = isis_area_lookup (area_tag); if (area == NULL) { Log(LOG_WARNING, "WARN ( %s/core/ISIS ): Can't find ISIS instance %s\n", config.name, area_tag); return TRUE; } if (area->circuit_list) { for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit)) { /* The fact that it's in circuit_list means that it was configured */ isis_csm_state_change (ISIS_DISABLE, circuit, area); isis_circuit_down (circuit); isis_circuit_deconfigure (circuit, area); } isis_list_delete (area->circuit_list); } isis_listnode_delete (isis->area_list, area); if (area->t_remove_aged) thread_cancel (area->t_remove_aged); THREAD_TIMER_OFF (area->spftree[0]->t_spf); THREAD_TIMER_OFF (area->spftree[1]->t_spf); free(area); isis->sysid_set=0; return FALSE; }
void isis_srcdst_lookup(struct packet_ptrs *pptrs) { struct route_node *result; struct isis_area *area; char area_tag[] = "default"; int level; struct in_addr pref4; #if defined ENABLE_IPV6 struct in6_addr pref6; #endif pptrs->igp_src = NULL; pptrs->igp_dst = NULL; pptrs->igp_src_info = NULL; pptrs->igp_dst_info = NULL; area = isis_area_lookup(area_tag); if (area) { level = MAX(area->is_type, 2); if (pptrs->l3_proto == ETHERTYPE_IP) { if (!pptrs->igp_src) { memcpy(&pref4, &((struct my_iphdr *)pptrs->iph_ptr)->ip_src, sizeof(struct in_addr)); result = route_node_match_ipv4(area->route_table[level-1], &pref4); if (result) { pptrs->igp_src = (char *) &result->p; pptrs->igp_src_info = (char *) result->info; if (result->p.prefixlen > pptrs->lm_mask_src) { pptrs->lm_mask_src = result->p.prefixlen; pptrs->lm_method_src = NF_NET_IGP; } } } if (!pptrs->igp_dst) { memcpy(&pref4, &((struct my_iphdr *)pptrs->iph_ptr)->ip_dst, sizeof(struct in_addr)); result = route_node_match_ipv4(area->route_table[level-1], &pref4); if (result) { pptrs->igp_dst = (char *) &result->p; pptrs->igp_dst_info = (char *) result->info; if (result->p.prefixlen > pptrs->lm_mask_dst) { pptrs->lm_mask_dst = result->p.prefixlen; pptrs->lm_method_dst = NF_NET_IGP; } } } } #if defined ENABLE_IPV6 else if (area && pptrs->l3_proto == ETHERTYPE_IPV6) { if (!pptrs->igp_src) { memcpy(&pref6, &((struct ip6_hdr *)pptrs->iph_ptr)->ip6_src, sizeof(struct in6_addr)); result = route_node_match_ipv6(area->route_table6[level-1], &pref6); if (result) { pptrs->igp_src = (char *) &result->p; pptrs->igp_src_info = (char *) result->info; if (result->p.prefixlen > pptrs->lm_mask_src) { pptrs->lm_mask_src = result->p.prefixlen; pptrs->lm_method_src = NF_NET_IGP; } } } if (!pptrs->igp_dst) { memcpy(&pref6, &((struct ip6_hdr *)pptrs->iph_ptr)->ip6_dst, sizeof(struct in6_addr)); result = route_node_match_ipv6(area->route_table6[level-1], &pref6); if (result) { pptrs->igp_dst = (char *) &result->p; pptrs->igp_dst_info = (char *) result->info; if (result->p.prefixlen > pptrs->lm_mask_dst) { pptrs->lm_mask_dst = result->p.prefixlen; pptrs->lm_method_dst = NF_NET_IGP; } } } } #endif } }