summaryrefslogtreecommitdiffstats
path: root/eigrpd
diff options
context:
space:
mode:
authorPiotr Jurkiewicz <piotr.jerzy.jurkiewicz@gmail.com>2018-05-03 22:07:54 +0200
committerPiotr Jurkiewicz <piotr.jerzy.jurkiewicz@gmail.com>2018-05-04 02:58:31 +0200
commit9378632f04b72c73e19a22618712ef6eeec6abf7 (patch)
treef92aa88e814980b4e9fa32c1fdc833373718939d /eigrpd
parenteigrpd: Correctly calculate EIGRP packet MTU (diff)
downloadfrr-9378632f04b72c73e19a22618712ef6eeec6abf7.tar.xz
frr-9378632f04b72c73e19a22618712ef6eeec6abf7.zip
eigrpd: Use EIGRP_PACKET_MTU(mtu) macro
Signed-off-by: Piotr Jurkiewicz <piotr.jerzy.jurkiewicz@gmail.com>
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_hello.c2
-rw-r--r--eigrpd/eigrp_macros.h2
-rw-r--r--eigrpd/eigrp_packet.c3
-rw-r--r--eigrpd/eigrp_query.c2
-rw-r--r--eigrpd/eigrp_reply.c2
-rw-r--r--eigrpd/eigrp_siaquery.c2
-rw-r--r--eigrpd/eigrp_siareply.c2
-rw-r--r--eigrpd/eigrp_update.c8
8 files changed, 13 insertions, 10 deletions
diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c
index f10ff9d9f..d9e89357c 100644
--- a/eigrpd/eigrp_hello.c
+++ b/eigrpd/eigrp_hello.c
@@ -630,7 +630,7 @@ static struct eigrp_packet *eigrp_hello_encode(struct eigrp_interface *ei,
uint16_t length = EIGRP_HEADER_LEN;
// allocate a new packet to be sent
- ep = eigrp_packet_new(ei->ifp->mtu - sizeof(struct ip), NULL);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(ei->ifp->mtu), NULL);
if (ep) {
// encode common header feilds
diff --git a/eigrpd/eigrp_macros.h b/eigrpd/eigrp_macros.h
index eea7a2642..b30e19a86 100644
--- a/eigrpd/eigrp_macros.h
+++ b/eigrpd/eigrp_macros.h
@@ -35,6 +35,8 @@
//--------------------------------------------------------------------------
+#define EIGRP_PACKET_MTU(mtu) ((mtu) - (sizeof(struct ip)))
+
/* Topology Macros */
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 6f8d468a8..59864532c 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -51,6 +51,7 @@
#include "eigrpd/eigrp_zebra.h"
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_dump.h"
+#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
@@ -1088,7 +1089,7 @@ struct eigrp_packet *eigrp_packet_duplicate(struct eigrp_packet *old,
{
struct eigrp_packet *new;
- new = eigrp_packet_new(nbr->ei->ifp->mtu - sizeof(struct ip), nbr);
+ new = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
new->length = old->length;
new->retrans_counter = old->retrans_counter;
new->dst = old->dst;
diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c
index 8d13ef84d..dd4231fa0 100644
--- a/eigrpd/eigrp_query.c
+++ b/eigrpd/eigrp_query.c
@@ -167,7 +167,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
struct eigrp_prefix_entry *pe;
bool has_tlv = false;
bool new_packet = true;
- uint16_t eigrp_mtu = ei->ifp->mtu - sizeof(struct ip);
+ uint16_t eigrp_mtu = EIGRP_PACKET_MTU(ei->ifp->mtu);
for (ALL_LIST_ELEMENTS(ei->eigrp->topology_changes_internalIPV4, node,
nnode, pe)) {
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index de4a23b58..b7490cd49 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -85,7 +85,7 @@ void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
* End of filtering
*/
- ep = eigrp_packet_new(ei->ifp->mtu - sizeof(struct ip), nbr);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(ei->ifp->mtu), nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_REPLY, eigrp, ep->s, 0,
diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c
index 0f234ca4e..ff3832546 100644
--- a/eigrpd/eigrp_siaquery.c
+++ b/eigrpd/eigrp_siaquery.c
@@ -119,7 +119,7 @@ void eigrp_send_siaquery(struct eigrp_neighbor *nbr,
struct eigrp_packet *ep;
uint16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu - sizeof(struct ip), nbr);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAQUERY, nbr->ei->eigrp, ep->s, 0,
diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c
index 93814d14e..d3dd123f9 100644
--- a/eigrpd/eigrp_siareply.c
+++ b/eigrpd/eigrp_siareply.c
@@ -118,7 +118,7 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr,
struct eigrp_packet *ep;
uint16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu - sizeof(struct ip), nbr);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAREPLY, nbr->ei->eigrp, ep->s, 0,
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index cb5b4f518..a3080136b 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -420,7 +420,7 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr)
struct eigrp_packet *ep;
uint16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu - sizeof(struct ip), nbr);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
/* Prepare EIGRP INIT UPDATE header */
if (IS_DEBUG_EIGRP_PACKET(0, RECV))
@@ -533,7 +533,7 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
struct eigrp *eigrp = ei->eigrp;
struct prefix *dest_addr;
uint32_t seq_no = eigrp->sequence_number;
- uint16_t eigrp_mtu = ei->ifp->mtu - sizeof(struct ip);
+ uint16_t eigrp_mtu = EIGRP_PACKET_MTU(ei->ifp->mtu);
struct route_node *rn;
ep = eigrp_packet_new(eigrp_mtu, nbr);
@@ -604,7 +604,7 @@ void eigrp_update_send(struct eigrp_interface *ei)
struct eigrp *eigrp = ei->eigrp;
struct prefix *dest_addr;
uint32_t seq_no = eigrp->sequence_number;
- uint16_t eigrp_mtu = ei->ifp->mtu - sizeof(struct ip);
+ uint16_t eigrp_mtu = EIGRP_PACKET_MTU(ei->ifp->mtu);
if (ei->nbrs->count == 0)
return;
@@ -790,7 +790,7 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
}
}
- ep = eigrp_packet_new(ei->ifp->mtu - sizeof(struct ip), nbr);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(ei->ifp->mtu), nbr);
/* Prepare EIGRP Graceful restart UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_UPDATE, eigrp, ep->s, flags,