|
|
|
@ -587,6 +587,7 @@ extern char *default_routename;
|
|
|
|
|
%type <intval> avpflag_oper
|
|
|
|
|
%type <intval> rve_un_op
|
|
|
|
|
%type <strval> cfg_var_id
|
|
|
|
|
%type <strval> cfg_var_idn
|
|
|
|
|
/* %type <intval> rve_op */
|
|
|
|
|
|
|
|
|
|
/*%type <route_el> rules;
|
|
|
|
@ -624,14 +625,12 @@ listen_id:
|
|
|
|
|
if ($1){
|
|
|
|
|
tmp=ip_addr2a($1);
|
|
|
|
|
if (tmp==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: bad ip "
|
|
|
|
|
"address.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: bad ip address.\n");
|
|
|
|
|
$$=0;
|
|
|
|
|
} else {
|
|
|
|
|
$$=pkg_malloc(strlen(tmp)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of "
|
|
|
|
|
"memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
strncpy($$, tmp, strlen(tmp)+1);
|
|
|
|
|
}
|
|
|
|
@ -641,8 +640,7 @@ listen_id:
|
|
|
|
|
| STRING {
|
|
|
|
|
$$=pkg_malloc(strlen($1)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of "
|
|
|
|
|
"memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
strncpy($$, $1, strlen($1)+1);
|
|
|
|
|
}
|
|
|
|
@ -651,8 +649,7 @@ listen_id:
|
|
|
|
|
if ($1){
|
|
|
|
|
$$=pkg_malloc(strlen($1)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of "
|
|
|
|
|
"memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
strncpy($$, $1, strlen($1)+1);
|
|
|
|
|
}
|
|
|
|
@ -663,7 +660,7 @@ listen_id:
|
|
|
|
|
|
|
|
|
|
listen_id_lst:
|
|
|
|
|
listen_id { $$=mk_name_lst($1, SI_IS_MHOMED); }
|
|
|
|
|
| listen_id COMMA listen_id_lst { $$=mk_name_lst($1, SI_IS_MHOMED);
|
|
|
|
|
| listen_id COMMA listen_id_lst { $$=mk_name_lst($1, SI_IS_MHOMED);
|
|
|
|
|
if ($$) $$->next=$3;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
@ -698,7 +695,7 @@ phostport:
|
|
|
|
|
| listen_id COLON port { $$=mk_listen_id($1, 0, $3); }
|
|
|
|
|
| proto COLON listen_id { $$=mk_listen_id($3, $1, 0); }
|
|
|
|
|
| proto COLON listen_id COLON port { $$=mk_listen_id($3, $1, $5);}
|
|
|
|
|
| listen_id COLON error { $$=0; yyerror(" port number expected"); }
|
|
|
|
|
| listen_id COLON error { $$=0; yyerror("port number expected"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
listen_phostport:
|
|
|
|
@ -706,7 +703,7 @@ listen_phostport:
|
|
|
|
|
| listen_id2 COLON port { $$=mk_listen_id2($1, 0, $3); }
|
|
|
|
|
| proto COLON listen_id2 { $$=mk_listen_id2($3, $1, 0); }
|
|
|
|
|
| proto COLON listen_id2 COLON port { $$=mk_listen_id2($3, $1, $5);}
|
|
|
|
|
| listen_id2 COLON error { $$=0; yyerror(" port number expected"); }
|
|
|
|
|
| listen_id2 COLON error { $$=0; yyerror("port number expected"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
id_lst:
|
|
|
|
@ -761,8 +758,8 @@ assign_stm:
|
|
|
|
|
| FORK_DELAY EQUAL error { yyerror("number expected"); }
|
|
|
|
|
| MODINIT_DELAY EQUAL NUMBER { set_modinit_delay($3); }
|
|
|
|
|
| MODINIT_DELAY EQUAL error { yyerror("number expected"); }
|
|
|
|
|
| LOGSTDERROR EQUAL NUMBER { if (!config_check) /* if set from cmd line, don't overwrite from yyparse()*/
|
|
|
|
|
if(log_stderr == 0) log_stderr=$3;
|
|
|
|
|
| LOGSTDERROR EQUAL NUMBER { if (!config_check) /* if set from cmd line, don't overwrite from yyparse()*/
|
|
|
|
|
if(log_stderr == 0) log_stderr=$3;
|
|
|
|
|
}
|
|
|
|
|
| LOGSTDERROR EQUAL error { yyerror("boolean value expected"); }
|
|
|
|
|
| LOGFACILITY EQUAL ID {
|
|
|
|
@ -798,7 +795,7 @@ assign_stm:
|
|
|
|
|
| DNS_TCP_PREF error { yyerror("number expected"); }
|
|
|
|
|
| DNS_TLS_PREF EQUAL intno { IF_NAPTR(default_core_cfg.dns_tls_pref=$3);}
|
|
|
|
|
| DNS_TLS_PREF error { yyerror("number expected"); }
|
|
|
|
|
| DNS_SCTP_PREF EQUAL intno {
|
|
|
|
|
| DNS_SCTP_PREF EQUAL intno {
|
|
|
|
|
IF_NAPTR(default_core_cfg.dns_sctp_pref=$3); }
|
|
|
|
|
| DNS_SCTP_PREF error { yyerror("number expected"); }
|
|
|
|
|
| DNS_RETR_TIME EQUAL NUMBER { default_core_cfg.dns_retr_time=$3; }
|
|
|
|
@ -844,7 +841,7 @@ assign_stm:
|
|
|
|
|
}
|
|
|
|
|
| USE_DST_BLST error { yyerror("boolean value expected"); }
|
|
|
|
|
| DST_BLST_MEM EQUAL NUMBER {
|
|
|
|
|
IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3);
|
|
|
|
|
IF_DST_BLACKLIST(default_core_cfg.blst_max_mem=$3);
|
|
|
|
|
}
|
|
|
|
|
| DST_BLST_MEM error { yyerror("boolean value expected"); }
|
|
|
|
|
| DST_BLST_TTL EQUAL NUMBER {
|
|
|
|
@ -917,7 +914,7 @@ assign_stm:
|
|
|
|
|
yyerror("user must be before any modparam or the"
|
|
|
|
|
" route blocks");
|
|
|
|
|
else if (user==0)
|
|
|
|
|
user=$3;
|
|
|
|
|
user=$3;
|
|
|
|
|
}
|
|
|
|
|
| USER EQUAL ID {
|
|
|
|
|
if (shm_initialized())
|
|
|
|
@ -1366,8 +1363,7 @@ assign_stm:
|
|
|
|
|
lst_tmp->addr_lst->next,
|
|
|
|
|
lst_tmp->port, lst_tmp->proto,
|
|
|
|
|
lst_tmp->flags)!=0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: failed to add listen"
|
|
|
|
|
" address\n");
|
|
|
|
|
LM_CRIT("cfg. parser: failed to add listen address\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1380,8 +1376,7 @@ assign_stm:
|
|
|
|
|
lst_tmp->port, lst_tmp->proto,
|
|
|
|
|
$5, $7,
|
|
|
|
|
lst_tmp->flags)!=0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: failed to add listen"
|
|
|
|
|
" address\n");
|
|
|
|
|
LM_CRIT("cfg. parser: failed to add listen address\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1400,7 +1395,7 @@ assign_stm:
|
|
|
|
|
}
|
|
|
|
|
free_socket_id_lst($3);
|
|
|
|
|
}
|
|
|
|
|
| ALIAS EQUAL error { yyerror(" hostname expected"); }
|
|
|
|
|
| ALIAS EQUAL error { yyerror("hostname expected"); }
|
|
|
|
|
| SR_AUTO_ALIASES EQUAL NUMBER { sr_auto_aliases=$3; }
|
|
|
|
|
| SR_AUTO_ALIASES EQUAL error { yyerror("boolean value expected"); }
|
|
|
|
|
| ADVERTISED_ADDRESS EQUAL listen_id {
|
|
|
|
@ -1413,7 +1408,7 @@ assign_stm:
|
|
|
|
|
| ADVERTISED_PORT EQUAL NUMBER {
|
|
|
|
|
tmp=int2str($3, &i_tmp);
|
|
|
|
|
if ((default_global_port.s=pkg_malloc(i_tmp))==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
default_global_port.len=0;
|
|
|
|
|
} else {
|
|
|
|
|
default_global_port.len=i_tmp;
|
|
|
|
@ -1549,41 +1544,50 @@ assign_stm:
|
|
|
|
|
| cfg_var
|
|
|
|
|
| error EQUAL { yyerror("unknown config variable"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
cfg_var_id: ID
|
|
|
|
|
|
|
|
|
|
cfg_var_id: ID
|
|
|
|
|
| DEFAULT { $$="default" ; } /*needed to allow default as cfg var. name*/
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cfg_var_idn: ID
|
|
|
|
|
| DEFAULT { $$="default" ; } /*needed to allow default as cfg var. name*/
|
|
|
|
|
| NUMBER {
|
|
|
|
|
yyerror("cfg var field name - use of number or reserved token not allowed: %s",
|
|
|
|
|
yy_number_str);
|
|
|
|
|
YYERROR;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
cfg_var:
|
|
|
|
|
cfg_var_id DOT cfg_var_id EQUAL NUMBER {
|
|
|
|
|
cfg_var_id DOT cfg_var_idn EQUAL NUMBER {
|
|
|
|
|
if (cfg_declare_int($1, $3, $5, 0, 0, NULL)) {
|
|
|
|
|
yyerror("variable cannot be declared");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id DOT cfg_var_id EQUAL STRING {
|
|
|
|
|
| cfg_var_id DOT cfg_var_idn EQUAL STRING {
|
|
|
|
|
if (cfg_declare_str($1, $3, $5, NULL)) {
|
|
|
|
|
yyerror("variable cannot be declared");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id DOT cfg_var_id EQUAL NUMBER CFG_DESCRIPTION STRING {
|
|
|
|
|
| cfg_var_id DOT cfg_var_idn EQUAL NUMBER CFG_DESCRIPTION STRING {
|
|
|
|
|
if (cfg_declare_int($1, $3, $5, 0, 0, $7)) {
|
|
|
|
|
yyerror("variable cannot be declared");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id DOT cfg_var_id EQUAL STRING CFG_DESCRIPTION STRING {
|
|
|
|
|
| cfg_var_id DOT cfg_var_idn EQUAL STRING CFG_DESCRIPTION STRING {
|
|
|
|
|
if (cfg_declare_str($1, $3, $5, $7)) {
|
|
|
|
|
yyerror("variable cannot be declared");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id DOT cfg_var_id EQUAL error {
|
|
|
|
|
yyerror("number or string expected");
|
|
|
|
|
| cfg_var_id DOT cfg_var_idn EQUAL error {
|
|
|
|
|
yyerror("number or string expected");
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_id EQUAL NUMBER {
|
|
|
|
|
| cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_idn EQUAL NUMBER {
|
|
|
|
|
if (cfg_ginst_var_int($1, $3, $6, $8)) {
|
|
|
|
|
yyerror("variable cannot be added to the group instance");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_id EQUAL STRING {
|
|
|
|
|
| cfg_var_id LBRACK NUMBER RBRACK DOT cfg_var_idn EQUAL STRING {
|
|
|
|
|
if (cfg_ginst_var_string($1, $3, $6, $8)) {
|
|
|
|
|
yyerror("variable cannot be added to the group instance");
|
|
|
|
|
}
|
|
|
|
@ -1592,7 +1596,7 @@ cfg_var:
|
|
|
|
|
|
|
|
|
|
module_stm:
|
|
|
|
|
LOADMODULE STRING {
|
|
|
|
|
DBG("loading module %s\n", $2);
|
|
|
|
|
LM_DBG("loading module %s\n", $2);
|
|
|
|
|
if (load_module($2)!=0) {
|
|
|
|
|
yyerror("failed to load module");
|
|
|
|
|
}
|
|
|
|
@ -1600,22 +1604,22 @@ module_stm:
|
|
|
|
|
| LOADMODULE error { yyerror("string expected"); }
|
|
|
|
|
| LOADPATH STRING {
|
|
|
|
|
if(mods_dir_cmd==0) {
|
|
|
|
|
DBG("loading modules under %s\n", $2);
|
|
|
|
|
LM_DBG("loading modules under %s\n", $2);
|
|
|
|
|
printf("loading modules under config path: %s\n", $2);
|
|
|
|
|
mods_dir = $2;
|
|
|
|
|
} else {
|
|
|
|
|
DBG("ignoring mod path given in config: %s\n", $2);
|
|
|
|
|
LM_DBG("ignoring mod path given in config: %s\n", $2);
|
|
|
|
|
printf("loading modules under command line path: %s\n", mods_dir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| LOADPATH error { yyerror("string expected"); }
|
|
|
|
|
| LOADPATH EQUAL STRING {
|
|
|
|
|
if(mods_dir_cmd==0) {
|
|
|
|
|
DBG("loading modules under %s\n", $3);
|
|
|
|
|
LM_DBG("loading modules under %s\n", $3);
|
|
|
|
|
printf("loading modules under config path: %s\n", $3);
|
|
|
|
|
mods_dir = $3;
|
|
|
|
|
} else {
|
|
|
|
|
DBG("ignoring mod path given in config: %s\n", $3);
|
|
|
|
|
LM_DBG("ignoring mod path given in config: %s\n", $3);
|
|
|
|
|
printf("loading modules under command line path: %s\n", mods_dir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1652,7 +1656,7 @@ ipv4:
|
|
|
|
|
NUMBER DOT NUMBER DOT NUMBER DOT NUMBER {
|
|
|
|
|
$$=pkg_malloc(sizeof(struct ip_addr));
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
memset($$, 0, sizeof(struct ip_addr));
|
|
|
|
|
$$->af=AF_INET;
|
|
|
|
@ -1681,7 +1685,7 @@ ipv6addr:
|
|
|
|
|
IPV6ADDR {
|
|
|
|
|
$$=pkg_malloc(sizeof(struct ip_addr));
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
memset($$, 0, sizeof(struct ip_addr));
|
|
|
|
|
$$->af=AF_INET6;
|
|
|
|
@ -1798,7 +1802,7 @@ onreply_route_stm:
|
|
|
|
|
}
|
|
|
|
|
| ROUTE_ONREPLY error { yyerror("invalid onreply_route statement"); }
|
|
|
|
|
| ROUTE_REPLY error { yyerror("invalid onreply_route statement"); }
|
|
|
|
|
| ROUTE_ONREPLY LBRACK route_name RBRACK
|
|
|
|
|
| ROUTE_ONREPLY LBRACK route_name RBRACK
|
|
|
|
|
{rt=(*$3=='0' && $3[1]==0)?CORE_ONREPLY_ROUTE:TM_ONREPLY_ROUTE;}
|
|
|
|
|
LBRACE actions RBRACE {
|
|
|
|
|
#ifdef SHM_MEM
|
|
|
|
@ -2014,7 +2018,7 @@ exp_elem:
|
|
|
|
|
| METHOD strop ID %prec EQUAL_T
|
|
|
|
|
{$$ = mk_elem($2, METHOD_O, 0, STRING_ST,$3); }
|
|
|
|
|
| METHOD strop error { $$=0; yyerror("string expected"); }
|
|
|
|
|
| METHOD error
|
|
|
|
|
| METHOD error
|
|
|
|
|
{ $$=0; yyerror("invalid operator,== , !=, or =~ expected"); }
|
|
|
|
|
| uri_type strop rval_expr %prec EQUAL_T
|
|
|
|
|
{$$ = mk_elem($2, $1, 0, RVE_ST, $3); }
|
|
|
|
@ -2070,7 +2074,7 @@ exp_elem:
|
|
|
|
|
ip_tmp=str2ip6(&s_tmp);
|
|
|
|
|
pkg_free(s_tmp.s);
|
|
|
|
|
if (ip_tmp) {
|
|
|
|
|
$$=mk_elem($2, $1, 0, NET_ST,
|
|
|
|
|
$$=mk_elem($2, $1, 0, NET_ST,
|
|
|
|
|
mk_new_net_bitlen(ip_tmp, ip_tmp->len*8) );
|
|
|
|
|
} else {
|
|
|
|
|
$$=mk_elem($2, $1, 0, RVE_ST, $3);
|
|
|
|
@ -2087,13 +2091,13 @@ exp_elem:
|
|
|
|
|
{ $$=0; yyerror( "ip address or hostname expected" ); }
|
|
|
|
|
| eip_op error
|
|
|
|
|
{ $$=0; yyerror("invalid operator, ==, != or =~ expected");}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| MYSELF equalop uri_type %prec EQUAL_T
|
|
|
|
|
{ $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
|
|
|
|
|
| MYSELF equalop eip_op %prec EQUAL_T
|
|
|
|
|
{ $$=mk_elem($2, $3, 0, MYSELF_ST, 0); }
|
|
|
|
|
| MYSELF equalop error %prec EQUAL_T
|
|
|
|
|
{ $$=0; yyerror(" URI, SRCIP or DSTIP expected"); }
|
|
|
|
|
{ $$=0; yyerror("URI, SRCIP or DSTIP expected"); }
|
|
|
|
|
| MYSELF error { $$=0; yyerror ("invalid operator, == or != expected"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
@ -2120,7 +2124,7 @@ host:
|
|
|
|
|
if ($1){
|
|
|
|
|
$$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: memory allocation"
|
|
|
|
|
LM_CRIT("cfg. parser: memory allocation"
|
|
|
|
|
" failure while parsing host\n");
|
|
|
|
|
} else {
|
|
|
|
|
memcpy($$, $1, strlen($1));
|
|
|
|
@ -2136,7 +2140,7 @@ host:
|
|
|
|
|
if ($1){
|
|
|
|
|
$$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: memory allocation"
|
|
|
|
|
LM_CRIT("cfg. parser: memory allocation"
|
|
|
|
|
" failure while parsing host\n");
|
|
|
|
|
} else {
|
|
|
|
|
memcpy($$, $1, strlen($1));
|
|
|
|
@ -2168,7 +2172,7 @@ host_or_if:
|
|
|
|
|
if ($1){
|
|
|
|
|
$$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: memory allocation"
|
|
|
|
|
LM_CRIT("cfg. parser: memory allocation"
|
|
|
|
|
" failure while parsing host/interface name\n");
|
|
|
|
|
} else {
|
|
|
|
|
memcpy($$, $1, strlen($1));
|
|
|
|
@ -2184,7 +2188,7 @@ host_or_if:
|
|
|
|
|
if ($1){
|
|
|
|
|
$$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1);
|
|
|
|
|
if ($$==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: memory allocation"
|
|
|
|
|
LM_CRIT("cfg. parser: memory allocation"
|
|
|
|
|
" failure while parsing host/interface name\n");
|
|
|
|
|
} else {
|
|
|
|
|
memcpy($$, $1, strlen($1));
|
|
|
|
@ -2274,7 +2278,7 @@ if_cmd:
|
|
|
|
|
}else
|
|
|
|
|
YYERROR;
|
|
|
|
|
}
|
|
|
|
|
| IF rval_expr stm ELSE stm {
|
|
|
|
|
| IF rval_expr stm ELSE stm {
|
|
|
|
|
if ($2 && rval_expr_int_check($2)>=0){
|
|
|
|
|
warn_ct_rve($2, "if");
|
|
|
|
|
$$=mk_action( IF_T, 3, RVE_ST, $2, ACTIONS_ST, $3, ACTIONS_ST, $5);
|
|
|
|
@ -2362,7 +2366,7 @@ case_stms:
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
switch_cmd:
|
|
|
|
|
SWITCH rval_expr LBRACE case_stms RBRACE {
|
|
|
|
|
SWITCH rval_expr LBRACE case_stms RBRACE {
|
|
|
|
|
$$=0;
|
|
|
|
|
if ($2==0){
|
|
|
|
|
yyerror("bad expression in switch(...)");
|
|
|
|
@ -2404,7 +2408,7 @@ switch_cmd:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
| SWITCH error { $$=0; yyerror ("bad expression in switch(...)"); }
|
|
|
|
|
| SWITCH rval_expr LBRACE error RBRACE
|
|
|
|
|
| SWITCH rval_expr LBRACE error RBRACE
|
|
|
|
|
{$$=0; yyerror ("bad switch body"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
@ -2762,7 +2766,7 @@ rval_expr: rval { $$=$1;
|
|
|
|
|
| DEFINED error { $$=0; yyerror("bad expression"); }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
assign_action: lval assign_op rval_expr { $$=mk_action($2, 2, LVAL_ST, $1,
|
|
|
|
|
assign_action: lval assign_op rval_expr { $$=mk_action($2, 2, LVAL_ST, $1,
|
|
|
|
|
RVE_ST, $3);
|
|
|
|
|
set_cfg_pos($$);
|
|
|
|
|
}
|
|
|
|
@ -2892,7 +2896,7 @@ cmd:
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
| FORWARD_TLS error { $$=0; yyerror("missing '(' or ')' ?"); }
|
|
|
|
|
| FORWARD_TLS LPAREN error RPAREN { $$=0;
|
|
|
|
|
| FORWARD_TLS LPAREN error RPAREN { $$=0;
|
|
|
|
|
yyerror("bad forward_tls argument"); }
|
|
|
|
|
| FORWARD_SCTP LPAREN host RPAREN {
|
|
|
|
|
#ifdef USE_SCTP
|
|
|
|
@ -2938,7 +2942,7 @@ cmd:
|
|
|
|
|
}
|
|
|
|
|
| FORWARD_SCTP LPAREN ip COMMA NUMBER RPAREN {
|
|
|
|
|
#ifdef USE_SCTP
|
|
|
|
|
$$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST,
|
|
|
|
|
$$=mk_action(FORWARD_SCTP_T, 2, IP_ST, (void*)$3, NUMBER_ST,
|
|
|
|
|
(void*)$5); set_cfg_pos($$);
|
|
|
|
|
#else
|
|
|
|
|
$$=0;
|
|
|
|
@ -2971,7 +2975,7 @@ cmd:
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
| FORWARD_SCTP error { $$=0; yyerror("missing '(' or ')' ?"); }
|
|
|
|
|
| FORWARD_SCTP LPAREN error RPAREN { $$=0;
|
|
|
|
|
| FORWARD_SCTP LPAREN error RPAREN { $$=0;
|
|
|
|
|
yyerror("bad forward_sctp argument"); }
|
|
|
|
|
| LOG_TOK LPAREN STRING RPAREN {$$=mk_action(LOG_T, 2, NUMBER_ST,
|
|
|
|
|
(void*)(L_DBG+1), STRING_ST, $3);
|
|
|
|
@ -3143,7 +3147,7 @@ cmd:
|
|
|
|
|
| SET_ADV_ADDRESS LPAREN listen_id RPAREN {
|
|
|
|
|
$$=0;
|
|
|
|
|
if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
str_tmp->s=$3;
|
|
|
|
|
str_tmp->len=$3?strlen($3):0;
|
|
|
|
@ -3157,10 +3161,10 @@ cmd:
|
|
|
|
|
$$=0;
|
|
|
|
|
tmp=int2str($3, &i_tmp);
|
|
|
|
|
if ((str_tmp=pkg_malloc(sizeof(str)))==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
if ((str_tmp->s=pkg_malloc(i_tmp))==0) {
|
|
|
|
|
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
memcpy(str_tmp->s, tmp, i_tmp);
|
|
|
|
|
str_tmp->len=i_tmp;
|
|
|
|
@ -3171,7 +3175,7 @@ cmd:
|
|
|
|
|
}
|
|
|
|
|
| SET_ADV_PORT LPAREN error RPAREN { $$=0; yyerror("bad argument, string expected"); }
|
|
|
|
|
| SET_ADV_PORT error {$$=0; yyerror("missing '(' or ')' ?"); }
|
|
|
|
|
| FORCE_SEND_SOCKET LPAREN phostport RPAREN {
|
|
|
|
|
| FORCE_SEND_SOCKET LPAREN phostport RPAREN {
|
|
|
|
|
$$=mk_action(FORCE_SEND_SOCKET_T, 1, SOCKID_ST, $3);
|
|
|
|
|
set_cfg_pos($$);
|
|
|
|
|
}
|
|
|
|
@ -3224,10 +3228,10 @@ cmd:
|
|
|
|
|
if (mod_func_action->val[0].u.data == 0) {
|
|
|
|
|
if (find_export_record($1, mod_func_action->val[1].u.number, 0,
|
|
|
|
|
&u_tmp) ) {
|
|
|
|
|
LOG(L_ERR, "misused command %s\n", $1);
|
|
|
|
|
LM_ERR("misused command %s\n", $1);
|
|
|
|
|
yyerror("Command cannot be used in the block\n");
|
|
|
|
|
} else {
|
|
|
|
|
LOG(L_ERR, "cfg. parser: failed to find command %s (params %ld)\n",
|
|
|
|
|
LM_ERR("cfg. parser: failed to find command %s (params %ld)\n",
|
|
|
|
|
$1, mod_func_action->val[1].u.number);
|
|
|
|
|
yyerror("unknown command, missing loadmodule?\n");
|
|
|
|
|
}
|
|
|
|
@ -3278,7 +3282,7 @@ ret_cmd:
|
|
|
|
|
(void*)(DROP_R_F|EXIT_R_F)); set_cfg_pos($$);
|
|
|
|
|
}
|
|
|
|
|
| DROP {
|
|
|
|
|
$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
|
|
|
|
|
$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
|
|
|
|
|
(void*)(DROP_R_F|EXIT_R_F)); set_cfg_pos($$);
|
|
|
|
|
}
|
|
|
|
|
| EXIT LPAREN RPAREN {
|
|
|
|
@ -3332,19 +3336,19 @@ static void warn_at(struct cfg_pos* p, char* format, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
char s[256];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vsnprintf(s, sizeof(s), format, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
if (p->e_line!=p->s_line)
|
|
|
|
|
LOG(L_WARN, "warning in config file %s, from line %d, column %d to"
|
|
|
|
|
LM_WARN("warning in config file %s, from line %d, column %d to"
|
|
|
|
|
" line %d, column %d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, p->e_line, p->e_col, s);
|
|
|
|
|
else if (p->s_col!=p->e_col)
|
|
|
|
|
LOG(L_WARN, "warning in config file %s, line %d, column %d-%d: %s\n",
|
|
|
|
|
LM_WARN("warning in config file %s, line %d, column %d-%d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, p->e_col, s);
|
|
|
|
|
else
|
|
|
|
|
LOG(L_WARN, "warning in config file %s, line %d, column %d: %s\n",
|
|
|
|
|
LM_WARN("warning in config file %s, line %d, column %d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, s);
|
|
|
|
|
cfg_warnings++;
|
|
|
|
|
}
|
|
|
|
@ -3355,19 +3359,19 @@ static void yyerror_at(struct cfg_pos* p, char* format, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
char s[256];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vsnprintf(s, sizeof(s), format, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
if (p->e_line!=p->s_line)
|
|
|
|
|
LOG(L_CRIT, "parse error in config file %s, from line %d, column %d"
|
|
|
|
|
LM_CRIT("parse error in config file %s, from line %d, column %d"
|
|
|
|
|
" to line %d, column %d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, p->e_line, p->e_col, s);
|
|
|
|
|
else if (p->s_col!=p->e_col)
|
|
|
|
|
LOG(L_CRIT,"parse error in config file %s, line %d, column %d-%d: %s\n",
|
|
|
|
|
LM_CRIT("parse error in config file %s, line %d, column %d-%d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, p->e_col, s);
|
|
|
|
|
else
|
|
|
|
|
LOG(L_CRIT, "parse error in config file %s, line %d, column %d: %s\n",
|
|
|
|
|
LM_CRIT("parse error in config file %s, line %d, column %d: %s\n",
|
|
|
|
|
p->fname, p->s_line, p->s_col, s);
|
|
|
|
|
cfg_errors++;
|
|
|
|
|
}
|
|
|
|
@ -3379,7 +3383,7 @@ static void warn(char* format, ...)
|
|
|
|
|
va_list ap;
|
|
|
|
|
char s[256];
|
|
|
|
|
struct cfg_pos pos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_cpos(&pos);
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vsnprintf(s, sizeof(s), format, ap);
|
|
|
|
@ -3394,7 +3398,7 @@ static void yyerror(char* format, ...)
|
|
|
|
|
va_list ap;
|
|
|
|
|
char s[256];
|
|
|
|
|
struct cfg_pos pos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_cpos(&pos);
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vsnprintf(s, sizeof(s), format, ap);
|
|
|
|
@ -3433,7 +3437,7 @@ static struct rval_expr* mk_rve1(enum rval_expr_op op, struct rval_expr* rve1)
|
|
|
|
|
struct rval_expr* ret;
|
|
|
|
|
struct rval_expr* bad_rve;
|
|
|
|
|
enum rval_type type, bad_t, exp_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rve1==0)
|
|
|
|
|
return 0;
|
|
|
|
|
ret=mk_rval_expr1(op, rve1, &rve1->fpos);
|
|
|
|
@ -3459,7 +3463,7 @@ static struct rval_expr* mk_rve2(enum rval_expr_op op, struct rval_expr* rve1,
|
|
|
|
|
struct rval_expr* bad_rve;
|
|
|
|
|
enum rval_type type, bad_t, exp_t;
|
|
|
|
|
struct cfg_pos pos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((rve1==0) || (rve2==0))
|
|
|
|
|
return 0;
|
|
|
|
|
bad_rve=0;
|
|
|
|
@ -3490,7 +3494,7 @@ static int rval_expr_int_check(struct rval_expr *rve)
|
|
|
|
|
{
|
|
|
|
|
struct rval_expr* bad_rve;
|
|
|
|
|
enum rval_type type, bad_t, exp_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rve==0){
|
|
|
|
|
yyerror("invalid expression");
|
|
|
|
|
return -1;
|
|
|
|
@ -3531,7 +3535,7 @@ static struct name_lst* mk_name_lst(char* host, int flags)
|
|
|
|
|
if (host==0) return 0;
|
|
|
|
|
l=pkg_malloc(sizeof(struct name_lst));
|
|
|
|
|
if (l==0) {
|
|
|
|
|
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
l->name=host;
|
|
|
|
|
l->flags=flags;
|
|
|
|
@ -3547,7 +3551,7 @@ static struct socket_id* mk_listen_id(char* host, int proto, int port)
|
|
|
|
|
if (host==0) return 0;
|
|
|
|
|
l=pkg_malloc(sizeof(struct socket_id));
|
|
|
|
|
if (l==0) {
|
|
|
|
|
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
l->addr_lst=mk_name_lst(host, 0);
|
|
|
|
|
if (l->addr_lst==0){
|
|
|
|
@ -3566,7 +3570,7 @@ static struct socket_id* mk_listen_id(char* host, int proto, int port)
|
|
|
|
|
static void free_name_lst(struct name_lst* lst)
|
|
|
|
|
{
|
|
|
|
|
struct name_lst* tmp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(lst){
|
|
|
|
|
tmp=lst;
|
|
|
|
|
lst=lst->next;
|
|
|
|
@ -3582,7 +3586,7 @@ static struct socket_id* mk_listen_id2(struct name_lst* addr_l, int proto,
|
|
|
|
|
if (addr_l==0) return 0;
|
|
|
|
|
l=pkg_malloc(sizeof(struct socket_id));
|
|
|
|
|
if (l==0) {
|
|
|
|
|
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n");
|
|
|
|
|
LM_CRIT("cfg. parser: out of memory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
l->flags=addr_l->flags;
|
|
|
|
|
l->port=port;
|
|
|
|
@ -3604,7 +3608,7 @@ static void free_socket_id(struct socket_id* i)
|
|
|
|
|
static void free_socket_id_lst(struct socket_id* lst)
|
|
|
|
|
{
|
|
|
|
|
struct socket_id* tmp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(lst){
|
|
|
|
|
tmp=lst;
|
|
|
|
|
lst=lst->next;
|
|
|
|
@ -3626,7 +3630,7 @@ static struct case_stms* mk_case_stm(struct rval_expr* ct, int is_re,
|
|
|
|
|
struct rval_expr* bad_rve;
|
|
|
|
|
enum rval_type type, bad_t, exp_t;
|
|
|
|
|
enum match_str_type t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t=MATCH_UNKNOWN;
|
|
|
|
|
if (ct){
|
|
|
|
|
/* if ct!=0 => case, else if ct==0 is a default */
|
|
|
|
@ -3674,7 +3678,7 @@ static int case_check_type(struct case_stms* stms)
|
|
|
|
|
{
|
|
|
|
|
struct case_stms* c;
|
|
|
|
|
struct case_stms* s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(c=stms; c ; c=c->next){
|
|
|
|
|
if (!c->ct_rve) continue;
|
|
|
|
|
for (s=c->next; s; s=s->next){
|
|
|
|
@ -3698,7 +3702,7 @@ static int case_check_default(struct case_stms* stms)
|
|
|
|
|
{
|
|
|
|
|
struct case_stms* c;
|
|
|
|
|
int default_no;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default_no=0;
|
|
|
|
|
for(c=stms; c ; c=c->next)
|
|
|
|
|
if (c->ct_rve==0) default_no++;
|
|
|
|
@ -3709,8 +3713,8 @@ static int case_check_default(struct case_stms* stms)
|
|
|
|
|
|
|
|
|
|
/** fixes the parameters and the type of a module function call.
|
|
|
|
|
* It is done here instead of fix action, to have quicker feedback
|
|
|
|
|
* on error cases (e.g. passing a non constant to a function with a
|
|
|
|
|
* declared fixup)
|
|
|
|
|
* on error cases (e.g. passing a non constant to a function with a
|
|
|
|
|
* declared fixup)
|
|
|
|
|
* The rest of the fixup is done inside do_action().
|
|
|
|
|
* @param a - filled module function call (MODULE*_T) action structure
|
|
|
|
|
* complete with parameters, starting at val[2] and parameter
|
|
|
|
@ -3727,11 +3731,11 @@ static int mod_f_params_pre_fixup(struct action* a)
|
|
|
|
|
struct rvalue* rv;
|
|
|
|
|
int r;
|
|
|
|
|
str s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd_exp = a->val[0].u.data;
|
|
|
|
|
param_no = a->val[1].u.number;
|
|
|
|
|
params = &a->val[2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(cmd_exp->param_no) {
|
|
|
|
|
case 0:
|
|
|
|
|
a->type = MODULE0_T;
|
|
|
|
@ -3762,7 +3766,7 @@ static int mod_f_params_pre_fixup(struct action* a)
|
|
|
|
|
" (invalid number of parameters)", cmd_exp->name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( cmd_exp->fixup) {
|
|
|
|
|
if (is_fparam_rve_fixup(cmd_exp->fixup))
|
|
|
|
|
/* mark known fparam rve safe fixups */
|
|
|
|
@ -3814,10 +3818,10 @@ static void free_mod_func_action(struct action* a)
|
|
|
|
|
action_u_t* params;
|
|
|
|
|
int param_no;
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
param_no = a->val[1].u.number;
|
|
|
|
|
params = &a->val[2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (r=0; r < param_no; r++)
|
|
|
|
|
if (params[r].u.data)
|
|
|
|
|
rve_destroy(params[r].u.data);
|
|
|
|
|