Browse code

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.

Andrei Pelinescu-Onciul authored on 10/08/2010 09:15:06
Showing 2 changed files
... ...
@@ -215,6 +215,7 @@ UDP_MTU		"udp_mtu"
215 215
 UDP_MTU_TRY_PROTO	"udp_mtu_try_proto"
216 216
 UDP4_RAW		"udp4_raw"
217 217
 UDP4_RAW_MTU	"udp4_raw_mtu"
218
+UDP4_RAW_TTL	"udp4_raw_ttl"
218 219
 SETFLAG		setflag
219 220
 RESETFLAG	resetflag
220 221
 ISFLAGSET	isflagset
... ...
@@ -611,6 +612,7 @@ SUBST       subst
611 611
 									return UDP_MTU_TRY_PROTO; }
612 612
 <INITIAL>{UDP4_RAW}	{ count(); yylval.strval=yytext; return UDP4_RAW; }
613 613
 <INITIAL>{UDP4_RAW_MTU}	{ count(); yylval.strval=yytext; return UDP4_RAW_MTU; }
614
+<INITIAL>{UDP4_RAW_TTL}	{ count(); yylval.strval=yytext; return UDP4_RAW_TTL; }
614 615
 <INITIAL>{IF}	{ count(); yylval.strval=yytext; return IF; }
615 616
 <INITIAL>{ELSE}	{ count(); yylval.strval=yytext; return ELSE; }
616 617
 
... ...
@@ -331,6 +331,7 @@ extern char *finame;
331 331
 %token UDP_MTU_TRY_PROTO
332 332
 %token UDP4_RAW
333 333
 %token UDP4_RAW_MTU
334
+%token UDP4_RAW_TTL
334 335
 %token IF
335 336
 %token ELSE
336 337
 %token SET_ADV_ADDRESS
... ...
@@ -1593,6 +1594,10 @@ assign_stm:
1593 1593
 		IF_RAW_SOCKS(default_core_cfg.udp4_raw_mtu=$3);
1594 1594
 	}
1595 1595
 	| UDP4_RAW_MTU EQUAL error { yyerror("number expected"); }
1596
+	| UDP4_RAW_TTL EQUAL NUMBER {
1597
+		IF_RAW_SOCKS(default_core_cfg.udp4_raw_ttl=$3);
1598
+	}
1599
+	| UDP4_RAW_TTL EQUAL error { yyerror("number expected"); }
1596 1600
 	| cfg_var
1597 1601
 	| error EQUAL { yyerror("unknown config variable"); }
1598 1602
 	;