]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: more dbzing 713/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 16 Jun 2017 16:18:54 +0000 (16:18 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 16 Jun 2017 16:33:46 +0000 (16:33 +0000)
Revert to the previous <= restrictions, improve error messages, fix the
divide by zero.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/irdp_interface.c
zebra/irdp_main.c

index 6ea14b305885d04fc533542f7c388101bb8b570a..407738d80f49d3607e6532afa12ea08921127221 100644 (file)
@@ -476,12 +476,13 @@ DEFUN (ip_irdp_minadvertinterval,
   zi=ifp->info;
   irdp=&zi->irdp;
 
-  if((unsigned) atoi(argv[idx_number]->arg) < irdp->MaxAdvertInterval) {
+  if((unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
       irdp->MinAdvertInterval = atoi(argv[idx_number]->arg);
       return CMD_SUCCESS;
   }
   else {
-      vty_out (vty, "%% MinAdvertInterval must be less than MaxAdvertInterval");
+      vty_out (vty, "%% MinAdvertInterval must be less than or equal to "
+                    "MaxAdvertInterval%s", VTY_NEWLINE);
       return CMD_WARNING;
   }
 }
@@ -502,12 +503,13 @@ DEFUN (ip_irdp_maxadvertinterval,
   zi=ifp->info;
   irdp=&zi->irdp;
 
-  if(irdp->MinAdvertInterval < (unsigned) atoi(argv[idx_number]->arg)) {
+  if(irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg)) {
       irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
       return CMD_SUCCESS;
   }
   else {
-      vty_out (vty, "%% MaxAdvertInterval must be greater than MinAdvertInterval");
+      vty_out (vty, "%% MaxAdvertInterval must be greater than or equal to "
+                    "MinAdvertInterval%s", VTY_NEWLINE);
       return CMD_WARNING;
   }
 }
index 8f1647c9db99cfb0efa4464d57f7666cbe9fbdd3..6965dca3e47d1bb0029f1c5381ac514566ddb07c 100644 (file)
@@ -234,8 +234,7 @@ int irdp_send_thread(struct thread *t_advert)
       }
 
   tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval;
-  assert (tmp > 0);
-  timer = (random () % tmp) + 1;
+  timer = random () % (tmp + 1);
   timer = irdp->MinAdvertInterval + timer;
 
   if(irdp->irdp_sent <  MAX_INITIAL_ADVERTISEMENTS &&