int oneway_received (struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa; on = (struct ospf6_neighbor *) THREAD_ARG (thread); assert (on); if (on->state < OSPF6_NEIGHBOR_TWOWAY) return 0; if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) zlog_info ("Neighbor Event %s: *1Way-Received*", on->name); ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on); thread_add_event (master, neighbor_change, on->ospf6_if, 0); ospf6_lsdb_remove_all (on->summary_list); ospf6_lsdb_remove_all (on->request_list); for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; lsa = ospf6_lsdb_next (lsa)) { ospf6_decrement_retrans_count (lsa); ospf6_lsdb_remove (lsa, on->retrans_list); } THREAD_OFF (on->thread_send_dbdesc); THREAD_OFF (on->thread_send_lsreq); THREAD_OFF (on->thread_send_lsupdate); THREAD_OFF (on->thread_send_lsack); return 0; }
int bad_lsreq(struct thread * thread) { struct ospf6_neighbor * on; struct ospf6_lsa * lsa; on = (struct ospf6_neighbor *) THREAD_ARG(thread); assert(on); if(on->state < OSPF6_NEIGHBOR_EXCHANGE) return 0; if(IS_OSPF6_SIBLING_DEBUG_NEIGHBOR) zlog_debug("Neighbor Event %s: *BadLSReq*", on->name); ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); ospf6_lsdb_remove_all(on->summary_list); ospf6_lsdb_remove_all(on->request_list); for(lsa = ospf6_lsdb_head(on->retrans_list); lsa; lsa = ospf6_lsdb_next(lsa)) { ospf6_decrement_retrans_count(lsa); ospf6_lsdb_remove(lsa, on->retrans_list); } THREAD_OFF(on->thread_send_dbdesc); on->thread_send_dbdesc = thread_add_event(master, ospf6_dbdesc_send, on, 0); return 0; }
int exchange_done(struct thread * thread) { struct ospf6_neighbor *on; on = (struct ospf6_neighbor *) THREAD_ARG (thread); assert (on); if (on->state != OSPF6_NEIGHBOR_EXCHANGE) return 0; if (IS_OSPF6_SIBLING_DEBUG_NEIGHBOR) zlog_debug ("Neighbor Event %s: *ExchangeDone*", on->name); THREAD_OFF (on->thread_send_dbdesc); ospf6_lsdb_remove_all (on->dbdesc_list); /* XXX thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on, on->ospf6_if->dead_interval); */ if (on->request_list->count == 0) ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on); else ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on); return 0; }
void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb) { ospf6_lsdb_remove_all (lsdb); route_table_finish (lsdb->table); XFREE (MTYPE_OSPF6_LSDB, lsdb); }
void ospf6_interface_disable (struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on; SET_FLAG (oi->flag, OSPF6_INTERFACE_DISABLE); for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) ospf6_neighbor_delete (on); list_delete_all_node (oi->neighbor_list); ospf6_lsdb_remove_all (oi->lsdb); ospf6_lsdb_remove_all (oi->lsupdate_list); ospf6_lsdb_remove_all (oi->lsack_list); THREAD_OFF (oi->thread_send_hello); THREAD_OFF (oi->thread_send_lsupdate); THREAD_OFF (oi->thread_send_lsack); }
int adj_ok (struct thread *thread) { struct ospf6_neighbor *on; struct ospf6_lsa *lsa; on = (struct ospf6_neighbor *) THREAD_ARG (thread); assert (on); if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) zlog_info ("Neighbor Event %s: *AdjOK?*", on->name); if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency (on)) { ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); THREAD_OFF (on->thread_send_dbdesc); on->thread_send_dbdesc = thread_add_event (master, ospf6_dbdesc_send, on, 0); } else if (on->state >= OSPF6_NEIGHBOR_EXSTART && ! need_adjacency (on)) { ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); ospf6_lsdb_remove_all (on->summary_list); ospf6_lsdb_remove_all (on->request_list); for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; lsa = ospf6_lsdb_next (lsa)) { ospf6_decrement_retrans_count (lsa); ospf6_lsdb_remove (lsa, on->retrans_list); } } return 0; }
void ospf6_interface_delete (struct ospf6_interface *oi) { struct listnode *node, *nnode; struct ospf6_neighbor *on; for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on)) ospf6_neighbor_delete (on); list_delete (oi->neighbor_list); THREAD_OFF (oi->thread_send_hello); THREAD_OFF (oi->thread_send_lsupdate); THREAD_OFF (oi->thread_send_lsack); ospf6_lsdb_remove_all (oi->lsdb); ospf6_lsdb_remove_all (oi->lsupdate_list); ospf6_lsdb_remove_all (oi->lsack_list); ospf6_lsdb_delete (oi->lsdb); ospf6_lsdb_delete (oi->lsdb_self); ospf6_lsdb_delete (oi->lsupdate_list); ospf6_lsdb_delete (oi->lsack_list); ospf6_route_table_delete (oi->route_connected); /* cut link */ oi->interface->info = NULL; /* plist_name */ if (oi->plist_name) XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); XFREE (MTYPE_OSPF6_IF, oi); }
void ospf6_area_delete (struct ospf6_area *o6a) { listnode n; struct ospf6_interface *o6i; CALL_REMOVE_HOOK (&area_hook, o6a); /* ospf6 interface list */ for (n = listhead (o6a->if_list); n; nextnode (n)) { o6i = (struct ospf6_interface *) getdata (n); /* ospf6_interface_delete (o6i); */ } list_delete (o6a->if_list); /* terminate LSDB */ ospf6_lsdb_remove_all (o6a->lsdb); /* spf tree terminate */ /* xxx */ /* threads */ if (o6a->spf_calc) thread_cancel (o6a->spf_calc); o6a->spf_calc = (struct thread *) NULL; if (o6a->route_calc) thread_cancel (o6a->route_calc); o6a->route_calc = (struct thread *) NULL; /* new */ ospf6_route_table_delete (o6a->route_table); ospf6_spftree_delete (o6a->spf_tree); ospf6_route_table_delete (o6a->table_topology); /* free area */ XFREE (MTYPE_OSPF6_AREA, o6a); }
static void ospf6_disable(struct ospf6 *o) { struct listnode *node, *nnode; struct ospf6_area *oa; if (!CHECK_FLAG(o->flag, OSPF6_DISABLED)) { SET_FLAG(o->flag, OSPF6_DISABLED); for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa)) ospf6_area_disable(oa); /* XXX: This also changes persistent settings */ ospf6_asbr_redistribute_reset(); ospf6_lsdb_remove_all(o->lsdb); ospf6_route_remove_all(o->route_table); ospf6_route_remove_all(o->brouter_table); THREAD_OFF(o->maxage_remover); THREAD_OFF(o->t_spf_calc); THREAD_OFF(o->t_ase_calc); THREAD_OFF(o->t_distribute_update); }
void ospf6_neighbor_delete (struct ospf6_neighbor *on) { struct ospf6_lsa *lsa; ospf6_lsdb_remove_all (on->summary_list); ospf6_lsdb_remove_all (on->request_list); for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; lsa = ospf6_lsdb_next (lsa)) { ospf6_decrement_retrans_count (lsa); ospf6_lsdb_remove (lsa, on->retrans_list); } ospf6_lsdb_remove_all (on->dbdesc_list); ospf6_lsdb_remove_all (on->lsreq_list); ospf6_lsdb_remove_all (on->lsupdate_list); ospf6_lsdb_remove_all (on->lsack_list); ospf6_lsdb_delete (on->summary_list); ospf6_lsdb_delete (on->request_list); ospf6_lsdb_delete (on->retrans_list); ospf6_lsdb_delete (on->dbdesc_list); ospf6_lsdb_delete (on->lsreq_list); ospf6_lsdb_delete (on->lsupdate_list); ospf6_lsdb_delete (on->lsack_list); #ifdef HAVE_KBFD if (CHECK_FLAG (on->bfd_flag, OSPF6_NBR_BFD_ENABLE)) ospf6_bfd_peer_delete (on); #endif /*HAVE_KBFD*/ THREAD_OFF (on->inactivity_timer); THREAD_OFF (on->thread_send_dbdesc); THREAD_OFF (on->thread_send_lsreq); THREAD_OFF (on->thread_send_lsupdate); THREAD_OFF (on->thread_send_lsack); XFREE (MTYPE_OSPF6_NEIGHBOR, on); }
void ospf6_neighbor_delete(struct ospf6_neighbor * on) { struct ospf6_lsa * lsa; ospf6_lsdb_remove_all(on->summary_list); ospf6_lsdb_remove_all (on->request_list); for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; lsa = ospf6_lsdb_next (lsa)) { ospf6_decrement_retrans_count (lsa); ospf6_lsdb_remove (lsa, on->retrans_list); } ospf6_lsdb_remove_all (on->dbdesc_list); ospf6_lsdb_remove_all (on->lsreq_list); ospf6_lsdb_remove_all (on->lsupdate_list); ospf6_lsdb_remove_all (on->lsack_list); ospf6_lsdb_delete (on->summary_list); ospf6_lsdb_delete (on->request_list); ospf6_lsdb_delete (on->retrans_list); ospf6_lsdb_delete (on->dbdesc_list); ospf6_lsdb_delete (on->lsreq_list); ospf6_lsdb_delete (on->lsupdate_list); ospf6_lsdb_delete (on->lsack_list); THREAD_OFF (on->inactivity_timer); THREAD_OFF (on->thread_send_dbdesc); THREAD_OFF (on->thread_send_lsreq); THREAD_OFF (on->thread_send_lsupdate); THREAD_OFF (on->thread_send_lsack); free(on); on = NULL; }
int negotiation_done(struct thread * thread) { struct ospf6_neighbor * on; struct ospf6_lsa * lsa; on = (struct ospf6_neighbor *) THREAD_ARG(thread); assert(on); if(on->state != OSPF6_NEIGHBOR_EXSTART) return 0; if(IS_OSPF6_SIBLING_DEBUG_NEIGHBOR) zlog_debug("Neighbor Event %s: *NegotiationDone*", on->name); /* clear ls-list */ ospf6_lsdb_remove_all(on->summary_list); ospf6_lsdb_remove_all(on->request_list); for(lsa = ospf6_lsdb_head(on->retrans_list); lsa; lsa = ospf6_lsdb_next(lsa)) { ospf6_decrement_retrans_count(lsa); ospf6_lsdb_remove(lsa, on->retrans_list); } /* Interface scoped LSAs */ for(lsa = ospf6_lsdb_head(on->ospf6_if->lsdb); lsa; lsa = ospf6_lsdb_next(lsa)) { if (OSPF6_LSA_IS_MAXAGE (lsa)) { ospf6_increment_retrans_count(lsa); ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); } else ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->summary_list); } /* Area scoped LSAs - no area implemented yet */ // LIST_FOR_EACH(lsa, struct ospf6_lsa, node, on-> ) // { // } /* AS scoped LSAs */ for(lsa = ospf6_lsdb_head(ospf6->lsdb); lsa; lsa = ospf6_lsdb_next(lsa)) { if(OSPF6_LSA_IS_MAXAGE(lsa)) { ospf6_increment_retrans_count(lsa); ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); } else ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->summary_list); } UNSET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXCHANGE, on); return 0; }