Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Apr 2018 10:06:53 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332763 - stable/11/sbin/ipfw
Message-ID:  <201804191006.w3JA6ri3098006@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Apr 19 10:06:53 2018
New Revision: 332763
URL: https://svnweb.freebsd.org/changeset/base/332763

Log:
  MFC r332449:
    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.

Modified:
  stable/11/sbin/ipfw/ipfw2.c
  stable/11/sbin/ipfw/ipfw2.h
  stable/11/sbin/ipfw/ipv6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw2.c
==============================================================================
--- stable/11/sbin/ipfw/ipfw2.c	Thu Apr 19 10:05:12 2018	(r332762)
+++ stable/11/sbin/ipfw/ipfw2.c	Thu Apr 19 10:06:53 2018	(r332763)
@@ -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: stable/11/sbin/ipfw/ipfw2.h
==============================================================================
--- stable/11/sbin/ipfw/ipfw2.h	Thu Apr 19 10:05:12 2018	(r332762)
+++ stable/11/sbin/ipfw/ipfw2.h	Thu Apr 19 10:06:53 2018	(r332763)
@@ -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: stable/11/sbin/ipfw/ipv6.c
==============================================================================
--- stable/11/sbin/ipfw/ipv6.c	Thu Apr 19 10:05:12 2018	(r332762)
+++ stable/11/sbin/ipfw/ipv6.c	Thu Apr 19 10:06:53 2018	(r332763)
@@ -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) ?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804191006.w3JA6ri3098006>