zebra: more dbzing

Revert to the previous <= restrictions, improve error messages, fix the
divide by zero.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2017-06-16 16:18:54 +00:00
parent 6196c77a4f
commit 11e2897282
2 changed files with 7 additions and 6 deletions

View 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;
}
}

View 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 &&