mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 07:31:54 +00:00
BGPsec: small refactoring of code
1) Move configuration global 'rpki dir' command to proto/rpki/config.Y 2) rpki_state_dir -> rpki_dir
This commit is contained in:
parent
e0dc3daad4
commit
ebb9ae8c6b
@ -108,7 +108,7 @@ $(objdir)/sysdep/paths.h: Makefile
|
||||
echo >$@ "/* Generated by Makefile, don't edit manually! */"
|
||||
echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
|
||||
echo >>$@ "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
|
||||
echo >>$@ "#define PATH_RPKI_STATE_DIR \"@RPKI_STATE_DIR@\""
|
||||
echo >>$@ "#define PATH_RPKI_DIR \"@RPKI_DIR@\""
|
||||
if test -n "@iproutedir@" ; then echo >>$@ "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
|
||||
|
||||
# Finally include the computed dependencies
|
||||
|
@ -104,7 +104,7 @@ config_alloc(byte *name)
|
||||
c->tf_route = c->tf_proto = (struct timeformat){"%T", "%F", 20*3600};
|
||||
c->tf_base = c->tf_log = (struct timeformat){"%F %T", NULL, 0};
|
||||
c->gr_wait = DEFAULT_GR_WAIT;
|
||||
c->rpki_state_dir = PATH_RPKI_STATE_DIR;
|
||||
c->rpki_dir = PATH_RPKI_DIR;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ struct config {
|
||||
ip_addr listen_bgp_addr; /* Listening BGP socket should use this address */
|
||||
unsigned listen_bgp_port; /* Listening BGP socket should use this port (0 is default) */
|
||||
u32 listen_bgp_flags; /* Listening BGP socket should use these flags */
|
||||
const char *rpki_state_dir; /* File path to save Router Keys for RPKI */
|
||||
const char *rpki_dir; /* File path to save Router Keys for RPKI */
|
||||
unsigned proto_default_debug; /* Default protocol debug mask */
|
||||
unsigned proto_default_mrtdump; /* Default protocol mrtdump mask */
|
||||
struct timeformat tf_route; /* Time format for 'show route' */
|
||||
|
@ -39,15 +39,15 @@ AC_SUBST(runtimedir)
|
||||
if test "$enable_debug" = yes ; then
|
||||
CONFIG_FILE="bird.conf"
|
||||
CONTROL_SOCKET="bird.ctl"
|
||||
RPKI_STATE_DIR="rpki"
|
||||
RPKI_DIR="rpki"
|
||||
else
|
||||
CONFIG_FILE="\$(sysconfdir)/bird.conf"
|
||||
CONTROL_SOCKET="$runtimedir/bird.ctl"
|
||||
RPKI_STATE_DIR="\$(localstatedir)/rpki"
|
||||
RPKI_DIR="\$(localstatedir)/rpki"
|
||||
fi
|
||||
AC_SUBST(CONFIG_FILE)
|
||||
AC_SUBST(CONTROL_SOCKET)
|
||||
AC_SUBST(RPKI_STATE_DIR)
|
||||
AC_SUBST(RPKI_DIR)
|
||||
|
||||
AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
|
||||
AC_MSG_ERROR([[Function clock_gettime not available.]]))
|
||||
|
@ -457,11 +457,6 @@ password_item_params:
|
||||
| ID expr ';' password_item_params { this_p_item->id = $2; if ($2 <= 0) cf_error("Password ID has to be greated than zero."); }
|
||||
;
|
||||
|
||||
/* Overwrite RPKI State Dir for BGPSEC Router Keys */
|
||||
|
||||
CF_ADDTO(conf, rpki_state_dir)
|
||||
rpki_state_dir: RPKI STATE DIR text ';' { new_config->rpki_state_dir = $4; }
|
||||
|
||||
/* Core commands */
|
||||
CF_CLI_HELP(SHOW, ..., [[Show status information]])
|
||||
|
||||
|
@ -24,10 +24,17 @@ rpki_check_unused_hostname(void)
|
||||
CF_DECLS
|
||||
|
||||
CF_KEYWORDS(RPKI, REMOTE, BIRD, PRIVATE, PUBLIC, KEY, SSH, ENCRYPTION, USER,
|
||||
RETRY, REFRESH, EXPIRE, STATE, DIR)
|
||||
RETRY, REFRESH, EXPIRE, DIR)
|
||||
|
||||
CF_GRAMMAR
|
||||
|
||||
/* Overwrite RPKI directory for BGPSEC Router Keys */
|
||||
|
||||
CF_ADDTO(conf, rpki_dir)
|
||||
rpki_dir: RPKI DIR text ';' { new_config->rpki_dir = $3; }
|
||||
|
||||
/* RPKI Protocol */
|
||||
|
||||
CF_ADDTO(proto, rpki_proto)
|
||||
|
||||
rpki_proto_start: proto_start RPKI {
|
||||
|
@ -774,7 +774,7 @@ rpki_handle_router_key_pdu(struct rpki_cache *cache, const struct pdu_router_key
|
||||
{
|
||||
char file_name[4096]; /* PATH_MAX? */
|
||||
char ski_hex[41];
|
||||
const char *state_dir = config->rpki_state_dir;
|
||||
const char *state_dir = config->rpki_dir;
|
||||
int i;
|
||||
int fd = -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user