Added the "Bind" directive.

This commit is contained in:
Robert James Kaes 2002-04-22 19:33:01 +00:00
parent aa68eb8540
commit 60f61c8f0c
2 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: grammar.y,v 1.8 2002-04-12 16:59:37 rjkaes Exp $ /* $Id: grammar.y,v 1.9 2002-04-22 19:33:01 rjkaes Exp $
* *
* This is the grammar for tinyproxy's configuration file. It needs to be * This is the grammar for tinyproxy's configuration file. It needs to be
* in sync with scanner.l. If you know more about yacc and lex than I do * in sync with scanner.l. If you know more about yacc and lex than I do
@ -47,7 +47,7 @@ int yylex(void);
%token KW_USER KW_GROUP %token KW_USER KW_GROUP
%token KW_ANONYMOUS KW_FILTER KW_XTINYPROXY %token KW_ANONYMOUS KW_FILTER KW_XTINYPROXY
%token KW_TUNNEL KW_UPSTREAM %token KW_TUNNEL KW_UPSTREAM
%token KW_CONNECTPORT %token KW_CONNECTPORT KW_BIND
%token KW_ALLOW KW_DENY %token KW_ALLOW KW_DENY
/* yes/no switches */ /* yes/no switches */
@ -143,11 +143,20 @@ statement
log_message(LOG_WARNING, "Upstream proxy support was not compiled in."); log_message(LOG_WARNING, "Upstream proxy support was not compiled in.");
#endif #endif
} }
| KW_LISTEN NUMERIC_ADDRESS { config.ipAddr = $2; } | KW_LISTEN NUMERIC_ADDRESS
{
log_message(LOG_INFO, "Establishing listening socket on IP %s", $2);
config.ipAddr = $2;
}
| KW_ALLOW network_address { insert_acl($2, ACL_ALLOW); } | KW_ALLOW network_address { insert_acl($2, ACL_ALLOW); }
| KW_DENY network_address { insert_acl($2, ACL_DENY); } | KW_DENY network_address { insert_acl($2, ACL_DENY); }
| KW_LOGLEVEL loglevels { set_log_level($2); } | KW_LOGLEVEL loglevels { set_log_level($2); }
| KW_CONNECTPORT NUMBER { add_connect_port_allowed($2); } | KW_CONNECTPORT NUMBER { add_connect_port_allowed($2); }
| KW_BIND NUMERIC_ADDRESS
{
log_message(LOG_INFO, "Binding outgoing connections to %s", $2);
bind_address = $2;
}
; ;
loglevels loglevels

View File

@ -1,4 +1,4 @@
/* $Id: scanner.l,v 1.9 2002-04-12 16:59:37 rjkaes Exp $ /* $Id: scanner.l,v 1.10 2002-04-22 19:33:01 rjkaes Exp $
* *
* This builds the scanner for the tinyproxy configuration file. This * This builds the scanner for the tinyproxy configuration file. This
* file needs to stay in sync with grammar.y. If someone knows lex and yacc * file needs to stay in sync with grammar.y. If someone knows lex and yacc
@ -50,6 +50,7 @@ static struct keyword keywords[] = {
{ "allow", KW_ALLOW }, { "allow", KW_ALLOW },
{ "deny", KW_DENY }, { "deny", KW_DENY },
{ "connectport", KW_CONNECTPORT }, { "connectport", KW_CONNECTPORT },
{ "bind", KW_BIND },
/* loglevel and the settings */ /* loglevel and the settings */
{ "loglevel", KW_LOGLEVEL }, { "loglevel", KW_LOGLEVEL },