2
0
Эх сурвалжийг харах

script paser: proto names not recognized fix

- if (proto==...) did not work anymore when used with proto names
  instead of numbers.

Reported-by: Nils Ohlmeier  nils at iptel org.
Closes FlySpray#15.
Andrei Pelinescu-Onciul 16 жил өмнө
parent
commit
d29c959ab9
1 өөрчлөгдсөн 6 нэмэгдсэн , 1 устгасан
  1. 6 1
      cfg.y

+ 6 - 1
cfg.y

@@ -1820,7 +1820,6 @@ eint_op_onsend:
 /* boolean expression integer operands */
 eint_op:	SRCPORT		{ $$=SRCPORT_O; }
 		|	DSTPORT		{ $$=DSTPORT_O; }
-		|	PROTO		{ $$=PROTO_O; }
 		|	AF			{ $$=AF_O; }
 		|	MSGLEN		{ $$=MSGLEN_O; }
 		|	RETCODE		{ $$=RETCODE_O; }
@@ -1862,6 +1861,12 @@ exp_elem:
 	| eint_op cmpop error   { $$=0; yyerror("number expected"); }
 	| eint_op equalop error { $$=0; yyerror("number expected"); }
 	| eint_op error { $$=0; yyerror("==, !=, <,>, >= or <=  expected"); }
+	| PROTO equalop %prec EQUAL_T proto
+		{ $$=mk_elem($2, PROTO_O, 0, NUMBER_ST, (void*)$3 ); }
+	| PROTO equalop %prec EQUAL_T rval_expr
+		{ $$=mk_elem($2, PROTO_O, 0, RVE_ST, $3 ); }
+	| PROTO equalop error
+		{ $$=0; yyerror("protocol expected (udp, tcp, tls or sctp)"); }
 	| eip_op strop %prec EQUAL_T ipnet { $$=mk_elem($2, $1, 0, NET_ST, $3); }
 	| eip_op strop %prec EQUAL_T rval_expr {
 			s_tmp.s=0;