+Initialize serial var when logging validation run information.
+Use a write lock when removing non-visited tals RRDP info.
+There was a segfault on two scenarios:
- When run as server and using a slurm file, during the second run, the validator couldn't access RRDP data from the previous run. Fix: the RRDP TAL DB must be static (lives at the parent stack).
- When SLURM was discarded due to a bad file content (eg. empty file, or malformed JSON) and during the next run the file content was valid again, the previous SLURM pointer was freed but didn't pointed at NULL (and this was expected). Fix: point at NULL when the whole SLURM is discarded.
struct db_rrdp {
struct tal_list tals;
-} db;
+};
+
+static struct db_rrdp db;
/** Read/write lock, which protects @db. */
static pthread_rwlock_t lock;
{
struct tal_elem *found;
- rwlock_read_lock(&lock);
+ rwlock_write_lock(&lock);
SLIST_FOREACH(found, &db.tals, next) {
if (!found->visited) {
SLIST_REMOVE(&db.tals, found, tal_elem, next);
return __vrps_update(changed);
pr_info("Starting validation.");
+ serial = START_SERIAL;
if (config_get_mode() == SERVER) {
error = get_last_serial_number(&serial);
if (!error)
if (*last_slurm != NULL) {
pr_info("Discarding previous valid SLURM");
db_slurm_destroy(*last_slurm);
+ *last_slurm = NULL;
}
goto success;
}