]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ripd: use only one constant for derivation
authorLu Feng <lu.feng@6wind.com>
Wed, 25 Jun 2014 07:43:15 +0000 (07:43 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 01:06:37 +0000 (01:06 +0000)
RIP_MAX_RTE is defined in ripd.h as 25 but is in fact the
result of a formula. More over it is not used in the code:
the code itself includes the fomula. This makes it un-clear
for maintenance.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 342a31bfda21616209366679ac522471e5772a2f)

ripd/ripd.c
ripd/ripd.h

index eed1956f88b7d76ba171c102c7db183fef6ed00a..0f88a6cb08ba21892b7b6f24f9ba8e3fe3f055b9 100644 (file)
@@ -2167,7 +2167,7 @@ rip_output_process (struct connected *ifc, struct sockaddr_in *to,
 
   /* Reset stream and RTE counter. */
   stream_reset (s);
-  rtemax = (RIP_PACKET_MAXSIZ - 4) / 20;
+  rtemax = RIP_MAX_RTE;
 
   /* Get RIP interface. */
   ri = ifc->ifp->info;
index fe1345c6f5645b3cca8967b43513c9f1cf80e526..390f832dbba58566b3b1d7b1fef11085d1493878 100644 (file)
@@ -49,7 +49,7 @@
 #define RIP_RTE_SIZE                    20
 
 /* Max count of routing table entry in one rip packet. */
-#define RIP_MAX_RTE                     25
+#define RIP_MAX_RTE   ((RIP_PACKET_MAXSIZ - RIP_HEADER_SIZE) / RIP_RTE_SIZE)
 
 /* RIP version 2 multicast address. */
 #ifndef INADDR_RIP_GROUP