]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Log: Improve some messages
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 8 Nov 2021 18:48:15 +0000 (12:48 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 8 Nov 2021 18:48:15 +0000 (12:48 -0600)
src/common.c
src/http/http.c
src/log.c
src/rrdp/db/db_rrdp_uris.c
src/rrdp/rrdp_loader.c
src/rsync/rsync.c

index a57b5f7d187e3d87e3b0ebd65a3970f8298677e3..342d0d8b4a43fcd49a9c3dfc81e0fe011027c12e 100644 (file)
@@ -180,8 +180,10 @@ valid_file_or_dir(char const *location, bool check_file, bool check_dir,
                pr_crit("Wrong usage, at least one check must be 'true'.");
 
        if (stat(location, &attr) == -1) {
-               if (error_fn != NULL)
-                       error_fn(errno, "stat(%s) failed", location);
+               if (error_fn != NULL) {
+                       error_fn(errno, "stat(%s) failed: %s", location,
+                           strerror(errno));
+               }
                return false;
        }
 
index 3534eb0b117e3d81cb64b6aab6d9bccefc2c2c89..035678bab8c791072a11134924cd632ead13e2ee 100644 (file)
@@ -81,7 +81,7 @@ write_callback(void *data, size_t size, size_t nmemb, void *userp)
                 * to reject the file anyway.
                 */
                arg->error = -EFBIG;
-               return 0; /* Ugh. See fread(3) */
+               return 0; /* Ugh. See fwrite(3) */
        }
 
        return fwrite(data, size, nmemb, arg->dst);
@@ -222,6 +222,7 @@ http_fetch(struct http_handler *handler, char const *uri, long *response_code,
 
        pr_val_debug("HTTP GET: %s", uri);
        res = curl_easy_perform(handler->curl);
+       pr_val_debug("Done. Total bytes transferred: %zu", args.total_bytes);
 
        if (args.error == -EFBIG) {
                pr_val_err("The file '%s' is too big (read: %zu bytes). Rejecting.",
index bdae4b5acb2f9ee0a4bb63fec4aa6991a8e86b01..166a2fc584c1a77977706723e18cc9398d42beff 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -507,6 +507,9 @@ int
 __pr_op_err(int error, const char *format, ...)
 {
        PR_SIMPLE(LOG_ERR, op_config);
+       lock_mutex();
+       print_stack_trace(NULL);
+       unlock_mutex();
        return error;
 }
 
index 51f24ee80ddd8af09b962a4f261f65ee908fd92c..106c4b1eb672ca79fa049a79d4657aa0140ce31d 100644 (file)
@@ -172,20 +172,27 @@ db_rrdp_uris_cmp(char const *uri, char const *session_id, unsigned long serial,
 
        found = find_rrdp_uri(uris, uri);
        if (found == NULL) {
+               pr_val_debug("I don't have state for this Update Notification; downloading snapshot...");
                *result = RRDP_URI_NOTFOUND;
                return 0;
        }
 
        if (strcmp(session_id, found->data.session_id) != 0) {
+               pr_val_debug("session_id changed from '%s' to '%s'.",
+                   found->data.session_id, session_id);
                *result = RRDP_URI_DIFF_SESSION;
                return 0;
        }
 
        if (serial != found->data.serial) {
+               pr_val_debug("The serial changed from %lu to %lu.",
+                   found->data.serial, serial);
                *result = RRDP_URI_DIFF_SERIAL;
                return 0;
        }
 
+       pr_val_debug("The new Update Notification has the same session_id (%s) and serial (%lu) as the old one.",
+           session_id, serial);
        *result = RRDP_URI_EQUAL;
        return 0;
 }
index f7d827725a12b58a2ffd9729e13299dc76b788f0..89fffc6113c7e0812a2e6a13876a7889b9d33e65 100644 (file)
@@ -190,6 +190,7 @@ __rrdp_load(struct rpki_uri *uri, bool force_snapshot, bool *data_updated)
                }
        }
 
+       pr_val_debug("Downloading RRDP Update Notification...");
        log_operation = reqs_errors_log_uri(uri_get_global(uri));
        error = rrdp_parse_notification(uri, log_operation, force_snapshot,
            &upd_notification);
@@ -198,10 +199,12 @@ __rrdp_load(struct rpki_uri *uri, bool force_snapshot, bool *data_updated)
 
        /* No updates at the file (yet), didn't pushed to fnstack */
        if (upd_notification == NULL) {
-               pr_val_debug("No updates yet at '%s'.", uri_get_global(uri));
+               pr_val_debug("The Update Notification has not changed.");
                goto upd_end;
        }
 
+       pr_val_debug("The Update Notification changed.");
+
        do {
                /* Same flow as a session update */
                if (force_snapshot) {
index cfb907927105a5342d63103aacac88504359b03f..97c3599369cd41d3e0b891f0cecabd7e5609a597 100644 (file)
@@ -452,7 +452,7 @@ do_rsync(struct rpki_uri *uri, bool is_ta, bool log_operation)
                if (WIFEXITED(child_status)) {
                        /* Happy path (but also sad path sometimes). */
                        error = WEXITSTATUS(child_status);
-                       pr_val_debug("Child terminated with error code %d.",
+                       pr_val_debug("The rsync sub-process terminated with error code %d.",
                            error);
                        if (!error)
                                goto release_args;