@@ -185,6 +185,7 @@ struct listen_param {
185
185
char *auto_scaling_profile;
186
186
} p_tmp;
187
187
static void fill_socket_id (struct listen_param *param, struct socket_id *s);
188
+ static void fill_alias_socket (struct listen_param *param, struct socket_id *s);
188
189
189
190
union route_name_var {
190
191
int iname;
@@ -466,6 +467,7 @@ extern int cfg_parse_only_routes;
466
467
%token COLON
467
468
%token ANY
468
469
%token ANYCAST
470
+ %token SUBDOMAIN
469
471
%token FRAG
470
472
%token REUSE_PORT
471
473
%token SCRIPTVARERR
@@ -491,6 +493,7 @@ extern int cfg_parse_only_routes;
491
493
%type <sockid> socket_def
492
494
%type <sockid> id_lst
493
495
%type <sockid> alias_def
496
+ %type <sockid> any_alias
494
497
%type <sockid> listen_id_def
495
498
%type <sockid> phostport phostportrange
496
499
%type <intval> proto port any_proto
@@ -694,7 +697,7 @@ phostportrange: proto COLON MULT { IFOR();
694
697
}
695
698
;
696
699
697
- alias_def : listen_id { IFOR();
700
+ any_alias : listen_id { IFOR();
698
701
$$ =mk_listen_id($1 , PROTO_NONE, 0 ); }
699
702
| ANY COLON listen_id { IFOR();
700
703
$$ =mk_listen_id($3 , PROTO_NONE, 0 ); }
@@ -707,6 +710,23 @@ alias_def: listen_id { IFOR();
707
710
| phostport
708
711
;
709
712
713
+ id_lst_param : SUBDOMAIN { IFOR();
714
+ p_tmp.flags |= SI_IS_SUBDOMAIN_ALIAS;
715
+ }
716
+ ;
717
+
718
+ id_lst_params : id_lst_param
719
+ | id_lst_param id_lst_params
720
+ ;
721
+
722
+ alias_def : any_alias { $$ =$1 ; }
723
+ | any_alias { IFOR();
724
+ memset (&p_tmp, 0 , sizeof (p_tmp));
725
+ } id_lst_params { IFOR();
726
+ $$ =$1 ; fill_alias_socket(&p_tmp, $$ );
727
+ }
728
+ ;
729
+
710
730
id_lst : alias_def { IFOR(); $$ =$1 ; }
711
731
| alias_def id_lst { IFOR(); $$ =$1 ; $$ ->next=$2 ; }
712
732
;
@@ -730,6 +750,9 @@ socket_def_param: ANYCAST { IFOR();
730
750
| REUSE_PORT { IFOR();
731
751
p_tmp.flags |= SI_REUSEPORT;
732
752
}
753
+ | SUBDOMAIN { IFOR();
754
+ p_tmp.flags |= SI_IS_SUBDOMAIN_ALIAS;
755
+ }
733
756
| USE_WORKERS NUMBER { IFOR();
734
757
p_tmp.workers=$2 ;
735
758
}
@@ -1484,7 +1507,7 @@ assign_stm: LOGLEVEL EQUAL snumber { IFOR();
1484
1507
| ALIAS EQUAL id_lst { IFOR();
1485
1508
for (lst_tmp=$3 ; lst_tmp; lst_tmp=lst_tmp->next)
1486
1509
add_alias (lst_tmp->name, strlen(lst_tmp->name),
1487
- lst_tmp->port, lst_tmp->proto);
1510
+ lst_tmp->port, lst_tmp->proto, lst_tmp->flags );
1488
1511
}
1489
1512
| ALIAS EQUAL error { yyerror (" hostname expected (use quotes"
1490
1513
" if the hostname includes config keywords)" ); }
@@ -2771,6 +2794,10 @@ static void fill_socket_id(struct listen_param *param, struct socket_id *s)
2771
2794
}
2772
2795
}
2773
2796
2797
+ static void fill_alias_socket(struct listen_param *param, struct socket_id *s) {
2798
+ s->flags |= param->flags;
2799
+ }
2800
+
2774
2801
static struct multi_str *new_string(char *s)
2775
2802
{
2776
2803
struct multi_str *ms = pkg_malloc(sizeof(struct multi_str));
0 commit comments