]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
rsync: Remove $HTTP_MAX_FILE_SIZE
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 29 Oct 2021 17:00:42 +0000 (12:00 -0500)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 29 Oct 2021 18:11:59 +0000 (13:11 -0500)
RRDP snapshots are the only large files RPs neet to get, so the RRDP
limit tends to need to be much larger than the rsync limit.

Therefore, allowing them to be defined in terms of the other doesn't
make much sense.

docs/usage.md
src/config.c
src/rsync/rsync.c
test/rsync_test.c

index 082eeb89d7c8a43f65810634ff5ace3b3ca14cf4..3f8c1c2cfa3bbe778c278ae08a399df2d03223eb 100644 (file)
@@ -1214,21 +1214,21 @@ Name of the program needed to invoke an rsync file transfer.
 
 - **Type:** String array
 - **Availability:** JSON only
-- **Default:** `[ "--recursive", "--delete", "--times", "--contimeout=20", "--timeout=15", "--max-size", "$HTTP_MAX_FILE_SIZE", "$REMOTE", "$LOCAL" ]`
+- **Default:** `[ "--recursive", "--delete", "--times", "--contimeout=20", "--timeout=15", "--max-size=20MB", "$REMOTE", "$LOCAL" ]`
 
 Arguments needed by [`rsync.program`](#rsyncprogram) to perform a recursive rsync.
 
-Fort will replace `"$REMOTE"` with the remote URL it needs to download, `"$LOCAL"` with the target local directory where the file is supposed to be dropped, and `"$HTTP_MAX_FILE_SIZE"` with [`--http.max-file-size`](#--httpmax-file-size).
+Fort will replace `"$REMOTE"` with the remote URL it needs to download, and `"$LOCAL"` with the target local directory where the file is supposed to be dropped.
 
 ### rsync.arguments-flat
 
 - **Type:** String array
 - **Availability:** JSON only
-- **Default:** `[ "--times", "--contimeout=20", "--timeout=15", "--max-size", "$HTTP_MAX_FILE_SIZE", "--dirs", "$REMOTE", "$LOCAL" ]`
+- **Default:** `[ "--times", "--contimeout=20", "--timeout=15", "--max-size=20MB", "--dirs", "$REMOTE", "$LOCAL" ]`
 
 Arguments needed by [`rsync.program`](#rsyncprogram) to perform a single-file rsync.
 
-Fort will replace `"$REMOTE"` with the remote URL it needs to download, `"$LOCAL"` with the target local directory where the file is supposed to be dropped, and `"$HTTP_MAX_FILE_SIZE"` with [`--http.max-file-size`](#--httpmax-file-size).
+Fort will replace `"$REMOTE"` with the remote URL it needs to download, and `"$LOCAL"` with the target local directory where the file is supposed to be dropped.
 
 ### `incidences`
 
index 47f022e7feb1e59b030c765003ddfb029e8a5e97..49653a1ff52ce5104cc6ba33628f822f1ab53ea4 100644 (file)
@@ -992,7 +992,7 @@ set_default_values(void)
                "--times",
                "--contimeout=20",
                "--timeout=15",
-               "--max-size", "$HTTP_MAX_FILE_SIZE",
+               "--max-size=20MB",
                "$REMOTE",
                "$LOCAL",
        };
@@ -1001,7 +1001,7 @@ set_default_values(void)
                "--times",
                "--contimeout=20",
                "--timeout=15",
-               "--max-size", "$HTTP_MAX_FILE_SIZE",
+               "--max-size=20MB",
                "--dirs",
                "$REMOTE",
                "$LOCAL",
@@ -1050,8 +1050,8 @@ set_default_values(void)
        rpki_config.rsync.enabled = true;
        rpki_config.rsync.priority = 50;
        rpki_config.rsync.strategy = RSYNC_ROOT_EXCEPT_TA;
-       rpki_config.rsync.retry.count = 0;
-       rpki_config.rsync.retry.interval = 5;
+       rpki_config.rsync.retry.count = 1;
+       rpki_config.rsync.retry.interval = 4;
        rpki_config.rsync.program = strdup("rsync");
        if (rpki_config.rsync.program == NULL) {
                error = pr_enomem();
@@ -1071,8 +1071,8 @@ set_default_values(void)
        /* By default, has a higher priority than rsync */
        rpki_config.http.enabled = true;
        rpki_config.http.priority = 60;
-       rpki_config.http.retry.count = 0;
-       rpki_config.http.retry.interval = 5;
+       rpki_config.http.retry.count = 1;
+       rpki_config.http.retry.interval = 4;
        rpki_config.http.user_agent = strdup(PACKAGE_NAME "/" PACKAGE_VERSION);
        if (rpki_config.http.user_agent == NULL) {
                error = pr_enomem();
index 3fab9f03e425f1df45fc72e46a68a9ed35c0d7a9..cfb907927105a5342d63103aacac88504359b03f 100644 (file)
@@ -192,32 +192,6 @@ duplicate_fds(int fds[2][2])
        close(fds[1][0]);
 }
 
-static int
-uint2string(unsigned int uint, char **result)
-{
-       char *str;
-       int str_len;
-
-       str_len = snprintf(NULL, 0, "%u", uint);
-       if (str_len < 0)
-               return pr_val_err("Cannot compute length of '%u' string: Unknown cause", uint);
-
-       str_len++; /* Null chara */
-
-       str = malloc(str_len * sizeof(char));
-       if (str == NULL)
-               return pr_enomem();
-
-       str_len = snprintf(str, str_len, "%u", uint);
-       if (str_len < 0) {
-               free(str);
-               return pr_val_err("Cannot convert '%u' into a string: Unknown cause", uint);
-       }
-
-       *result = str;
-       return 0;
-}
-
 static void
 release_args(char **args, unsigned int size)
 {
@@ -235,7 +209,6 @@ prepare_rsync(struct rpki_uri *uri, bool is_ta, char ***args, size_t *args_len)
        struct string_array const *config_args;
        char **copy_args;
        unsigned int i;
-       int error;
 
        config_args = config_get_rsync_args(is_ta);
        /*
@@ -258,12 +231,7 @@ prepare_rsync(struct rpki_uri *uri, bool is_ta, char ***args, size_t *args_len)
                        copy_args[i + 1] = strdup(uri_get_global(uri));
                else if (strcmp(config_args->array[i], "$LOCAL") == 0)
                        copy_args[i + 1] = strdup(uri_get_local(uri));
-               else if (strcmp(config_args->array[i], "$HTTP_MAX_FILE_SIZE") == 0) {
-                       error = uint2string(config_get_http_max_file_size(),
-                           &copy_args[i + 1]);
-                       if (error)
-                               return error;
-               } else
+               else
                        copy_args[i + 1] = strdup(config_args->array[i]);
 
                if (copy_args[i + 1] == NULL) {
index 81e102dc01cba42fedc3d31d9c0a32a01fcb0476..ad4a9efe85d212f084ddcd192fe5ae97b8176dd5 100644 (file)
@@ -16,31 +16,6 @@ state_retrieve(void)
        return NULL;
 }
 
-#define CK_STR(uint, string)                                           \
-       ck_assert_int_eq(0, uint2string(uint, &str));                   \
-       ck_assert_str_eq(string, str);                                  \
-       free(str);
-
-START_TEST(rsync_test_uint2string)
-{
-       char *str;
-
-       CK_STR(0, "0");
-       CK_STR(1, "1");
-       CK_STR(9, "9");
-       CK_STR(10, "10");
-       CK_STR(100, "100");
-       CK_STR(1000, "1000");
-       CK_STR(10000, "10000");
-       CK_STR(100000, "100000");
-       CK_STR(1000000, "1000000");
-       CK_STR(10000000, "10000000");
-       CK_STR(100000000, "100000000");
-       CK_STR(1000000000, "1000000000");
-       CK_STR(4294967295, "4294967295");
-}
-END_TEST
-
 static void
 assert_descendant(bool expected, char *ancestor, char *descendant)
 {
@@ -160,10 +135,7 @@ END_TEST
 Suite *rsync_load_suite(void)
 {
        Suite *suite;
-       TCase *core, *prefix_equals, *uri_list, *test_get_prefix;
-
-       core = tcase_create("Core");
-       tcase_add_test(core, rsync_test_uint2string);
+       TCase *prefix_equals, *uri_list, *test_get_prefix;
 
        prefix_equals = tcase_create("PrefixEquals");
        tcase_add_test(prefix_equals, rsync_test_prefix_equals);
@@ -175,7 +147,6 @@ Suite *rsync_load_suite(void)
        tcase_add_test(test_get_prefix, rsync_test_get_prefix);
 
        suite = suite_create("rsync_test()");
-       suite_add_tcase(suite, core);
        suite_add_tcase(suite, prefix_equals);
        suite_add_tcase(suite, uri_list);
        suite_add_tcase(suite, test_get_prefix);