diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-16 04:35:27 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-16 04:38:17 +0200 |
commit | 9a8d52a4953716882dff3bde18640e2241631463 (patch) | |
tree | 6713a3d8288d29a1e33dcf648355f98d904e6d86 | |
parent | eigrpd: Make eigrp_get_fsm_event use metric changed (diff) | |
download | frr-9a8d52a4953716882dff3bde18640e2241631463.tar.xz frr-9a8d52a4953716882dff3bde18640e2241631463.zip |
eigrpd: Cleanup eigrp_get_fsm_event
Make this function a bit more legible
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | eigrpd/eigrp_fsm.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index f697577c6..8e2a26447 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -215,32 +215,31 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) * move to active state * dependently if it was query from successor */ - else { - if (msg->packet_type == EIGRP_OPC_QUERY) { - return EIGRP_FSM_EVENT_Q_FCN; - } else { - return EIGRP_FSM_EVENT_NQ_FCN; - } + if (msg->packet_type == EIGRP_OPC_QUERY) { + return EIGRP_FSM_EVENT_Q_FCN; + } else { + return EIGRP_FSM_EVENT_NQ_FCN; } break; } case EIGRP_FSM_STATE_ACTIVE_0: { if (msg->packet_type == EIGRP_OPC_REPLY) { + struct eigrp_neighbor_entry *head = + (struct eigrp_neighbor_entry *) + entry->prefix->entries->head->data; + listnode_delete(prefix->rij, entry->adv_router); - if (prefix->rij->count) { + if (prefix->rij->count) return EIGRP_FSM_KEEP_STATE; - } else { - zlog_info("All reply received\n"); - if (((struct eigrp_neighbor_entry *) - prefix->entries->head->data) - ->reported_distance - < prefix->fdistance) { - return EIGRP_FSM_EVENT_LR_FCS; - } - return EIGRP_FSM_EVENT_LR_FCN; + zlog_info("All reply received\n"); + if (head->reported_distance + < prefix->fdistance) { + return EIGRP_FSM_EVENT_LR_FCS; } + + return EIGRP_FSM_EVENT_LR_FCN; } else if (msg->packet_type == EIGRP_OPC_QUERY && (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) { @@ -279,14 +278,16 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg) } case EIGRP_FSM_STATE_ACTIVE_2: { if (msg->packet_type == EIGRP_OPC_REPLY) { + struct eigrp_neighbor_entry *head = + (struct eigrp_neighbor_entry *) + prefix->entries->head->data; + listnode_delete(prefix->rij, entry->adv_router); if (prefix->rij->count) { return EIGRP_FSM_KEEP_STATE; } else { zlog_info("All reply received\n"); - if (((struct eigrp_neighbor_entry *) - prefix->entries->head->data) - ->reported_distance + if (head->reported_distance < prefix->fdistance) { return EIGRP_FSM_EVENT_LR_FCS; } |