Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
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;
}