Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2014 17:20:17 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        ianf@clue.co.za
Cc:        current@FreeBSD.org
Subject:   Re: netstat: sysctl: net.route.0.0.dump.0: Cannot allocate memory
Message-ID:  <20140221.172017.821481836359198829.hrs@allbsd.org>
In-Reply-To: <E1WGkzK-0000gb-E2@clue.co.za>
References:  <E1WGkzK-0000gb-E2@clue.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Fri_Feb_21_17_20_17_2014_775)--
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Fri_Feb_21_17_20_17_2014_030)--"
Content-Transfer-Encoding: 7bit

----Next_Part(Fri_Feb_21_17_20_17_2014_030)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

"Ian FREISLICH" <ianf@clue.co.za> wrote
  in <E1WGkzK-0000gb-E2@clue.co.za>:

ia> Hi
ia>
ia> While recieving my routing table I used to be able to check how far
ia> it got by counting the output netstat -rn.  It takes about 2 seconds
ia> to recieve the routes from my route-server, but over a minute to
ia> update the kernel routing table.
ia>
ia> I'm now getting this error until zebra completes route insertion.
ia>
ia> [firewall1.jnb1] ~ $ netstat -rn |wc -l
ia> netstat: sysctl: net.route.0.0.dump.0: Cannot allocate memory
ia>        1
ia> [firewall1.jnb1] ~ $ netstat -rn |wc -l
ia>   480446

 Perhaps does the attached patch fix this?

-- Hiroki

----Next_Part(Fri_Feb_21_17_20_17_2014_030)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="netstat.diff"

Index: usr.bin/netstat/route.c
===================================================================
--- usr.bin/netstat/route.c	(revision 262283)
+++ usr.bin/netstat/route.c	(working copy)
@@ -614,7 +614,7 @@
 	if ((buf = malloc(needed)) == 0) {
 		errx(2, "malloc(%lu)", (unsigned long)needed);
 	}
-	if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+	if (sysctl(mib, 7, buf, &needed, NULL, 0) < 0) {
 		err(1, "sysctl: net.route.0.%d.dump.%d", af, fibnum);
 	}
 	lim  = buf + needed;

----Next_Part(Fri_Feb_21_17_20_17_2014_030)----

----Security_Multipart0(Fri_Feb_21_17_20_17_2014_775)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlMHDEEACgkQTyzT2CeTzy2cqgCgu/pw9bttvBrktRPytrIqI5Mc
KV8AoK1zG1TQXr75wfmPSM0whHXNqdbr
=WAB8
-----END PGP SIGNATURE-----

----Security_Multipart0(Fri_Feb_21_17_20_17_2014_775)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140221.172017.821481836359198829.hrs>