Commit aeaf497a authored by Pavel Tvrdík's avatar Pavel Tvrdík
Browse files

RPKI: Importing routes into roa table

Implementation based on RTRLib.

Communication between rtrlib threads and main thread through pipe()
  sockets and notify list like in BFD protocol.

TODO:
  - load rtrlib using dlopen()
  - take into account preferences of cache servers in configuration
parent 14922073
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@ CF_HDR

CF_DEFINES

static void
check_u8(unsigned val)
{
  if (val > 0xFF)
    cf_error("Value %d out of range (0-255)", val);
}

static void
check_u16(unsigned val)
{
@@ -55,6 +62,7 @@ CF_DECLS
  struct lsadb_show_data *ld;
  struct iface *iface;
  struct roa_table *rot;
  struct roa_table_config *rotcf;
  void *g;
  bird_clock_t time;
  struct prefix px;
+9 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
%type <ra> r_args
%type <ro> roa_args
%type <rot> roa_table_arg
%type <rotcf> roa_table_cf
%type <sd> sym_args
%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode roa_mode limit_action tab_sorted tos
%type <ps> proto_patt proto_patt2
@@ -262,6 +263,14 @@ rtable:
   }
 ;

roa_table_cf:
    SYM {
      if ($1->class != SYM_ROA) cf_error("ROA table name expected");
      $$ = $1->def;
    }
  ;


CF_ADDTO(conf, debug_default)

debug_default:
+1 −0
Original line number Diff line number Diff line
@@ -921,6 +921,7 @@ protos_build(void)
#endif
#ifdef CONFIG_RPKI
  proto_build(&proto_rpki);
  rpki_init_all();
#endif

  proto_pool = rp_new(&root_pool, "Protocols");
+1 −0
Original line number Diff line number Diff line
@@ -600,6 +600,7 @@ struct roa_show_data {
#define ROA_SRC_ANY	0
#define ROA_SRC_CONFIG	1
#define ROA_SRC_DYNAMIC	2
#define ROA_SRC_RPKI    3

#define ROA_SHOW_ALL	0
#define ROA_SHOW_PX	1
+10 −3
Original line number Diff line number Diff line
@@ -25,7 +25,13 @@ CF_GRAMMAR
CF_ADDTO(proto, rpki_proto)

rpki_proto:
   rpki_proto_start proto_name '{' rpki_proto_opts '}'
   rpki_proto_start proto_name '{' rpki_proto_opts '}' {
     if (RPKI_CFG->roa_table_cf == NULL)
     {
       cf_error("For the RPKI protocol must be specified a roa table");
     }
   }
 ;

rpki_proto_start:
   proto_start RPKI {
@@ -42,6 +48,7 @@ rpki_proto_opts:
rpki_proto_item:
   proto_item
 | CACHE LIST '{' rpki_cache_list '}'
 | ROA TABLE roa_table_cf { RPKI_CFG->roa_table_cf = $3; }
 ;

rpki_cache_list:
@@ -70,8 +77,8 @@ rpki_cache_opts:
 ;

rpki_cache_opts_item:
   PORT expr 		{ bsnprintf(this_rpki_cache->port, RPKI_PORT_MAX_LENGTH_STR, "%u", (u16) $2); }
 | PREFERENCE expr	{ this_rpki_cache->preference = $2; }
   PORT expr 		{ check_u16($2); bsnprintf(this_rpki_cache->port, RPKI_PORT_MAX_LENGTH_STR, "%u", (u16) $2); }
 | PREFERENCE expr	{ check_u8($2); this_rpki_cache->preference = $2; }
 ;

CF_CODE
Loading