From bd32e3355205a94d79e56970e6efbe2287c60de4 Mon Sep 17 00:00:00 2001 From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 19:44:04 +0000 Subject: Remove printing of "not" keyword from print_ip6() function. After r331668 handling of F_NOT flag done in one place by print_instruction() function. Also remove unused argument from print_ip[6]() functions. MFC after: 1 week --- sbin/ipfw/ipfw2.c | 12 +++++------- sbin/ipfw/ipfw2.h | 2 +- sbin/ipfw/ipv6.c | 8 +++----- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'sbin/ipfw') diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 005179229536..c173573bbb26 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -1176,8 +1176,7 @@ print_flags(struct buf_pr *bp, char const *name, ipfw_insn *cmd, * Print the ip address contained in a command. */ static void -print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd, - char const *s) +print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd) { struct hostent *he = NULL; struct in_addr *ia; @@ -1185,6 +1184,7 @@ print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd, uint32_t *a = ((ipfw_insn_u32 *)cmd)->d; char *t; + bprintf(bp, " "); if (cmd->o.opcode == O_IP_DST_LOOKUP && len > F_INSN_SIZE(ipfw_insn_u32)) { uint32_t d = a[1]; const char *arg = ""; @@ -1192,11 +1192,9 @@ print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd, if (d < sizeof(lookup_key)/sizeof(lookup_key[0])) arg = match_value(rule_options, lookup_key[d]); t = table_search_ctlv(fo->tstate, ((ipfw_insn *)cmd)->arg1); - bprintf(bp, " lookup %s %s", arg, t); + bprintf(bp, "lookup %s %s", arg, t); return; } - bprintf(bp, "%s ", s); - if (cmd->o.opcode == O_IP_SRC_ME || cmd->o.opcode == O_IP_DST_ME) { bprintf(bp, "me"); return; @@ -1467,7 +1465,7 @@ print_instruction(struct buf_pr *bp, const struct format_opts *fo, case O_IP_DST_MASK: case O_IP_DST_ME: case O_IP_DST_SET: - print_ip(bp, fo, insntod(cmd, ip), ""); + print_ip(bp, fo, insntod(cmd, ip)); break; case O_IP6_SRC: case O_IP6_SRC_MASK: @@ -1475,7 +1473,7 @@ print_instruction(struct buf_pr *bp, const struct format_opts *fo, case O_IP6_DST: case O_IP6_DST_MASK: case O_IP6_DST_ME: - print_ip6(bp, insntod(cmd, ip6), ""); + print_ip6(bp, insntod(cmd, ip6)); break; case O_FLOW6ID: print_flow6id(bp, insntod(cmd, u32)); diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 8acc4b9290d1..7791ed71fc66 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -401,7 +401,7 @@ int ipfw_delete_pipe(int pipe_or_queue, int n); /* ipv6.c */ void print_unreach6_code(struct buf_pr *bp, uint16_t code); -void print_ip6(struct buf_pr *bp, struct _ipfw_insn_ip6 *cmd, char const *s); +void print_ip6(struct buf_pr *bp, struct _ipfw_insn_ip6 *cmd); void print_flow6id(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); void print_icmp6types(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); void print_ext6hdr(struct buf_pr *bp, struct _ipfw_insn *cmd ); diff --git a/sbin/ipfw/ipv6.c b/sbin/ipfw/ipv6.c index 103e7438c8cd..8d7e20fff211 100644 --- a/sbin/ipfw/ipv6.c +++ b/sbin/ipfw/ipv6.c @@ -85,17 +85,15 @@ print_unreach6_code(struct buf_pr *bp, uint16_t code) * Print the ip address contained in a command. */ void -print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd, char const *s) +print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd) { struct hostent *he = NULL; int len = F_LEN((ipfw_insn *) cmd) - 1; struct in6_addr *a = &(cmd->addr6); char trad[255]; - bprintf(bp, "%s%s ", cmd->o.len & F_NOT ? " not": "", s); - if (cmd->o.opcode == O_IP6_SRC_ME || cmd->o.opcode == O_IP6_DST_ME) { - bprintf(bp, "me6"); + bprintf(bp, " me6"); return; } if (cmd->o.opcode == O_IP6) { @@ -108,7 +106,7 @@ print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd, char const *s) * addr/mask pairs have len = (2n+1). We convert len to n so we * use that to count the number of entries. */ - + bprintf(bp, " "); for (len = len / 4; len > 0; len -= 2, a += 2) { int mb = /* mask length */ (cmd->o.opcode == O_IP6_SRC || cmd->o.opcode == O_IP6_DST) ? -- cgit v1.2.3