From owner-freebsd-current@FreeBSD.ORG Fri Feb 21 08:23:04 2014 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98A64DB7 for ; Fri, 21 Feb 2014 08:23:04 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DB0BF1F9A for ; Fri, 21 Feb 2014 08:23:03 +0000 (UTC) Received: from alph.d.allbsd.org (p2106-ipbf2009funabasi.chiba.ocn.ne.jp [114.146.169.106]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id s1L8Mfoj070489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Feb 2014 17:22:52 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.7/8.14.7) with ESMTP id s1L8Mego033307; Fri, 21 Feb 2014 17:22:41 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 21 Feb 2014 17:20:17 +0900 (JST) Message-Id: <20140221.172017.821481836359198829.hrs@allbsd.org> To: ianf@clue.co.za Subject: Re: netstat: sysctl: net.route.0.0.dump.0: Cannot allocate memory From: Hiroki Sato In-Reply-To: References: X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Fri_Feb_21_17_20_17_2014_775)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 21 Feb 2014 17:22:53 +0900 (JST) X-Spam-Status: No, score=-93.8 required=13.0 tests=CONTENT_TYPE_PRESENT, FAKEDWORD_VERTICALLINE,RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: current@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2014 08:23:04 -0000 ----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" wrote in : 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)----