Mercurial > hg > freeDiameter
comparison libfdcore/fdd.y @ 1396:188c82b6690b
Add ProcessingPeersPattern and ProcessingPeersMinimum parameters.
If this is configured, the process will accept all connections from
peers matching ProcessingPeersPattern, but will NOT accept connections
from other peers until ProcessingPeersMinimum peers of the first
type are connected.
This allows relays to only go online if there are enough worker
peers connected behind them.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Fri, 15 Nov 2019 11:38:30 +0100 |
parents | afe0ecdb0692 |
children | 239ba25870d8 |
comparison
equal
deleted
inserted
replaced
1395:603a72c4bf6c | 1396:188c82b6690b |
---|---|
107 %token NOTLS | 107 %token NOTLS |
108 %token SCTPSTREAMS | 108 %token SCTPSTREAMS |
109 %token APPSERVTHREADS | 109 %token APPSERVTHREADS |
110 %token LISTENON | 110 %token LISTENON |
111 %token THRPERSRV | 111 %token THRPERSRV |
112 %token PROCESSINGPEERSPATTERN | |
113 %token PROCESSINGPEERSMINIMUM | |
112 %token TCTIMER | 114 %token TCTIMER |
113 %token TWTIMER | 115 %token TWTIMER |
114 %token NORELAY | 116 %token NORELAY |
115 %token LOADEXT | 117 %token LOADEXT |
116 %token CONNPEER | 118 %token CONNPEER |
139 | conffile secport | 141 | conffile secport |
140 | conffile sec3436 | 142 | conffile sec3436 |
141 | conffile sctpstreams | 143 | conffile sctpstreams |
142 | conffile listenon | 144 | conffile listenon |
143 | conffile thrpersrv | 145 | conffile thrpersrv |
146 | conffile processingpeerspattern | |
147 | conffile processingpeersminimum | |
144 | conffile norelay | 148 | conffile norelay |
145 | conffile appservthreads | 149 | conffile appservthreads |
146 | conffile noip | 150 | conffile noip |
147 | conffile noip6 | 151 | conffile noip6 |
148 | conffile notcp | 152 | conffile notcp |
247 thrpersrv: THRPERSRV '=' INTEGER ';' | 251 thrpersrv: THRPERSRV '=' INTEGER ';' |
248 { | 252 { |
249 CHECK_PARAMS_DO( ($3 > 0), | 253 CHECK_PARAMS_DO( ($3 > 0), |
250 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | 254 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); |
251 conf->cnf_thr_srv = $3; | 255 conf->cnf_thr_srv = $3; |
256 } | |
257 ; | |
258 | |
259 processingpeerspattern: PROCESSINGPEERSPATTERN '=' QSTRING ';' | |
260 { | |
261 char *pattern = $3; | |
262 int err; | |
263 CHECK_FCT_DO( err=regcomp(&conf->cnf_processing_peers_pattern_regex, pattern, REG_EXTENDED | REG_NOSUB), | |
264 { | |
265 char * buf; | |
266 size_t bl; | |
267 | |
268 /* Error while compiling the regex */ | |
269 TRACE_DEBUG(INFO, "error while compiling the regular expression '%s':", pattern); | |
270 | |
271 /* Get the error message size */ | |
272 bl = regerror(err, &conf->cnf_processing_peers_pattern_regex, NULL, 0); | |
273 | |
274 /* Alloc the buffer for error message */ | |
275 CHECK_MALLOC( buf = malloc(bl) ); | |
276 | |
277 /* Get the error message content */ | |
278 regerror(err, &conf->cnf_processing_peers_pattern_regex, buf, bl); | |
279 TRACE_DEBUG(INFO, "\t%s", buf); | |
280 | |
281 /* Free the buffer, return the error */ | |
282 free(buf); | |
283 | |
284 yyerror (&yylloc, conf, "Invalid regular expression in ProcessingPeersPattern"); | |
285 YYERROR; | |
286 } ); | |
287 } | |
288 ; | |
289 | |
290 processingpeersminimum: PROCESSINGPEERSMINIMUM '=' INTEGER ';' | |
291 { | |
292 CHECK_PARAMS_DO( ($3 >= 0), | |
293 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | |
294 conf->cnf_processing_peers_minimum = $3; | |
252 } | 295 } |
253 ; | 296 ; |
254 | 297 |
255 norelay: NORELAY ';' | 298 norelay: NORELAY ';' |
256 { | 299 { |