version 1.1.1.2, 2013/07/21 23:54:39
|
version 1.1.1.3, 2016/11/02 10:09:11
|
Line 38
|
Line 38
|
#include "ospf6_neighbor.h" |
#include "ospf6_neighbor.h" |
#include "ospf6_intra.h" |
#include "ospf6_intra.h" |
#include "ospf6_flood.h" |
#include "ospf6_flood.h" |
|
#include "ospf6_snmp.h" |
#include "ospf6d.h" |
#include "ospf6d.h" |
|
|
unsigned char conf_debug_ospf6_neighbor = 0; |
unsigned char conf_debug_ospf6_neighbor = 0; |
Line 46 const char *ospf6_neighbor_state_str[] =
|
Line 47 const char *ospf6_neighbor_state_str[] =
|
{ "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange", |
{ "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange", |
"Loading", "Full", NULL }; |
"Loading", "Full", NULL }; |
|
|
|
static const char *ospf6_neighbor_event_str[] = |
|
{ |
|
"NoEvent", |
|
"HelloReceived", |
|
"2-WayReceived", |
|
"NegotiationDone", |
|
"ExchangeDone", |
|
"LoadingDone", |
|
"AdjOK?", |
|
"SeqNumberMismatch", |
|
"BadLSReq", |
|
"1-WayReceived", |
|
"InactivityTimer", |
|
}; |
|
|
|
static const char * |
|
ospf6_neighbor_event_string (int event) |
|
{ |
|
#define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent" |
|
|
|
if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT) |
|
return ospf6_neighbor_event_str[event]; |
|
return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING; |
|
} |
|
|
int |
int |
ospf6_neighbor_cmp (void *va, void *vb) |
ospf6_neighbor_cmp (void *va, void *vb) |
{ |
{ |
Line 98 ospf6_neighbor_create (u_int32_t router_id, struct osp
|
Line 124 ospf6_neighbor_create (u_int32_t router_id, struct osp
|
on->retrans_list = ospf6_lsdb_create (on); |
on->retrans_list = ospf6_lsdb_create (on); |
|
|
on->dbdesc_list = ospf6_lsdb_create (on); |
on->dbdesc_list = ospf6_lsdb_create (on); |
on->lsreq_list = ospf6_lsdb_create (on); |
|
on->lsupdate_list = ospf6_lsdb_create (on); |
on->lsupdate_list = ospf6_lsdb_create (on); |
on->lsack_list = ospf6_lsdb_create (on); |
on->lsack_list = ospf6_lsdb_create (on); |
|
|
Line 121 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
Line 146 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
} |
} |
|
|
ospf6_lsdb_remove_all (on->dbdesc_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->lsupdate_list); |
ospf6_lsdb_remove_all (on->lsack_list); |
ospf6_lsdb_remove_all (on->lsack_list); |
|
|
Line 130 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
Line 154 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
ospf6_lsdb_delete (on->retrans_list); |
ospf6_lsdb_delete (on->retrans_list); |
|
|
ospf6_lsdb_delete (on->dbdesc_list); |
ospf6_lsdb_delete (on->dbdesc_list); |
ospf6_lsdb_delete (on->lsreq_list); |
|
ospf6_lsdb_delete (on->lsupdate_list); |
ospf6_lsdb_delete (on->lsupdate_list); |
ospf6_lsdb_delete (on->lsack_list); |
ospf6_lsdb_delete (on->lsack_list); |
|
|
Line 145 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
Line 168 ospf6_neighbor_delete (struct ospf6_neighbor *on)
|
} |
} |
|
|
static void |
static void |
ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on) | ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on, int event) |
{ |
{ |
u_char prev_state; |
u_char prev_state; |
|
|
Line 161 ospf6_neighbor_state_change (u_char next_state, struct
|
Line 184 ospf6_neighbor_state_change (u_char next_state, struct
|
/* log */ |
/* log */ |
if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) |
if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) |
{ |
{ |
zlog_debug ("Neighbor state change %s: [%s]->[%s]", on->name, | zlog_debug ("Neighbor state change %s: [%s]->[%s] (%s)", on->name, |
ospf6_neighbor_state_str[prev_state], |
ospf6_neighbor_state_str[prev_state], |
ospf6_neighbor_state_str[next_state]); | ospf6_neighbor_state_str[next_state], |
| ospf6_neighbor_event_string(event)); |
} |
} |
|
|
|
/* Optionally notify about adjacency changes */ |
|
if (CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags, |
|
OSPF6_LOG_ADJACENCY_CHANGES) && |
|
(CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags, |
|
OSPF6_LOG_ADJACENCY_DETAIL) || |
|
(next_state == OSPF6_NEIGHBOR_FULL) || (next_state < prev_state))) |
|
zlog_notice("AdjChg: Nbr %s: %s -> %s (%s)", on->name, |
|
ospf6_neighbor_state_str[prev_state], |
|
ospf6_neighbor_state_str[next_state], |
|
ospf6_neighbor_event_string(event)); |
|
|
if (prev_state == OSPF6_NEIGHBOR_FULL || next_state == OSPF6_NEIGHBOR_FULL) |
if (prev_state == OSPF6_NEIGHBOR_FULL || next_state == OSPF6_NEIGHBOR_FULL) |
{ |
{ |
OSPF6_ROUTER_LSA_SCHEDULE (on->ospf6_if->area); |
OSPF6_ROUTER_LSA_SCHEDULE (on->ospf6_if->area); |
Line 226 hello_received (struct thread *thread)
|
Line 261 hello_received (struct thread *thread)
|
on->ospf6_if->dead_interval); |
on->ospf6_if->dead_interval); |
|
|
if (on->state <= OSPF6_NEIGHBOR_DOWN) |
if (on->state <= OSPF6_NEIGHBOR_DOWN) |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on, |
| OSPF6_NEIGHBOR_EVENT_HELLO_RCVD); |
|
|
return 0; |
return 0; |
} |
} |
Line 249 twoway_received (struct thread *thread)
|
Line 285 twoway_received (struct thread *thread)
|
|
|
if (! need_adjacency (on)) |
if (! need_adjacency (on)) |
{ |
{ |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on, |
| OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD); |
return 0; |
return 0; |
} |
} |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on, |
| OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
Line 330 negotiation_done (struct thread *thread)
|
Line 368 negotiation_done (struct thread *thread)
|
} |
} |
|
|
UNSET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
UNSET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXCHANGE, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXCHANGE, on, |
| OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE); |
|
|
return 0; |
return 0; |
} |
} |
Line 358 exchange_done (struct thread *thread)
|
Line 397 exchange_done (struct thread *thread)
|
*/ |
*/ |
|
|
if (on->request_list->count == 0) |
if (on->request_list->count == 0) |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on, |
| OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE); |
else |
else |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on); | { |
| ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on, |
| OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE); |
|
|
|
if (on->thread_send_lsreq == NULL) |
|
on->thread_send_lsreq = |
|
thread_add_event (master, ospf6_lsreq_send, on, 0); |
|
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
|
/* Check loading state. */ |
|
void |
|
ospf6_check_nbr_loading (struct ospf6_neighbor *on) |
|
{ |
|
|
|
/* RFC2328 Section 10.9: When the neighbor responds to these requests |
|
with the proper Link State Update packet(s), the Link state request |
|
list is truncated and a new Link State Request packet is sent. |
|
*/ |
|
if ((on->state == OSPF6_NEIGHBOR_LOADING) || |
|
(on->state == OSPF6_NEIGHBOR_EXCHANGE)) |
|
{ |
|
if (on->request_list->count == 0) |
|
thread_add_event (master, loading_done, on, 0); |
|
else if (on->last_ls_req == NULL) |
|
{ |
|
if (on->thread_send_lsreq != NULL) |
|
THREAD_OFF (on->thread_send_lsreq); |
|
on->thread_send_lsreq = |
|
thread_add_event (master, ospf6_lsreq_send, on, 0); |
|
} |
|
} |
|
} |
|
|
int |
int |
loading_done (struct thread *thread) |
loading_done (struct thread *thread) |
{ |
{ |
Line 381 loading_done (struct thread *thread)
|
Line 452 loading_done (struct thread *thread)
|
|
|
assert (on->request_list->count == 0); |
assert (on->request_list->count == 0); |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on, |
| OSPF6_NEIGHBOR_EVENT_LOADING_DONE); |
|
|
return 0; |
return 0; |
} |
} |
Line 400 adj_ok (struct thread *thread)
|
Line 472 adj_ok (struct thread *thread)
|
|
|
if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency (on)) |
if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency (on)) |
{ |
{ |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on, |
| OSPF6_NEIGHBOR_EVENT_ADJ_OK); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
Line 413 adj_ok (struct thread *thread)
|
Line 486 adj_ok (struct thread *thread)
|
else if (on->state >= OSPF6_NEIGHBOR_EXSTART && |
else if (on->state >= OSPF6_NEIGHBOR_EXSTART && |
! need_adjacency (on)) |
! need_adjacency (on)) |
{ |
{ |
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on, |
| OSPF6_NEIGHBOR_EVENT_ADJ_OK); |
ospf6_lsdb_remove_all (on->summary_list); |
ospf6_lsdb_remove_all (on->summary_list); |
ospf6_lsdb_remove_all (on->request_list); |
ospf6_lsdb_remove_all (on->request_list); |
for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
for (lsa = ospf6_lsdb_head (on->retrans_list); lsa; |
Line 442 seqnumber_mismatch (struct thread *thread)
|
Line 516 seqnumber_mismatch (struct thread *thread)
|
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
zlog_debug ("Neighbor Event %s: *SeqNumberMismatch*", on->name); |
zlog_debug ("Neighbor Event %s: *SeqNumberMismatch*", on->name); |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on, |
| OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
Line 457 seqnumber_mismatch (struct thread *thread)
|
Line 532 seqnumber_mismatch (struct thread *thread)
|
} |
} |
|
|
THREAD_OFF (on->thread_send_dbdesc); |
THREAD_OFF (on->thread_send_dbdesc); |
|
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ |
|
|
on->thread_send_dbdesc = |
on->thread_send_dbdesc = |
thread_add_event (master, ospf6_dbdesc_send, on, 0); |
thread_add_event (master, ospf6_dbdesc_send, on, 0); |
|
|
Line 478 bad_lsreq (struct thread *thread)
|
Line 555 bad_lsreq (struct thread *thread)
|
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
zlog_debug ("Neighbor Event %s: *BadLSReq*", on->name); |
zlog_debug ("Neighbor Event %s: *BadLSReq*", on->name); |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on, |
| OSPF6_NEIGHBOR_EVENT_BAD_LSREQ); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT); |
Line 493 bad_lsreq (struct thread *thread)
|
Line 571 bad_lsreq (struct thread *thread)
|
} |
} |
|
|
THREAD_OFF (on->thread_send_dbdesc); |
THREAD_OFF (on->thread_send_dbdesc); |
|
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ |
|
|
on->thread_send_dbdesc = |
on->thread_send_dbdesc = |
thread_add_event (master, ospf6_dbdesc_send, on, 0); |
thread_add_event (master, ospf6_dbdesc_send, on, 0); |
|
|
Line 514 oneway_received (struct thread *thread)
|
Line 594 oneway_received (struct thread *thread)
|
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT)) |
zlog_debug ("Neighbor Event %s: *1Way-Received*", on->name); |
zlog_debug ("Neighbor Event %s: *1Way-Received*", on->name); |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on, |
| OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD); |
thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
|
|
ospf6_lsdb_remove_all (on->summary_list); |
ospf6_lsdb_remove_all (on->summary_list); |
Line 549 inactivity_timer (struct thread *thread)
|
Line 630 inactivity_timer (struct thread *thread)
|
on->drouter = on->prev_drouter = 0; |
on->drouter = on->prev_drouter = 0; |
on->bdrouter = on->prev_bdrouter = 0; |
on->bdrouter = on->prev_bdrouter = 0; |
|
|
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_DOWN, on); | ospf6_neighbor_state_change (OSPF6_NEIGHBOR_DOWN, on, |
| OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER); |
thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
thread_add_event (master, neighbor_change, on->ospf6_if, 0); |
|
|
listnode_delete (on->ospf6_if->neighbor_list, on); |
listnode_delete (on->ospf6_if->neighbor_list, on); |
Line 559 inactivity_timer (struct thread *thread)
|
Line 641 inactivity_timer (struct thread *thread)
|
} |
} |
|
|
|
|
| |
/* vty functions */ |
/* vty functions */ |
/* show neighbor structure */ |
/* show neighbor structure */ |
static void |
static void |
Line 727 ospf6_neighbor_show_detail (struct vty *vty, struct os
|
Line 809 ospf6_neighbor_show_detail (struct vty *vty, struct os
|
timersub (&on->thread_send_lsreq->u.sands, &now, &res); |
timersub (&on->thread_send_lsreq->u.sands, &now, &res); |
timerstring (&res, duration, sizeof (duration)); |
timerstring (&res, duration, sizeof (duration)); |
vty_out (vty, " %d Pending LSAs for LSReq in Time %s [thread %s]%s", |
vty_out (vty, " %d Pending LSAs for LSReq in Time %s [thread %s]%s", |
on->lsreq_list->count, duration, | on->request_list->count, duration, |
(on->thread_send_lsreq ? "on" : "off"), |
(on->thread_send_lsreq ? "on" : "off"), |
VNL); |
VNL); |
for (lsa = ospf6_lsdb_head (on->lsreq_list); lsa; | for (lsa = ospf6_lsdb_head (on->request_list); lsa; |
lsa = ospf6_lsdb_next (lsa)) |
lsa = ospf6_lsdb_next (lsa)) |
vty_out (vty, " %s%s", lsa->name, VNL); |
vty_out (vty, " %s%s", lsa->name, VNL); |
|
|