svn commit: r332449 - head/sbin/ipfw

Andrey V. Elsukov ae at FreeBSD.org
Thu Apr 12 19:44:06 UTC 2018


Author: ae
Date: Thu Apr 12 19:44:04 2018
New Revision: 332449
URL: https://svnweb.freebsd.org/changeset/base/332449

Log:
  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

Modified:
  head/sbin/ipfw/ipfw2.c
  head/sbin/ipfw/ipfw2.h
  head/sbin/ipfw/ipv6.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Thu Apr 12 19:34:35 2018	(r332448)
+++ head/sbin/ipfw/ipfw2.c	Thu Apr 12 19:44:04 2018	(r332449)
@@ -1176,8 +1176,7 @@ print_flags(struct buf_pr *bp, char const *name, ipfw_
  * 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 *
 	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 *
 		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 form
 	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 form
 	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));

Modified: head/sbin/ipfw/ipfw2.h
==============================================================================
--- head/sbin/ipfw/ipfw2.h	Thu Apr 12 19:34:35 2018	(r332448)
+++ head/sbin/ipfw/ipfw2.h	Thu Apr 12 19:44:04 2018	(r332449)
@@ -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 );

Modified: head/sbin/ipfw/ipv6.c
==============================================================================
--- head/sbin/ipfw/ipv6.c	Thu Apr 12 19:34:35 2018	(r332448)
+++ head/sbin/ipfw/ipv6.c	Thu Apr 12 19:44:04 2018	(r332449)
@@ -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 
 	* 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) ?


More information about the svn-src-head mailing list