Page MenuHomeFreeBSD

D43956.diff
No OneTemporary

D43956.diff

diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -652,6 +652,12 @@
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
xo_err(1, "sysctl(PF_ROUTE estimate)");
if (needed > 0) {
+ /*
+ * Add ~2% additional space in case some records
+ * will appear between sysctl() calls.
+ * Round it up so it can fit 4 additional messages at least.
+ */
+ needed += ((needed >> 6) | (sizeof(m_rtmsg) * 4));
if ((buf = malloc(needed)) == NULL)
xo_err(1, "malloc");
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 11:14 AM (14 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15742056
Default Alt Text
D43956.diff (577 B)

Event Timeline