summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_packet.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-18 01:03:46 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-08-18 01:16:53 +0200
commitf90f65a242e18ad2ae1229853f904227cc36900a (patch)
tree72cab69e512d4c8d3e2c40533e728a6973e92411 /eigrpd/eigrp_packet.c
parenteigrpd: Rework ack sent to neighbor (diff)
downloadfrr-f90f65a242e18ad2ae1229853f904227cc36900a.tar.xz
frr-f90f65a242e18ad2ae1229853f904227cc36900a.zip
eigrpd: Cleanup FIFO
The FIFO really was a LIFO for some reason. Push new packets onto the top, always pull from the bottom. This allows eigrp neighbors to come up. Topotests eigrp-topo1( in a topotest PR ) now form neighbors with itself. With this commit. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_packet.c')
-rw-r--r--eigrpd/eigrp_packet.c57
1 files changed, 15 insertions, 42 deletions
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 9f3de1014..cd677f1ae 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -336,7 +336,7 @@ int eigrp_write(struct thread *thread)
#endif /* WANT_EIGRP_WRITE_FRAGMENT */
/* Get one packet from queue. */
- ep = eigrp_fifo_head(ei->obuf);
+ ep = eigrp_fifo_next(ei->obuf);
assert(ep);
assert(ep->length >= EIGRP_HEADER_LEN);
@@ -437,7 +437,7 @@ int eigrp_write(struct thread *thread)
/* Now delete packet from queue. */
eigrp_packet_delete(ei);
- if (eigrp_fifo_head(ei->obuf) == NULL) {
+ if (eigrp_fifo_next(ei->obuf) == NULL) {
ei->on_write_q = 0;
list_delete_node(eigrp->oi_write_q, node);
}
@@ -636,7 +636,7 @@ int eigrp_read(struct thread *thread)
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
if (ntohl(eigrph->ack) == ep->sequence_number) {
if ((nbr->state == EIGRP_NEIGHBOR_PENDING)
@@ -651,17 +651,17 @@ int eigrp_read(struct thread *thread)
ntohl(eigrph->sequence);
eigrp_update_send_EOT(nbr);
}
- ep = eigrp_fifo_pop_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_pop(nbr->retrans_queue);
eigrp_packet_free(ep);
if (nbr->retrans_queue->count > 0) {
eigrp_send_packet_reliably(nbr);
}
}
}
- ep = eigrp_fifo_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_next(nbr->multicast_queue);
if (ep) {
if (ntohl(eigrph->ack) == ep->sequence_number) {
- ep = eigrp_fifo_pop_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_pop(nbr->multicast_queue);
eigrp_packet_free(ep);
if (nbr->multicast_queue->count > 0) {
eigrp_send_packet_reliably(nbr);
@@ -843,13 +843,13 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr)
{
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
/*Start retransmission timer*/
thread_add_timer(master, eigrp_unack_packet_retrans, nbr,
@@ -911,7 +911,7 @@ void eigrp_packet_header_init(int type, struct eigrp_interface *ei,
}
/* Add new packet to head of fifo. */
-void eigrp_fifo_push_head(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
+void eigrp_fifo_push(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
{
ep->next = fifo->head;
ep->previous = NULL;
@@ -927,14 +927,8 @@ void eigrp_fifo_push_head(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
fifo->count++;
}
-/* Return first fifo entry. */
-struct eigrp_packet *eigrp_fifo_head(struct eigrp_fifo *fifo)
-{
- return fifo->head;
-}
-
/* Return last fifo entry. */
-struct eigrp_packet *eigrp_fifo_tail(struct eigrp_fifo *fifo)
+struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *fifo)
{
return fifo->tail;
}
@@ -949,27 +943,6 @@ void eigrp_packet_delete(struct eigrp_interface *ei)
eigrp_packet_free(ep);
}
-/* Delete first packet from fifo. */
-struct eigrp_packet *eigrp_fifo_pop(struct eigrp_fifo *fifo)
-{
- struct eigrp_packet *ep;
-
- ep = fifo->head;
-
- if (ep) {
- fifo->head = ep->next;
-
- if (fifo->head == NULL)
- fifo->tail = NULL;
- else
- fifo->head->previous = NULL;
-
- fifo->count--;
- }
-
- return ep;
-}
-
void eigrp_packet_free(struct eigrp_packet *ep)
{
if (ep->s)
@@ -1030,14 +1003,14 @@ int eigrp_unack_packet_retrans(struct thread *thread)
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX)
@@ -1067,13 +1040,13 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_next(nbr->multicast_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX)
@@ -1098,7 +1071,7 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
}
/* Get packet from tail of fifo. */
-struct eigrp_packet *eigrp_fifo_pop_tail(struct eigrp_fifo *fifo)
+struct eigrp_packet *eigrp_fifo_pop(struct eigrp_fifo *fifo)
{
struct eigrp_packet *ep;