Browse code

core: internal difference between cfg drop and exit

- drop sets the flag for exit and one extra: EXIT_R_F and DROP_R_F
- no difference in processing right now (DROP_R_F not tested anywhere
yet)

Daniel-Constantin Mierla authored on 08/07/2009 21:24:52
Showing 3 changed files
... ...
@@ -149,7 +149,8 @@ FORWARD_TCP	forward_tcp
149 149
 FORWARD_UDP	forward_udp
150 150
 FORWARD_TLS	forward_tls
151 151
 FORWARD_SCTP	forward_sctp
152
-DROP	"drop"|"exit"
152
+DROP	"drop"
153
+EXIT	"exit"
153 154
 RETURN	"return"
154 155
 BREAK	"break"
155 156
 SEND	send
... ...
@@ -486,6 +487,7 @@ EAT_ABLE	[\ \t\b\r]
486 487
 <INITIAL>{FORWARD_SCTP}	{count(); yylval.strval=yytext; return FORWARD_SCTP;}
487 488
 <INITIAL>{FORWARD_UDP}	{count(); yylval.strval=yytext; return FORWARD_UDP; }
488 489
 <INITIAL>{DROP}	{ count(); yylval.strval=yytext; return DROP; }
490
+<INITIAL>{EXIT}	{ count(); yylval.strval=yytext; return EXIT; }
489 491
 <INITIAL>{RETURN}	{ count(); yylval.strval=yytext; return RETURN; }
490 492
 <INITIAL>{BREAK}	{ count(); yylval.strval=yytext; return BREAK; }
491 493
 <INITIAL>{SEND}	{ count(); yylval.strval=yytext; return SEND; }
... ...
@@ -265,6 +265,7 @@ static int case_check_default(struct case_stms* stms);
265 265
 %token FORWARD_UDP
266 266
 %token SEND
267 267
 %token SEND_TCP
268
+%token EXIT
268 269
 %token DROP
269 270
 %token RETURN
270 271
 %token BREAK
... ...
@@ -2940,18 +2941,34 @@ func_param:
2940 2941
 
2941 2942
 ret_cmd:
2942 2943
 	DROP LPAREN RPAREN		{
2943
-		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
2944
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
2945
+						(void*)(DROP_R_F|EXIT_R_F)); 
2944 2946
 	}
2945 2947
 	| DROP rval_expr	{
2946
-		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)EXIT_R_F);
2948
+		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST,
2949
+						(void*)(DROP_R_F|EXIT_R_F)); 
2947 2950
 	}
2948 2951
 	| DROP				{
2952
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, 
2953
+						(void*)(DROP_R_F|EXIT_R_F)); 
2954
+	}
2955
+	| EXIT LPAREN RPAREN		{
2956
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
2957
+	}
2958
+	| EXIT rval_expr	{
2959
+		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)EXIT_R_F);
2960
+	}
2961
+	| EXIT				{
2949 2962
 		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
2950 2963
 	}
2951 2964
 	| RETURN			{
2952 2965
 		$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
2953 2966
 						(void*)RETURN_R_F);
2954 2967
 	}
2968
+	| RETURN  LPAREN RPAREN		{
2969
+		$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
2970
+						(void*)RETURN_R_F);
2971
+	}
2955 2972
 	| RETURN rval_expr	{
2956 2973
 		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)RETURN_R_F);
2957 2974
 	}
... ...
@@ -109,6 +109,7 @@ enum { NOSUBTYPE=0, STRING_ST, NET_ST, NUMBER_ST, IP_ST, RE_ST, PROXY_ST,
109 109
 #define EXIT_R_F   1
110 110
 #define RETURN_R_F 2
111 111
 #define BREAK_R_F  4
112
+#define DROP_R_F   8
112 113
 
113 114
 
114 115
 struct cfg_pos{