[sr-dev] git:master: script paser: proto names not recognized fix

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Sep 21 10:10:14 CEST 2009


Module: sip-router
Branch: master
Commit: d29c959ab97d4f51975401b85b0bb84f85589e12
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d29c959ab97d4f51975401b85b0bb84f85589e12

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Sep 21 10:06:11 2009 +0200

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.

---

 cfg.y |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/cfg.y b/cfg.y
index 528a70a..9844d5f 100644
--- a/cfg.y
+++ b/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;




More information about the sr-dev mailing list