]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
RPKI: miscellaneous small changes
authorPavel Tvrdík <pawel.tvrdik@gmail.com>
Tue, 22 Dec 2015 15:53:42 +0000 (16:53 +0100)
committerPavel Tvrdík <pawel.tvrdik@gmail.com>
Wed, 23 Dec 2015 14:09:07 +0000 (15:09 +0100)
proto/rpki/packets.c
proto/rpki/rpki.c
proto/rpki/rpki.h
proto/rpki/rtr.c
proto/rpki/rtr.h

index 12785e33147e2291a1ded7f808b89d2d2a402a04..cd3dd5f59c5d11a0e30e4ea9bed2f78bcb9176a5 100644 (file)
@@ -444,7 +444,8 @@ rpki_log_packet(struct rpki_cache *cache, const void *pdu, const size_t len, con
     DBG("\n");
 }
 
-static int rtr_send_pdu(struct rpki_cache *cache, const void *pdu, const unsigned len)
+static int
+rtr_send_pdu(struct rpki_cache *cache, const void *pdu, const unsigned len)
 {
   const struct rtr_socket *rtr_socket = cache->rtr_socket;
   struct rpki_proto *p = cache->p;
@@ -601,7 +602,8 @@ rtr_check_receive_packet(struct rpki_cache *cache, void *pdu, const size_t len)
   return RTR_ERROR;
 }
 
-static int rtr_handle_error_pdu(struct rtr_socket *rtr_socket, const void *buf)
+static int
+rtr_handle_error_pdu(struct rtr_socket *rtr_socket, const void *buf)
 {
   struct rpki_cache *cache = rtr_socket->cache;
   struct rpki_proto *p = cache->p;
@@ -771,26 +773,6 @@ rtr_update_pfx_table(struct rpki_cache *cache, const void *pdu)
     }
   }
 
-  /*
-  if (rtval == PFX_DUPLICATE_RECORD) {
-    CACHE_TRACE(D_EVENTS, cache, "Duplicate Announcement for record: %I/%u max %u as %u, received", pfxr.prefix, pfxr.min_len, pfxr.max_len, pfxr.asn);
-    rtr_send_error_pdu(cache, pdu, pdu_size, DUPLICATE_ANNOUNCEMENT , NULL, 0);
-    rtr_change_socket_state(rtr_socket, RTR_ERROR_FATAL);
-    return RTR_ERROR;
-  } else if (rtval == PFX_RECORD_NOT_FOUND) {
-    CACHE_TRACE(D_EVENTS, cache, "Withdrawal of unknown record");
-    rtr_send_error_pdu(cache, pdu, pdu_size, WITHDRAWAL_OF_UNKNOWN_RECORD, NULL, 0);
-    rtr_change_socket_state(rtr_socket, RTR_ERROR_FATAL);
-    return RTR_ERROR;
-  } else if (rtval == PFX_ERROR) {
-    const char *txt = "PFX_TABLE Error";
-    RPKI_DBG(cache, "%s", txt);
-    rtr_send_error_pdu(cache, pdu, pdu_size, INTERNAL_ERROR, txt, sizeof(txt));
-    rtr_change_socket_state(rtr_socket, RTR_ERROR_FATAL);
-    return RTR_ERROR;
-  }
-  */
-
   return RTR_SUCCESS;
 }
 
