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
This commit is contained in:
Andrey V. Elsukov 2018-04-12 19:44:04 +00:00
parent 09a6be91bc
commit bd32e33552
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332449
3 changed files with 9 additions and 13 deletions

View File

@ -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 = "<invalid>";
@ -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));

View File

@ -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 );

View File

@ -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) ?