From: pcarana Date: Fri, 13 Mar 2020 17:30:21 +0000 (-0600) Subject: Wait for clients once the first validation cycle ends X-Git-Tag: v1.2.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6270ca1cabca7a44036533bd371f9e8cb80e9589;p=thirdparty%2FFORT-validator.git Wait for clients once the first validation cycle ends --- diff --git a/docs/routers.md b/docs/routers.md index 2db73e45..f5d2856b 100644 --- a/docs/routers.md +++ b/docs/routers.md @@ -48,9 +48,9 @@ Here are a few links to the RPKI configuration docs at some routers: ### (Re)start -When Fort validator is run for the first time, the RTR server will wait for router connections at [`--server.address`](usage.html#--serveraddress):[`--server.port`](usage.html#--serverport) and will start its first validation cycle. +When Fort validator is run for the first time, the RTR server will listen for router connections at [`--server.address`](usage.html#--serveraddress):[`--server.port`](usage.html#--serverport) once its first validation cycle ends. -If a router establishes a connection with Fort before the first validation cycle ends, Fort will respond with a **"No Data Available"** RTR error, causing the router to wait some time (this will depend on each router) before asking for updates again. +If a router tries to establish a connection with Fort before the first validation cycle ends, Fort won't respond at all, causing the router to wait some time (this will depend on each router) before asking for updates again. Once FORT validator ends its first validation cycle, it will share the resulting data (also known as "Validated ROA Payloads" or VRPs) with any router that establishes an RTR connection. diff --git a/src/updates_daemon.c b/src/updates_daemon.c index 622c8bb1..2306d694 100644 --- a/src/updates_daemon.c +++ b/src/updates_daemon.c @@ -20,27 +20,25 @@ check_vrps_updates(void *param_void) int error; do { + sleep(config_get_validation_interval()); + error = vrps_update(&changed); if (error == -EINTR) break; /* Process interrupted, terminate thread */ if (error) { - pr_err("Error code %d while trying to update the ROA database. Sleeping...", - error); - goto sleep; + pr_err("Error while trying to update the ROA database. Sleeping..."); + continue; } if (changed) { error = notify_clients(); if (error) - pr_debug("Could not notify clients of the new VRPs. (Error code %d.) Sleeping...", + pr_debug("Could't notify clients of the new VRPs. (Error code %d.) Sleeping...", error); else pr_debug("Database updated successfully. Sleeping..."); } - -sleep: - sleep(config_get_validation_interval()); } while (true); return NULL; @@ -49,6 +47,13 @@ sleep: int updates_daemon_start(void) { + bool changed; + int error; + + error = vrps_update(&changed); + if (error) + return pr_err("First validation wasn't successful."); + errno = pthread_create(&thread, NULL, check_vrps_updates, NULL); if (errno) return -pr_errno(errno,