Date: Thu, 16 Sep 2021 14:43:54 GMT From: Marko Zec <zec@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: eb3148cc4d25 - main - [fib algo][dxr] Fix division by zero. Message-ID: <202109161443.18GEhs3I093675@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=eb3148cc4d256c20b5c7c9052539139b6f57f58b commit eb3148cc4d256c20b5c7c9052539139b6f57f58b Author: Marko Zec <zec@FreeBSD.org> AuthorDate: 2021-09-16 14:34:05 +0000 Commit: Marko Zec <zec@FreeBSD.org> CommitDate: 2021-09-16 14:34:05 +0000 [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 --- sys/netinet/in_fib_dxr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 3c4e5700cd6c..3aa357cadedc 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -982,7 +982,9 @@ dxr2_try_squeeze: 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109161443.18GEhs3I093675>