mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-18 06:51:54 +00:00
RPKI: miscellaneous small changes
This commit is contained in:
parent
03f7edbd83
commit
82804d6add
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -13,21 +13,18 @@
|
||||
|
||||
#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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user