]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGPsec: small refactoring of code
authorPavel Tvrdik <pawel.tvrdik@gmail.com>
Wed, 1 Jun 2016 14:33:40 +0000 (16:33 +0200)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Thu, 2 Jun 2016 07:32:42 +0000 (09:32 +0200)
1) Move configuration global 'rpki dir' command to proto/rpki/config.Y
2) rpki_state_dir -> rpki_dir

Makefile.in
conf/conf.c
conf/conf.h
configure.in
nest/config.Y
proto/rpki/config.Y
proto/rpki/packets.c

index 552e7a53650632033a3b3bc1cee7b643f556a489..f20d0d7e54d27c8e4a59a1ded9ad54534f97a1ae 100644 (file)
@@ -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
index 9e9048589bfc89ba1af2f9a1e6ec7581e5eb4eed..bc4a827ff4cc19d7987205f64a77808fea527ecc 100644 (file)
@@ -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;
 }
index 421e2b4589d3b15214869729c4e76ee8730b7706..2244778958993648224ce890909a904eeb9fdb60 100644 (file)
@@ -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' */
index e2ef005d2dba3471440a758dda0baa1dd9d96c43..a748c5c1afd4753ec2235c98b43f8da108a68d15 100644 (file)
@@ -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.]]))
index 04c4415e352ac91ee59d5f5e757cd753800658f6..7e34bb91f4fbe4382265646def78f615b4352e91 100644 (file)
@@ -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]])
 
index a0af7748e22e1155ad933aeb056ee21887b6a554..6ac9ab47d1d820ea7d16c12e3cebc93eb03be0c8 100644 (file)
@@ -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 {
index f6a5f77bc2e6d30bb0e102739d8ed82a0f29eb52..f59eb8918f5951a6be543a29d2f37fc784112dde 100644 (file)
@@ -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;