Browse code

core: added domain and auto_domains as variants for alias and auto_aliases

Daniel-Constantin Mierla authored on 17/06/2022 07:53:01
Showing 2 changed files
... ...
@@ -308,7 +308,9 @@ ADVERTISE	advertise|ADVERTISE
308 308
 VIRTUAL		virtual
309 309
 STRNAME		name|NAME
310 310
 ALIAS		alias
311
+DOMAIN		domain
311 312
 SR_AUTO_ALIASES	auto_aliases
313
+SR_AUTO_DOMAINS auto_domains
312 314
 DNS		 dns
313 315
 REV_DNS	 rev_dns
314 316
 DNS_TRY_IPV6	dns_try_ipv6
... ...
@@ -750,8 +752,11 @@ IMPORTFILE      "import_file"
750 752
 <INITIAL>{VIRTUAL}	{ count(); yylval.strval=yytext; return VIRTUAL; }
751 753
 <INITIAL>{STRNAME}	{ count(); yylval.strval=yytext; return STRNAME; }
752 754
 <INITIAL>{ALIAS}	{ count(); yylval.strval=yytext; return ALIAS; }
755
+<INITIAL>{DOMAIN}	{ count(); yylval.strval=yytext; return DOMAIN; }
753 756
 <INITIAL>{SR_AUTO_ALIASES}	{ count(); yylval.strval=yytext;
754 757
 									return SR_AUTO_ALIASES; }
758
+<INITIAL>{SR_AUTO_DOMAINS}	{ count(); yylval.strval=yytext;
759
+									return SR_AUTO_DOMAINS; }
755 760
 <INITIAL>{DNS}	{ count(); yylval.strval=yytext; return DNS; }
756 761
 <INITIAL>{REV_DNS}	{ count(); yylval.strval=yytext; return REV_DNS; }
757 762
 <INITIAL>{DNS_TRY_IPV6}	{ count(); yylval.strval=yytext;
... ...
@@ -333,6 +333,8 @@ extern char *default_routename;
333 333
 %token STRNAME
334 334
 %token ALIAS
335 335
 %token SR_AUTO_ALIASES
336
+%token DOMAIN
337
+%token SR_AUTO_DOMAINS
336 338
 %token DNS
337 339
 %token REV_DNS
338 340
 %token DNS_TRY_IPV6
... ...
@@ -1737,8 +1739,22 @@ assign_stm:
1737 1739
 		free_socket_id_lst($3);
1738 1740
 	}
1739 1741
 	| ALIAS  EQUAL error  { yyerror("hostname expected"); }
1742
+	| DOMAIN EQUAL  id_lst {
1743
+		for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){
1744
+			add_alias(	lst_tmp->addr_lst->name,
1745
+						strlen(lst_tmp->addr_lst->name),
1746
+						lst_tmp->port, lst_tmp->proto);
1747
+			for (nl_tmp=lst_tmp->addr_lst->next; nl_tmp; nl_tmp=nl_tmp->next)
1748
+				add_alias(nl_tmp->name, strlen(nl_tmp->name),
1749
+							lst_tmp->port, lst_tmp->proto);
1750
+		}
1751
+		free_socket_id_lst($3);
1752
+	}
1753
+	| DOMAIN  EQUAL error  { yyerror("hostname expected"); }
1740 1754
 	| SR_AUTO_ALIASES EQUAL NUMBER { sr_auto_aliases=$3; }
1741 1755
 	| SR_AUTO_ALIASES EQUAL error  { yyerror("boolean value expected"); }
1756
+	| SR_AUTO_DOMAINS EQUAL NUMBER { sr_auto_aliases=$3; }
1757
+	| SR_AUTO_DOMAINS EQUAL error  { yyerror("boolean value expected"); }
1742 1758
 	| ADVERTISED_ADDRESS EQUAL listen_id {
1743 1759
 		if ($3){
1744 1760
 			default_global_address.s=$3;