From owner-svn-src-all@FreeBSD.ORG Wed Jul 6 15:18:33 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 2829E1065670; Wed, 6 Jul 2011 15:18:33 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E6558FC0A; Wed, 6 Jul 2011 15:18:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p66FIWXJ021669; Wed, 6 Jul 2011 15:18:32 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p66FIWRc021666; Wed, 6 Jul 2011 15:18:32 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201107061518.p66FIWRc021666@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 6 Jul 2011 15:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223824 - 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: Wed, 06 Jul 2011 15:18:33 -0000 Author: pluknet Date: Wed Jul 6 15:18:32 2011 New Revision: 223824 URL: http://svn.freebsd.org/changeset/base/223824 Log: Conditionally compile in the IPv4/IPv6 address family support. Test it with feature_present(3), so that we do not end up with passing an unsupported version to NgSendMsg(3). Approved by: glebius Modified: head/usr.sbin/flowctl/Makefile head/usr.sbin/flowctl/flowctl.c Modified: head/usr.sbin/flowctl/Makefile ============================================================================== --- head/usr.sbin/flowctl/Makefile Wed Jul 6 15:09:52 2011 (r223823) +++ head/usr.sbin/flowctl/Makefile Wed Jul 6 15:18:32 2011 (r223824) @@ -14,7 +14,8 @@ LDADD= -lnetgraph .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif - -CFLAGS+= -I. +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif .include Modified: head/usr.sbin/flowctl/flowctl.c ============================================================================== --- head/usr.sbin/flowctl/flowctl.c Wed Jul 6 15:09:52 2011 (r223823) +++ head/usr.sbin/flowctl/flowctl.c Wed Jul 6 15:18:32 2011 (r223824) @@ -69,12 +69,18 @@ static const char rcs_id[] = #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_print6(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_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,7 +163,10 @@ execute_command(int argc, char **argv) static void ctl_show(int argc, char **argv) { - int ipv4 = 1, ipv6 = 1, verbose = 0; + int ipv4, ipv6, verbose = 0; + + ipv4 = feature_present("inet"); + ipv6 = feature_present("inet6"); if (argc > 0 && !strncmp(argv[0], "ipv4", 4)) { ipv6 = 0; @@ -173,21 +182,26 @@ ctl_show(int argc, char **argv) if (argc > 0 && !strncmp(argv[0], "verbose", strlen(argv[0]))) verbose = 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 @@ do_show(int version, void (*func)(struct req.list_id = resp->list_id; } } +#endif +#ifdef INET static void flow_cache_print(struct ngnf_show_header *resp) { @@ -261,6 +277,7 @@ flow_cache_print(struct ngnf_show_header } } +#endif #ifdef INET6 static void @@ -295,6 +312,7 @@ flow_cache_print6(struct ngnf_show_heade } #endif +#ifdef INET static void flow_cache_print_verbose(struct ngnf_show_header *resp) { @@ -335,6 +353,7 @@ flow_cache_print_verbose(struct ngnf_sho } } +#endif #ifdef INET6 static void