... | ... |
@@ -5,7 +5,10 @@ |
5 | 5 |
# WARNING: requires gmake (GNU Make) |
6 | 6 |
# |
7 | 7 |
|
8 |
-sources= $(wildcard *.c) |
|
8 |
+lex_f=lex.yy.c |
|
9 |
+yacc_f=cfg.tab.c |
|
10 |
+sources= $(filter-out $(lex_f) $(yacc_f), $(wildcard *.c)) $(lex_f) \ |
|
11 |
+$(yacc_f) |
|
9 | 12 |
objs= $(sources:.c=.o) |
10 | 13 |
depends= $(sources:.c=.d) |
11 | 14 |
|
... | ... |
@@ -15,8 +18,8 @@ NAME=sip_router |
15 | 18 |
CC=gcc |
16 | 19 |
CFLAGS=-O2 -Wcast-align #-Wmissing-prototypes -Wall |
17 | 20 |
LEX=lex |
18 |
-YACC=bison |
|
19 |
-YACC_FLAGS=-d |
|
21 |
+YACC=yacc |
|
22 |
+YACC_FLAGS=-d -b cfg |
|
20 | 23 |
# on linux and freebsd keep it empty (e.g. LIBS= ) |
21 | 24 |
# on solaris add -lxnet (e.g. LIBS= -lxnet) |
22 | 25 |
LIBS=-lfl -L/usr/local/lib |
... | ... |
@@ -235,6 +235,7 @@ static int comp_ip(unsigned a, void* param, int op, int subtype) |
235 | 235 |
ret=(a&((struct net*)param)->mask)==((struct net*)param)->ip; |
236 | 236 |
break; |
237 | 237 |
case STRING_ST: |
238 |
+ case RE_ST: |
|
238 | 239 |
/* 1: compare with ip2str*/ |
239 | 240 |
ret=comp_str(inet_ntoa(*(struct in_addr*)&a), param, op, |
240 | 241 |
subtype); |
0 | 2 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,7 @@ |
1 |
+# config file for centauri |
|
2 |
+ |
|
3 |
+route{ |
|
4 |
+ (src_ip==192.168.46.0/24 or src_ip~="^dorian") forward("fox.iptel.org"); |
|
5 |
+ src_ip=="centauri.fokus.gmd.de" log("Possible loop, dropping\n"); drop |
|
6 |
+ src_ip==0.0.0.0/0 log("forwarding denied\n"); drop |
|
7 |
+} |
0 | 6 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+# test config file |
|
2 |
+ |
|
3 |
+/* C style comment */ |
|
4 |
+ |
|
5 |
+/* |
|
6 |
+ * same thing but on multiple lines |
|
7 |
+ */ |
|
8 |
+ |
|
9 |
+/* |
|
10 |
+ /* Nested |
|
11 |
+ comment */ |
|
12 |
+*/ |
|
13 |
+ |
|
14 |
+ |
|
15 |
+debug=1 |
|
16 |
+dns=true #comment on the same line |
|
17 |
+ |
|
18 |
+route{ |
|
19 |
+ (method==invite and src_ip==1.2.3.4 or (src_ip==4.3.2.1 and src_ip==11.12.13.14/24) ) log("test log\n"); forward("ape"); |
|
20 |
+ ( uri~="test\n" & ! src_ip~="dorian") forward(dorian.fokus.gmd.de); |
|
21 |
+ |
|
22 |
+ (src_ip==192.168.0.0/255.255.0.0 or dst_ip==127.0.0.1 and uri~="s$") \ |
|
23 |
+ error("440","not forwarding"); log(2,"droping..."); drop; |
|
24 |
+ |
|
25 |
+ src_ip==127.0.0.1 route(3); drop; |
|
26 |
+} |
|
27 |
+ |
|
28 |
+fork=no |
|
29 |
+ |
|
30 |
+route[3]{ |
|
31 |
+ (src_ip==0.0.0.0/0) exec('/bin/ls >/tmp/x'); send(4.3.2.1,8000); /* catch all */ |
|
32 |
+} |
|
33 |
+ |
|
34 |
+/* eof */ |