[nft PATCH 20/26] scanner: reject: Move to own scope

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Two more keywords isolated.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 include/parser.h   | 1 +
 src/parser_bison.y | 3 ++-
 src/scanner.l      | 9 ++++++---
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/parser.h b/include/parser.h
index 090fd78871a6e..08bdeaca250b2 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -72,6 +72,7 @@ enum startcond_type {
 	PARSER_SC_EXPR_UDPLITE,
 
 	PARSER_SC_STMT_LOG,
+	PARSER_SC_STMT_REJECT,
 	PARSER_SC_STMT_SYNPROXY,
 };
 
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 22e953eaf77e6..1cdf4cc88376f 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -955,6 +955,7 @@ close_scope_numgen	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_NUMGE
 close_scope_osf		: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_OSF); };
 close_scope_quota	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_QUOTA); };
 close_scope_queue	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_QUEUE); };
+close_scope_reject	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_STMT_REJECT); };
 close_scope_reset	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_CMD_RESET); };
 close_scope_rt		: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_RT); };
 close_scope_sctp	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_SCTP); };
@@ -2835,7 +2836,7 @@ stmt			:	verdict_stmt
 			|	stateful_stmt
 			|	meta_stmt
 			|	log_stmt	close_scope_log
-			|	reject_stmt
+			|	reject_stmt	close_scope_reject
 			|	nat_stmt
 			|	tproxy_stmt
 			|	queue_stmt
diff --git a/src/scanner.l b/src/scanner.l
index 97545b7057ab7..6ef20512f6b35 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -238,6 +238,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 %s SCANSTATE_EXPR_UDPLITE
 
 %s SCANSTATE_STMT_LOG
+%s SCANSTATE_STMT_REJECT
 %s SCANSTATE_STMT_SYNPROXY
 
 %%
@@ -428,9 +429,11 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 "hour"			{ return HOUR; }
 "day"			{ return DAY; }
 
-"reject"		{ return _REJECT; }
-"with"			{ return WITH; }
-"icmpx"			{ return ICMPX; }
+"reject"		{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_REJECT); return _REJECT; }
+<SCANSTATE_STMT_REJECT>{
+	"with"			{ return WITH; }
+	"icmpx"			{ return ICMPX; }
+}
 
 "snat"			{ return SNAT; }
 "dnat"			{ return DNAT; }
-- 
2.34.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux