From owner-svn-src-head@FreeBSD.ORG Tue Jan 20 18:16:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39C4A106566C; Tue, 20 Jan 2009 18:16:32 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F5FB8FC1B; Tue, 20 Jan 2009 18:16:32 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0KIGV0u052782; Tue, 20 Jan 2009 18:16:31 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0KIGVpR052780; Tue, 20 Jan 2009 18:16:31 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901201816.n0KIGVpR052780@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 20 Jan 2009 18:16:31 +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: r187477 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2009 18:16:32 -0000 Author: luigi Date: Tue Jan 20 18:16:31 2009 New Revision: 187477 URL: http://svn.freebsd.org/changeset/base/187477 Log: Fix a number of (innocuous) warnings, and remove a useless test. There are still several signed/unsigned warnings left, which require a bit more study for a proper fix. This file has grown beyond reasonable limits. We really need to split it into separate components (ipv4, ipv6, dummynet, nat, table, userland-kernel communication ...) so we can make mainteinance easier. MFC after: 1 weeks Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 20 17:36:58 2009 (r187476) +++ head/sbin/ipfw/ipfw2.c Tue Jan 20 18:16:31 2009 (r187477) @@ -787,11 +787,12 @@ altq_set_enabled(int enabled) } static void -altq_fetch() +altq_fetch(void) { struct pfioc_altq pfioc; struct pf_altq *altq; - int pffd, mnr; + int pffd; + unsigned int mnr; if (altq_fetched) return; @@ -1315,7 +1316,7 @@ static struct _s_x ext6hdrcodes[] = { }; /* fills command for the extension header filtering */ -int +static int fill_ext6hdr( ipfw_insn *cmd, char *av) { int tok; @@ -1371,7 +1372,7 @@ fill_ext6hdr( ipfw_insn *cmd, char *av) return 1; } -void +static void print_ext6hdr( ipfw_insn *cmd ) { char sep = ' '; @@ -1432,7 +1433,7 @@ print_ext6hdr( ipfw_insn *cmd ) #define HAVE_IP (HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP) static void -show_prerequisites(int *flags, int want, int cmd) +show_prerequisites(int *flags, int want, int cmd __unused) { if (comment_only) return; @@ -1440,14 +1441,14 @@ show_prerequisites(int *flags, int want, *flags |= HAVE_OPTIONS; if ( !(*flags & HAVE_OPTIONS)) { - if ( !(*flags & HAVE_PROTO) && (want & HAVE_PROTO)) + if ( !(*flags & HAVE_PROTO) && (want & HAVE_PROTO)) { if ( (*flags & HAVE_PROTO4)) printf(" ip4"); else if ( (*flags & HAVE_PROTO6)) printf(" ip6"); else printf(" ip"); - + } if ( !(*flags & HAVE_SRCIP) && (want & HAVE_SRCIP)) printf(" from any"); if ( !(*flags & HAVE_DSTIP) && (want & HAVE_DSTIP)) @@ -1462,7 +1463,7 @@ show_ipfw(struct ip_fw *rule, int pcwidt static int twidth = 0; int l; ipfw_insn *cmd, *tagptr = NULL; - char *comment = NULL; /* ptr to comment if we have one */ + const char *comment = NULL; /* ptr to comment if we have one */ int proto = 0; /* default */ int flags = 0; /* prerequisites */ ipfw_insn_log *logptr = NULL; /* set if we find an O_LOG */ @@ -2814,7 +2815,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av) */ char *t = NULL, *p = strpbrk(av, "/:,{"); int masklen; - char md, nd; + char md, nd = '\0'; if (p) { md = *p; @@ -3122,7 +3123,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) * it's supported lists of flow-id, so in the o.arg1 we store how many * additional flow-id we want to filter, the basic is 1 */ -void +static void fill_flow6( ipfw_insn_u32 *cmd, char *av ) { u_int32_t type; /* Current flow number */ @@ -3155,9 +3156,8 @@ add_srcip6(ipfw_insn *cmd, char *av) { fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) /* any */ - ; - if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ + if (F_LEN(cmd) == 0) { /* any */ + } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ cmd->opcode = O_IP6_SRC_ME; } else if (F_LEN(cmd) == (F_INSN_SIZE(struct in6_addr) + F_INSN_SIZE(ipfw_insn))) { @@ -3174,9 +3174,8 @@ add_dstip6(ipfw_insn *cmd, char *av) { fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) /* any */ - ; - if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ + if (F_LEN(cmd) == 0) { /* any */ + } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ cmd->opcode = O_IP6_DST_ME; } else if (F_LEN(cmd) == (F_INSN_SIZE(struct in6_addr) + F_INSN_SIZE(ipfw_insn))) { @@ -3859,7 +3858,8 @@ static void show_nat(int ac, char **av); static void -print_nat_config(char *buf) { +print_nat_config(unsigned char *buf) +{ struct cfg_nat *n; int i, cnt, flag, off; struct cfg_redir *t; @@ -4227,7 +4227,7 @@ config_pipe(int ac, char **av) "flow_id mask must be 20 bit"); *p20 = (uint32_t)a; } else if (pa6 != NULL) { - if (a < 0 || a > 128) + if (a > 128) errx(EX_DATAERR, "in6addr invalid mask len"); else