diff options
author | luigi <luigi@FreeBSD.org> | 2009-01-20 18:16:31 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2009-01-20 18:16:31 +0000 |
commit | cee4a08b628a7b35f5901643bb8d336eff5a637b (patch) | |
tree | 6c4a326387d62183e32e306a0e8b325e94576dcc | |
parent | e6593c6ded66bef65d4275ed5bd61f0d161aa5ec (diff) | |
download | FreeBSD-src-cee4a08b628a7b35f5901643bb8d336eff5a637b.zip FreeBSD-src-cee4a08b628a7b35f5901643bb8d336eff5a637b.tar.gz |
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
-rw-r--r-- | sbin/ipfw/ipfw2.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 7834783..b2fa9d6 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -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, int cmd) *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 pcwidth, int bcwidth) 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 |