diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-14 14:06:01 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-14 15:08:58 +0000 |
| commit | 6196c77a4f4facc2f6df34cdf2ce02f3d5f5083c (patch) | |
| tree | 212d558b903c3294b6d51150382ba6c4da685ff4 /zebra/irdp_interface.c | |
| parent | 93f855c24a301bbebf4a9ce9f4b10d3edf217709 (diff) | |
zebra: fix divide-by-zero
x % 0 = FPE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra/irdp_interface.c')
| -rw-r--r-- | zebra/irdp_interface.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 5cabe7e62f..6ea14b3058 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -476,18 +476,14 @@ 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; } - - vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s", - VTY_NEWLINE); - - vty_out (vty, "Please correct!%s", - VTY_NEWLINE); - return CMD_WARNING; + else { + vty_out (vty, "%% MinAdvertInterval must be less than MaxAdvertInterval"); + return CMD_WARNING; + } } DEFUN (ip_irdp_maxadvertinterval, @@ -506,19 +502,14 @@ DEFUN (ip_irdp_maxadvertinterval, zi=ifp->info; irdp=&zi->irdp; - - if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) { - irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg); - + if(irdp->MinAdvertInterval < (unsigned) atoi(argv[idx_number]->arg)) { + irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg); return CMD_SUCCESS; } - - vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s", - VTY_NEWLINE); - - vty_out (vty, "Please correct!%s", - VTY_NEWLINE); - return CMD_WARNING; + else { + vty_out (vty, "%% MaxAdvertInterval must be greater than MinAdvertInterval"); + return CMD_WARNING; + } } /* DEFUN needs to be fixed for negative ranages... |
