[fib algo][dxr] Fix division by zero.

A division by zero would occur if DXR would be activated on a vnet
with no IP addresses configured on any interfaces.

PR:		257965
MFC after:	3 days
Reported by:	Raul Munoz
This commit is contained in:
Marko Zec 2021-09-16 16:34:05 +02:00
parent 12061d2626
commit eb3148cc4d

View File

@ -982,7 +982,9 @@ dxr_build(struct dxr *dxr)
FIB_PRINTF(LOG_INFO, da->fd, "D%dR, %d prefixes, %d nhops (max)",
DXR_D, rinfo.num_prefixes, rinfo.num_nhops);
#endif
i = dxr_tot_size * 100 / rinfo.num_prefixes;
i = dxr_tot_size * 100;
if (rinfo.num_prefixes)
i /= rinfo.num_prefixes;
FIB_PRINTF(LOG_INFO, da->fd, "%d.%02d KBytes, %d.%02d Bytes/prefix",
dxr_tot_size / 1024, dxr_tot_size * 100 / 1024 % 100,
i / 100, i % 100);