... | ... |
@@ -81,6 +81,7 @@ LISTEN listen |
81 | 81 |
DNS dns |
82 | 82 |
REV_DNS rev_dns |
83 | 83 |
PORT port |
84 |
+MAXBUFFER maxbuffer |
|
84 | 85 |
CHILDREN children |
85 | 86 |
CHECK_VIA check_via |
86 | 87 |
|
... | ... |
@@ -153,6 +154,7 @@ EAT_ABLE [\ \t\b\r] |
153 | 154 |
<INITIAL>{DNS} { count(); yylval.strval=yytext; return DNS; } |
154 | 155 |
<INITIAL>{REV_DNS} { count(); yylval.strval=yytext; return REV_DNS; } |
155 | 156 |
<INITIAL>{PORT} { count(); yylval.strval=yytext; return PORT; } |
157 |
+<INITIAL>{MAXBUFFER} { count(); yylval.strval=yytext; return MAXBUFFER; } |
|
156 | 158 |
<INITIAL>{CHILDREN} { count(); yylval.strval=yytext; return CHILDREN; } |
157 | 159 |
<INITIAL>{CHECK_VIA} { count(); yylval.strval=yytext; return CHECK_VIA; } |
158 | 160 |
<INITIAL>{LOADMODULE} { count(); yylval.strval=yytext; return LOADMODULE; } |
... | ... |
@@ -76,6 +76,7 @@ void* f_tmp; |
76 | 76 |
%token CHILDREN |
77 | 77 |
%token CHECK_VIA |
78 | 78 |
%token LOADMODULE |
79 |
+%token MAXBUFFER |
|
79 | 80 |
|
80 | 81 |
|
81 | 82 |
|
... | ... |
@@ -146,6 +147,8 @@ assign_stm: DEBUG EQUAL NUMBER { debug=$3; } |
146 | 147 |
| REV_DNS EQUAL NUMBER { received_dns|= ($3)?DO_REV_DNS:0; } |
147 | 148 |
| REV_DNS EQUAL error { yyerror("boolean value expected"); } |
148 | 149 |
| PORT EQUAL NUMBER { port_no=$3; } |
150 |
+ | MAXBUFFER EQUAL NUMBER { maxbuffer=$3; } |
|
151 |
+ | MAXBUFFER EQUAL error { yyerror("number expected"); } |
|
149 | 152 |
| PORT EQUAL error { yyerror("number expected"); } |
150 | 153 |
| CHILDREN EQUAL NUMBER { children_no=$3; } |
151 | 154 |
| CHILDREN EQUAL error { yyerror("number expected"); } |
... | ... |
@@ -72,6 +72,8 @@ Options:\n\ |
72 | 72 |
-E Log to stderr\n\ |
73 | 73 |
-V Version number\n\ |
74 | 74 |
-h This help message\n\ |
75 |
+ -b nr Maximum receive buffer size which will not be exceeded by\n\ |
|
76 |
+ auto-probing procedure even if OS allows\n\ |
|
75 | 77 |
"; |
76 | 78 |
|
77 | 79 |
|
... | ... |
@@ -96,6 +98,9 @@ void receive_stdin_loop() |
96 | 98 |
|
97 | 99 |
char* cfg_file = 0; |
98 | 100 |
unsigned short port_no = 0; /* port on which we listen */ |
101 |
+unsigned int maxbuffer = 128*1024; /* maximum buffer size we do not want to exceed |
|
102 |
+ durig the auto-probing procedure; may be |
|
103 |
+ re-configured */ |
|
99 | 104 |
int children_no = 0; /* number of children processing requests */ |
100 | 105 |
int debug = 0; |
101 | 106 |
int dont_fork = 0; |
... | ... |
@@ -260,7 +265,7 @@ int main(int argc, char** argv) |
260 | 265 |
|
261 | 266 |
/* process command line (get port no, cfg. file path etc) */ |
262 | 267 |
opterr=0; |
263 |
- while((c=getopt(argc,argv,"f:p:l:n:rRvdDEVh"))!=-1){ |
|
268 |
+ while((c=getopt(argc,argv,"f:p:b:l:n:rRvdDEVh"))!=-1){ |
|
264 | 269 |
switch(c){ |
265 | 270 |
case 'f': |
266 | 271 |
cfg_file=optarg; |
... | ... |
@@ -272,6 +277,14 @@ int main(int argc, char** argv) |
272 | 277 |
goto error; |
273 | 278 |
} |
274 | 279 |
break; |
280 |
+ |
|
281 |
+ case 'b': |
|
282 |
+ maxbuffer=strtol(optarg, &tmp, 10); |
|
283 |
+ if (tmp &&(*tmp)){ |
|
284 |
+ fprintf(stderr, "bad max buffer size number: -p %s\n", optarg); |
|
285 |
+ goto error; |
|
286 |
+ } |
|
287 |
+ break; |
|
275 | 288 |
case 'l': |
276 | 289 |
/* add a new addr. to out address list */ |
277 | 290 |
if (addresses_no < MAX_LISTEN){ |