diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2023-08-25 04:32:01 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-08-25 04:32:01 +0200 |
commit | 116285f2b000a4b78044f1bcf1eb1d6655f1d2fe (patch) | |
tree | dbd71ae63ccf2e78ef96534e20563c1cf7888f5a /proto | |
parent | 32427c9ce119df5457d3d2c6e677429e31a5edad (diff) |
RPKI: Fix conflict in config grammar
Diffstat (limited to 'proto')
-rw-r--r-- | proto/rpki/config.Y | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/proto/rpki/config.Y b/proto/rpki/config.Y index d6d326b8..c28cab7a 100644 --- a/proto/rpki/config.Y +++ b/proto/rpki/config.Y @@ -89,20 +89,22 @@ rpki_keep_interval: rpki_proto_item_port: PORT expr { check_u16($2); RPKI_CFG->port = $2; }; -rpki_cache_addr: - text { - rpki_check_unused_hostname(); - RPKI_CFG->hostname = $1; - } - | ipa { - rpki_check_unused_hostname(); - RPKI_CFG->ip = $1; - /* Ensure hostname is filled */ - char *hostname = cfg_allocz(INET6_ADDRSTRLEN + 1); - bsnprintf(hostname, INET6_ADDRSTRLEN+1, "%I", RPKI_CFG->ip); - RPKI_CFG->hostname = hostname; - } - ; +rpki_cache_addr: text_or_ipa +{ + rpki_check_unused_hostname(); + if ($1.type == T_STRING) + RPKI_CFG->hostname = $1.val.s; + else if ($1.type == T_IP) + { + RPKI_CFG->ip = $1.val.ip; + + /* Ensure hostname is filled */ + char *hostname = cfg_allocz(INET6_ADDRSTRLEN + 1); + bsnprintf(hostname, INET6_ADDRSTRLEN+1, "%I", RPKI_CFG->ip); + RPKI_CFG->hostname = hostname; + } + else bug("Bad text_or_ipa"); +}; rpki_transport: TCP rpki_transport_tcp_init |