From owner-svn-src-all@FreeBSD.ORG Tue Apr 29 16:51:28 2014 Return-Path: Delivered-To: svn-src-all@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 F121FCA7; Tue, 29 Apr 2014 16:51:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3E851C33; Tue, 29 Apr 2014 16:51:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3TGpSmm031548; Tue, 29 Apr 2014 16:51:28 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3TGpSou031547; Tue, 29 Apr 2014 16:51:28 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201404291651.s3TGpSou031547@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 29 Apr 2014 16:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265096 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2014 16:51:29 -0000 Author: melifaro Date: Tue Apr 29 16:51:28 2014 New Revision: 265096 URL: http://svnweb.freebsd.org/changeset/base/265096 Log: Fix "netstat -gW" behavior broken in r259638. netstat has two options for printing multicast tables: sysctl (the default one for live systems) and kvm-based one (for cores). It looks like kvm-based one hasn't been working since it's been introduced in r190012 due to absence of mfctablesize kernel symbol. Check for all ipv4-multicast symbols being correctly resolved was introduced in r259638 regardless of 'live' value leading to "No IPv4 MROUTING" error message. Reported by: Olivier Cochard-Labbé MFC after: 1 week Modified: head/usr.bin/netstat/mroute.c Modified: head/usr.bin/netstat/mroute.c ============================================================================== --- head/usr.bin/netstat/mroute.c Tue Apr 29 15:25:57 2014 (r265095) +++ head/usr.bin/netstat/mroute.c Tue Apr 29 16:51:28 2014 (r265096) @@ -236,16 +236,7 @@ mroutepr() * functionality was deprecated, as PIM does not use it. */ maxvif = 0; - - kresolve_list(mrl); - pmfchashtbl = mrl[N_MFCHASHTBL].n_value; - pmfctablesize = mrl[N_MFCTABLESIZE].n_value; - pviftbl = mrl[N_VIFTABLE].n_value; - - if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } + pmfchashtbl = pmfctablesize = pviftbl = 0; len = sizeof(viftable); if (live) { @@ -254,8 +245,19 @@ mroutepr() warn("sysctl: net.inet.ip.viftable"); return; } - } else + } else { + kresolve_list(mrl); + pmfchashtbl = mrl[N_MFCHASHTBL].n_value; + pmfctablesize = mrl[N_MFCTABLESIZE].n_value; + pviftbl = mrl[N_VIFTABLE].n_value; + + if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) { + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); + return; + } + kread(pviftbl, (char *)viftable, sizeof(viftable)); + } banner_printed = 0; for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {