]> git.puffer.fish Git - mirror/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)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 2 Jul 2014 17:30:20 +0000 (19:30 +0200)
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>
ripd/ripd.c
ripd/ripd.h

index dfeb951c510149dbf4a57ca903b820e52d580e16..8a7fef875b198b8c37e14bf34b0565ffb73006f2 100644 (file)
@@ -2169,7 +2169,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 45b07b9cb6b486c0603eb90f893d3416b415b55e..0fc2fd37562ff33ce2ffdd73374e40ef6ae80533 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