From owner-svn-src-all@FreeBSD.ORG Tue Jul 5 16:47:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 276361065675; Tue, 5 Jul 2011 16:47:21 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id A4E288FC0A; Tue, 5 Jul 2011 16:47:20 +0000 (UTC) Received: by ywf7 with SMTP id 7so2995143ywf.13 for ; Tue, 05 Jul 2011 09:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WK9fip47z+v1KUmzSSoTyBkyLhspnBcn2pszq8JsLB8=; b=H+sUA9RSxArXnjQkzPate/qfaLffnjA6gjc2820VQn8WKhXtBhI0p9BvHKiME1YaxG LYbuAn/uRm5OGyUEQnG1r6t4aDmq/sQI1v+CwLfMzTFKCJHNKGtNYIgsZ45MNnKOPZ2c xMJzF3Nw6PFD+ixBzSIbF82m32zz4gYXdltjE= MIME-Version: 1.0 Received: by 10.151.8.21 with SMTP id l21mr2678520ybi.186.1309884439771; Tue, 05 Jul 2011 09:47:19 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.150.92.6 with HTTP; Tue, 5 Jul 2011 09:47:19 -0700 (PDT) In-Reply-To: <201107051450.p65Eo7ah073669@svn.freebsd.org> References: <201107051450.p65Eo7ah073669@svn.freebsd.org> Date: Tue, 5 Jul 2011 20:47:19 +0400 X-Google-Sender-Auth: QhA1fbRwYT4FAAUjRnoRrMX_wZM Message-ID: From: Sergey Kandaurov To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r223788 - head/usr.sbin/flowctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jul 2011 16:47:21 -0000 On 5 July 2011 18:50, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Jul =A05 14:50:06 2011 > New Revision: 223788 > URL: http://svn.freebsd.org/changeset/base/223788 > > Log: > =A0Rewrite the flowctl utility to add it support for displaying > =A0both IPv4 and IPv4 flows. > > Modified: > =A0head/usr.sbin/flowctl/Makefile > =A0head/usr.sbin/flowctl/flowctl.c > > Modified: head/usr.sbin/flowctl/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/flowctl/Makefile =A0 =A0 =A0Tue Jul =A05 14:48:39 2011 = =A0 =A0 =A0 =A0(r223787) > +++ head/usr.sbin/flowctl/Makefile =A0 =A0 =A0Tue Jul =A05 14:50:06 2011 = =A0 =A0 =A0 =A0(r223788) > @@ -2,6 +2,8 @@ > =A0# $FreeBSD$ > =A0# > > +.include > + > =A0PROG=3D =A0flowctl > =A0MAN=3D =A0 flowctl.8 > > @@ -9,4 +11,10 @@ WARNS?=3D 2 > =A0DPADD=3D =A0${LIBNETGRAPH} > =A0LDADD=3D =A0-lnetgraph > > +.if ${MK_INET6_SUPPORT} !=3D "no" > +CFLAGS+=3D -DINET6 > +.endif [...] It's broken for WITHOUT_INET6=3Dyes. Please consider taking a look at the change below on top of r223788. The patch adds handling for WITHOUT_INET, too. Index: usr.sbin/flowctl/flowctl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.sbin/flowctl/flowctl.c (revision 223792) +++ usr.sbin/flowctl/flowctl.c (working copy) @@ -69,12 +69,18 @@ #define CISCO_SH_VERB_FLOW6 "%-14s %-30s %-14s %-30s %2u %3x %4x %6lu\n" \ "%4.4x /%-2u %-5u %4.4x /%-2u %-5u %-30s %9u %8u\n\= n" +#ifdef INET static void flow_cache_print(struct ngnf_show_header *resp); +static void flow_cache_print_verbose(struct ngnf_show_header *resp); +#endif +#ifdef INET6 static void flow_cache_print6(struct ngnf_show_header *resp); -static void flow_cache_print_verbose(struct ngnf_show_header *resp); static void flow_cache_print6_verbose(struct ngnf_show_header *resp); +#endif static void ctl_show(int, char **); +#if defined(INET) || defined(INET6) static void do_show(int, void (*func)(struct ngnf_show_header *)); +#endif static void help(void); static void execute_command(int, char **); @@ -157,8 +163,11 @@ static void ctl_show(int argc, char **argv) { - int ipv4 =3D 1, ipv6 =3D 1, verbose =3D 0; + int ipv4, ipv6, verbose =3D 0; + ipv4 =3D feature_present("inet"); + ipv6 =3D feature_present("inet6"); + if (argc > 0 && !strncmp(argv[0], "ipv4", 4)) { ipv6 =3D 0; argc--; @@ -173,21 +182,26 @@ if (argc > 0 && !strncmp(argv[0], "verbose", strlen(argv[0]))) verbose =3D 1; +#ifdef INET if (ipv4) { if (verbose) do_show(4, &flow_cache_print_verbose); else do_show(4, &flow_cache_print); } +#endif +#ifdef INET6 if (ipv6) { if (verbose) do_show(6, &flow_cache_print6_verbose); else do_show(6, &flow_cache_print6); } +#endif } +#if defined(INET) || defined(INET6) static void do_show(int version, void (*func)(struct ngnf_show_header *)) { @@ -230,7 +244,9 @@ req.list_id =3D resp->list_id; } } +#endif +#ifdef INET static void flow_cache_print(struct ngnf_show_header *resp) { @@ -261,6 +277,7 @@ } } +#endif #ifdef INET6 static void @@ -295,6 +312,7 @@ } #endif +#ifdef INET static void flow_cache_print_verbose(struct ngnf_show_header *resp) { @@ -335,6 +353,7 @@ } } +#endif #ifdef INET6 static void Index: usr.sbin/flowctl/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.sbin/flowctl/Makefile (revision 223792) +++ usr.sbin/flowctl/Makefile (working copy) @@ -14,7 +14,8 @@ .if ${MK_INET6_SUPPORT} !=3D "no" CFLAGS+=3D -DINET6 .endif +.if ${MK_INET_SUPPORT} !=3D "no" +CFLAGS+=3D -DINET +.endif -CFLAGS+=3D -I. - .include --=20 wbr, pluknet