mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 07:31:54 +00:00
RPKI: Fix conflict in config grammar
This commit is contained in:
parent
32427c9ce1
commit
116285f2b0
@ -121,7 +121,7 @@ CF_DECLS
|
|||||||
%type <s> symbol
|
%type <s> symbol
|
||||||
%type <kw> kw_sym
|
%type <kw> kw_sym
|
||||||
|
|
||||||
%type <v> bytestring_text
|
%type <v> bytestring_text text_or_ipa
|
||||||
%type <x> bytestring_expr
|
%type <x> bytestring_expr
|
||||||
|
|
||||||
%nonassoc PREFIX_DUMMY
|
%nonassoc PREFIX_DUMMY
|
||||||
@ -399,6 +399,24 @@ opttext:
|
|||||||
| /* empty */ { $$ = NULL; }
|
| /* empty */ { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
text_or_ipa:
|
||||||
|
TEXT { $$.type = T_STRING; $$.val.s = $1; }
|
||||||
|
| IP4 { $$.type = T_IP; $$.val.ip = ipa_from_ip4($1); }
|
||||||
|
| IP6 { $$.type = T_IP; $$.val.ip = ipa_from_ip6($1); }
|
||||||
|
| CF_SYM_KNOWN {
|
||||||
|
if (($1->class == (SYM_CONSTANT | T_STRING)) ||
|
||||||
|
($1->class == (SYM_CONSTANT | T_IP)))
|
||||||
|
$$ = *($1->val);
|
||||||
|
else
|
||||||
|
cf_error("String or IP constant expected");
|
||||||
|
}
|
||||||
|
| '(' term ')' {
|
||||||
|
$$ = cf_eval($2, T_VOID);
|
||||||
|
if (($$.type != T_BYTESTRING) && ($$.type != T_STRING))
|
||||||
|
cf_error("Bytestring or string value expected");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
bytestring:
|
bytestring:
|
||||||
BYTETEXT
|
BYTETEXT
|
||||||
| bytestring_expr { $$ = cf_eval($1, T_BYTESTRING).val.bs; }
|
| bytestring_expr { $$ = cf_eval($1, T_BYTESTRING).val.bs; }
|
||||||
|
@ -89,20 +89,22 @@ rpki_keep_interval:
|
|||||||
|
|
||||||
rpki_proto_item_port: PORT expr { check_u16($2); RPKI_CFG->port = $2; };
|
rpki_proto_item_port: PORT expr { check_u16($2); RPKI_CFG->port = $2; };
|
||||||
|
|
||||||
rpki_cache_addr:
|
rpki_cache_addr: text_or_ipa
|
||||||
text {
|
{
|
||||||
rpki_check_unused_hostname();
|
rpki_check_unused_hostname();
|
||||||
RPKI_CFG->hostname = $1;
|
if ($1.type == T_STRING)
|
||||||
}
|
RPKI_CFG->hostname = $1.val.s;
|
||||||
| ipa {
|
else if ($1.type == T_IP)
|
||||||
rpki_check_unused_hostname();
|
{
|
||||||
RPKI_CFG->ip = $1;
|
RPKI_CFG->ip = $1.val.ip;
|
||||||
/* Ensure hostname is filled */
|
|
||||||
char *hostname = cfg_allocz(INET6_ADDRSTRLEN + 1);
|
/* Ensure hostname is filled */
|
||||||
bsnprintf(hostname, INET6_ADDRSTRLEN+1, "%I", RPKI_CFG->ip);
|
char *hostname = cfg_allocz(INET6_ADDRSTRLEN + 1);
|
||||||
RPKI_CFG->hostname = hostname;
|
bsnprintf(hostname, INET6_ADDRSTRLEN+1, "%I", RPKI_CFG->ip);
|
||||||
}
|
RPKI_CFG->hostname = hostname;
|
||||||
;
|
}
|
||||||
|
else bug("Bad text_or_ipa");
|
||||||
|
};
|
||||||
|
|
||||||
rpki_transport:
|
rpki_transport:
|
||||||
TCP rpki_transport_tcp_init
|
TCP rpki_transport_tcp_init
|
||||||
|
Loading…
Reference in New Issue
Block a user