Browse code

core: cfg script support for blacklist ignore masks

The blacklist ignore mask can now be set from the script (not only
at runtime):
dst_blacklist_udp_imask
dst_blacklist_tcp_imask
dst_blacklist_tls_imask
dst_blacklist_sctp_imask

E.g. dst_blacklist_udp_imask=16

Possible values:
0 -disabled
2 - send error
4 - connect error
8 - icmp (reserverd for future use)
16 - transaction timeout
32 - administratively prohibited (manually set)

Andrei Pelinescu-Onciul authored on 17/02/2010 08:58:21
Showing 2 changed files
... ...
@@ -80,6 +80,7 @@
80 80
  *  2009-03-10  added SET_USERPHONE action (Miklos)
81 81
  *  2009-04-24  add strlen, strempty and defined operators (andrei)
82 82
  *  2009-03-07  RETCODE, it's now  a core pvar (andrei)
83
+ *  2010-02-17 added DST_BLST_{UDP,TCP,TLS,SCTP}_IMASK (andrei)
83 84
 */
84 85
 
85 86
 
... ...
@@ -343,6 +344,10 @@ USE_DST_BLST		use_dst_blacklist
343 343
 DST_BLST_MEM		dst_blacklist_mem
344 344
 DST_BLST_TTL		dst_blacklist_expire|dst_blacklist_ttl
345 345
 DST_BLST_GC_INT		dst_blacklist_gc_interval
346
+DST_BLST_UDP_IMASK	dst_blacklist_udp_imask
347
+DST_BLST_TCP_IMASK	dst_blacklist_tcp_imask
348
+DST_BLST_TLS_IMASK	dst_blacklist_tls_imask
349
+DST_BLST_SCTP_IMASK	dst_blacklist_sctp_imask
346 350
 
347 351
 
348 352
 PORT	port
... ...
@@ -680,6 +685,14 @@ EAT_ABLE	[\ \t\b\r]
680 680
 								return DST_BLST_TTL; }
681 681
 <INITIAL>{DST_BLST_GC_INT}	{ count(); yylval.strval=yytext;
682 682
 								return DST_BLST_GC_INT; }
683
+<INITIAL>{DST_BLST_UDP_IMASK}	{ count(); yylval.strval=yytext;
684
+								return DST_BLST_UDP_IMASK; }
685
+<INITIAL>{DST_BLST_TCP_IMASK}	{ count(); yylval.strval=yytext;
686
+								return DST_BLST_TCP_IMASK; }
687
+<INITIAL>{DST_BLST_TLS_IMASK}	{ count(); yylval.strval=yytext;
688
+								return DST_BLST_TLS_IMASK; }
689
+<INITIAL>{DST_BLST_SCTP_IMASK}	{ count(); yylval.strval=yytext;
690
+								return DST_BLST_SCTP_IMASK; }
683 691
 <INITIAL>{PORT}	{ count(); yylval.strval=yytext; return PORT; }
684 692
 <INITIAL>{STAT}	{ count(); yylval.strval=yytext; return STAT; }
685 693
 <INITIAL>{MAXBUFFER}	{ count(); yylval.strval=yytext; return MAXBUFFER; }
... ...
@@ -96,6 +96,7 @@
96 96
  * 2009-01-26  case/switch() support (andrei)
97 97
  * 2009-03-10  added SET_USERPHONE action (Miklos)
98 98
  * 2009-05-04  switched if to rval_expr (andrei)
99
+ * 2010-02-17  added blacklist imask (DST_BLST_*_IMASK) support (andrei)
99 100
 */
100 101
 
101 102
 %{
... ...
@@ -398,6 +399,10 @@ extern char *finame;
398 398
 %token DST_BLST_MEM
399 399
 %token DST_BLST_TTL
400 400
 %token DST_BLST_GC_INT
401
+%token DST_BLST_UDP_IMASK
402
+%token DST_BLST_TCP_IMASK
403
+%token DST_BLST_TLS_IMASK
404
+%token DST_BLST_SCTP_IMASK
401 405
 
402 406
 %token PORT
403 407
 %token STAT
... ...
@@ -834,14 +839,36 @@ assign_stm:
834 834
 	| DNS_CACHE_DEL_NONEXP error { yyerror("boolean value expected"); }
835 835
 	| DST_BLST_INIT EQUAL NUMBER   { IF_DST_BLACKLIST(dst_blacklist_init=$3); }
836 836
 	| DST_BLST_INIT error { yyerror("boolean value expected"); }
837
-	| USE_DST_BLST EQUAL NUMBER   { IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3); }
837
+	| USE_DST_BLST EQUAL NUMBER {
838
+		IF_DST_BLACKLIST(default_core_cfg.use_dst_blacklist=$3);
839
+	}
838 840
 	| USE_DST_BLST error { yyerror("boolean value expected"); }
839
-	| DST_BLST_MEM EQUAL NUMBER   { IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3); }
841
+	| DST_BLST_MEM EQUAL NUMBER {
842
+		IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3); 
843
+	}
840 844
 	| DST_BLST_MEM error { yyerror("boolean value expected"); }
841
-	| DST_BLST_TTL EQUAL NUMBER   { IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3); }
845
+	| DST_BLST_TTL EQUAL NUMBER {
846
+		IF_DST_BLACKLIST(default_core_cfg.blst_timeout=$3);
847
+	}
842 848
 	| DST_BLST_TTL error { yyerror("boolean value expected"); }
843 849
 	| DST_BLST_GC_INT EQUAL NUMBER { IF_DST_BLACKLIST(blst_timer_interval=$3);}
844 850
 	| DST_BLST_GC_INT error { yyerror("boolean value expected"); }
851
+	| DST_BLST_UDP_IMASK EQUAL NUMBER {
852
+		IF_DST_BLACKLIST(default_core_cfg.blst_udp_imask=$3);
853
+	}
854
+	| DST_BLST_UDP_IMASK error { yyerror("number(flags) expected"); }
855
+	| DST_BLST_TCP_IMASK EQUAL NUMBER {
856
+		IF_DST_BLACKLIST(default_core_cfg.blst_tcp_imask=$3);
857
+	}
858
+	| DST_BLST_TCP_IMASK error { yyerror("number(flags) expected"); }
859
+	| DST_BLST_TLS_IMASK EQUAL NUMBER {
860
+		IF_DST_BLACKLIST(default_core_cfg.blst_tls_imask=$3);
861
+	}
862
+	| DST_BLST_TLS_IMASK error { yyerror("number(flags) expected"); }
863
+	| DST_BLST_SCTP_IMASK EQUAL NUMBER {
864
+		IF_DST_BLACKLIST(default_core_cfg.blst_sctp_imask=$3);
865
+	}
866
+	| DST_BLST_SCTP_IMASK error { yyerror("number(flags) expected"); }
845 867
 	| PORT EQUAL NUMBER   { port_no=$3; }
846 868
 	| STAT EQUAL STRING {
847 869
 		#ifdef STATS