svn commit: r304087 - head/sbin/ipfw

Andrey V. Elsukov ae at FreeBSD.org
Sun Aug 14 18:05:43 UTC 2016


Author: ae
Date: Sun Aug 14 18:05:41 2016
New Revision: 304087
URL: https://svnweb.freebsd.org/changeset/base/304087

Log:
  Do not warn about ambiguous state name when we inspect a comment token.
  
  Reported by:	lev

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Sun Aug 14 16:57:10 2016	(r304086)
+++ head/sbin/ipfw/ipfw2.c	Sun Aug 14 18:05:41 2016	(r304087)
@@ -3718,11 +3718,14 @@ compile_rule(char *av[], uint32_t *rbuf,
 		}
 		if (strcmp(*av, "any") == 0)
 			action->arg1 = 0;
-		else if (match_token(rule_options, *av) != -1) {
+		else if ((i = match_token(rule_options, *av)) != -1) {
 			action->arg1 = pack_object(tstate,
 			    default_state_name, IPFW_TLV_STATE_NAME);
-			warn("Ambiguous state name '%s', '%s' used instead.\n",
-			    *av, default_state_name);
+			if (i != TOK_COMMENT)
+				warn("Ambiguous state name '%s', '%s'"
+				    " used instead.\n", *av,
+				    default_state_name);
+			break;
 		} else if (state_check_name(*av) == 0)
 			action->arg1 = pack_object(tstate, *av,
 			    IPFW_TLV_STATE_NAME);
@@ -4563,8 +4566,8 @@ read_options:
 				errx(EX_USAGE, "only one of keep-state "
 					"and limit is allowed");
 			if (*av == NULL ||
-			    match_token(rule_options, *av) != -1) {
-				if (*av != NULL)
+			    (i = match_token(rule_options, *av)) != -1) {
+				if (*av != NULL && i != TOK_COMMENT)
 					warn("Ambiguous state name '%s',"
 					    " '%s' used instead.\n", *av,
 					    default_state_name);
@@ -4615,8 +4618,8 @@ read_options:
 			av++;
 
 			if (*av == NULL ||
-			    match_token(rule_options, *av) != -1) {
-				if (*av != NULL)
+			    (i = match_token(rule_options, *av)) != -1) {
+				if (*av != NULL && i != TOK_COMMENT)
 					warn("Ambiguous state name '%s',"
 					    " '%s' used instead.\n", *av,
 					    default_state_name);


More information about the svn-src-head mailing list