@@ -816,7 +798,7 @@ rtr_handle_end_of_data_pdu(struct rpki_cache *cache, void *pdu)
   if (eod_pdu->session_id != rtr_socket->session_id)
   {
     char txt[67];
-    snprintf(txt, sizeof(txt),"Expected session_id: %u, received session_id. %u in EOD PDU",rtr_socket->session_id, eod_pdu->session_id);
+    snprintf(txt, sizeof(txt),"Received session_id %u, but expected was session_id %u", eod_pdu->session_id, rtr_socket->session_id);
     CACHE_TRACE(D_EVENTS, cache, "%s", txt);
     rtr_send_error_pdu(cache, pdu, eod_pdu->len, CORRUPT_DATA, txt, strlen(txt) + 1);
     rtr_change_socket_state(rtr_socket, RTR_ERROR_FATAL);
@@ -865,7 +847,7 @@ rpki_rx_packet(struct rpki_cache *cache, byte *pdu, uint len)
       break;
 
     case CACHE_RESPONSE:
-      rtr_handle_cache_response_pdu(cache,pdu);
+      rtr_handle_cache_response_pdu(cache, pdu);
       break;
 
     case IPV4_PREFIX:
index f8e4685e845509d3f7c7f58accc21011ad25bf13..fe8e0e15bf4ae34bd8744afe90dab93ccffb03cb 100644 (file)
@@ -264,7 +264,7 @@ rpki_free_cache(struct rpki_cache *cache)
   mb_free(cache->rtr_socket->tr_socket);
   mb_free(cache->rtr_socket);
 
-  /* timers */
+  /* Timers */
   tm_stop(cache->retry_timer);
   tm_stop(cache->refresh_timer);
   tm_stop(cache->expire_timer);
index 4df0c052b37d55acfd7327701a02f7214d1b8a33..91ffe1eda76ebd1186fb12b0ca98701aed83ad51 100644 (file)
 
 #include "nest/bird.h"
 #include "nest/route.h"
-
 #include "lib/socket.h"
 #include "lib/ip.h"
 
-#include "tcp_transport.h"
-#include "ssh_transport.h"
-
+#include "transport.h"
 #include "rtr.h"
 #include "packets.h"
 
 #define RPKI_DEFAULT_PORT              8282
 #define RPKI_DEFAULT_SSH_PORT          22
-#define RPKI_DEFAULT_RETRY_INTERVAL    10
-#define RPKI_DEFAULT_REFRESH_INTERVAL  15
-#define RPKI_DEFAULT_EXPIRE_INTERVAL   30
+#define RPKI_DEFAULT_RETRY_INTERVAL    30
+#define RPKI_DEFAULT_REFRESH_INTERVAL  600
+#define RPKI_DEFAULT_EXPIRE_INTERVAL   1200
 #define RPKI_DEFAULT_CACHE_PREFERENCE  1       /* The most important priority */
 
 struct rpki_cache_ssh_cfg {
@@ -58,8 +55,7 @@ struct rpki_cache {
   timer *retry_timer;                  /* Timer for Cache server */
   timer *refresh_timer;                        /* Timer for Cache server */
   timer *expire_timer;                 /* Timer for Cache server */
-  u8 state;                            /* RPKI_CACHE_STATE_* */
-  u8 roa_src;                          /* For kicking off all ROA learned from this cache */
+  u8 roa_src;                          /* For purge ROAs learned only from this cache */
 };
 
 struct rpki_cache_group {
index f27158d3191a6b19138fdfec6550f59a2ac32ced..89db0c780a31e6fde607d6b9e2c36134c66ffae6 100644 (file)
@@ -141,7 +141,7 @@ rtr_schedule_next_expire_check(struct rpki_cache *cache)
 
   unsigned time_to_wait = MAX(((int)rtr_socket->expire_interval - (int)(now - rtr_socket->last_update)), 1);
 
-  CACHE_TRACE(D_EVENTS, cache, "Next ROA expiration check will be after %u seconds again", time_to_wait);
+  CACHE_DBG(cache, "Next ROA expiration check will be after %u seconds again", time_to_wait);
   tm_stop(cache->expire_timer);
   tm_start(cache->expire_timer, time_to_wait);
 }
index 282946e23c21a34dbf58cc49e6c71f756468e0de..2a487909745304b0dc6bf7c5574c0ba13c3f6ea1 100644 (file)
@@ -98,7 +98,7 @@ struct rtr_socket {
     bird_clock_t last_update;
     unsigned int retry_interval;               /* Use if the cache server is down */
     unsigned int refresh_interval;
-    unsigned int expire_interval;              /* After this period without successfull refresh will be ROAs discard */
+    unsigned int expire_interval;              /* After this period from last refresh will be ROAs discard */
     enum rtr_socket_state state;
     uint32_t session_id;
     bool request_session_id;