Module: sip-router Branch: andrei/raw_sock Commit: 2556cd84fa12b25e9545535db9c766bf9cd3f354 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2556cd84...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Tue Aug 10 11:15:06 2010 +0200
raw sockets: ttl can be set from the config file
The ttl used for raw sockets can be set from the config file, using udp4_raw_ttl. -1 can be used for auto-detection.
---
cfg.lex | 2 ++ cfg.y | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/cfg.lex b/cfg.lex index de88891..6829724 100644 --- a/cfg.lex +++ b/cfg.lex @@ -215,6 +215,7 @@ UDP_MTU "udp_mtu" UDP_MTU_TRY_PROTO "udp_mtu_try_proto" UDP4_RAW "udp4_raw" UDP4_RAW_MTU "udp4_raw_mtu" +UDP4_RAW_TTL "udp4_raw_ttl" SETFLAG setflag RESETFLAG resetflag ISFLAGSET isflagset @@ -611,6 +612,7 @@ SUBST subst return UDP_MTU_TRY_PROTO; } <INITIAL>{UDP4_RAW} { count(); yylval.strval=yytext; return UDP4_RAW; } <INITIAL>{UDP4_RAW_MTU} { count(); yylval.strval=yytext; return UDP4_RAW_MTU; } +<INITIAL>{UDP4_RAW_TTL} { count(); yylval.strval=yytext; return UDP4_RAW_TTL; } <INITIAL>{IF} { count(); yylval.strval=yytext; return IF; } <INITIAL>{ELSE} { count(); yylval.strval=yytext; return ELSE; }
diff --git a/cfg.y b/cfg.y index 3c52e69..78b0102 100644 --- a/cfg.y +++ b/cfg.y @@ -331,6 +331,7 @@ extern char *finame; %token UDP_MTU_TRY_PROTO %token UDP4_RAW %token UDP4_RAW_MTU +%token UDP4_RAW_TTL %token IF %token ELSE %token SET_ADV_ADDRESS @@ -1593,6 +1594,10 @@ assign_stm: IF_RAW_SOCKS(default_core_cfg.udp4_raw_mtu=$3); } | UDP4_RAW_MTU EQUAL error { yyerror("number expected"); } + | UDP4_RAW_TTL EQUAL NUMBER { + IF_RAW_SOCKS(default_core_cfg.udp4_raw_ttl=$3); + } + | UDP4_RAW_TTL EQUAL error { yyerror("number expected"); } | cfg_var | error EQUAL { yyerror("unknown config variable"); } ;