From: Alberto Leiva Popper Date: Fri, 29 Oct 2021 17:00:42 +0000 (-0500) Subject: rsync: Remove $HTTP_MAX_FILE_SIZE X-Git-Tag: 1.5.3~7 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ec0560c2dab963603e097af4c18a7a46720d77e;p=thirdparty%2FFORT-validator.git rsync: Remove $HTTP_MAX_FILE_SIZE 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. --- diff --git a/docs/usage.md b/docs/usage.md index 082eeb89..3f8c1c2c 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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` diff --git a/src/config.c b/src/config.c index 47f022e7..49653a1f 100644 --- a/src/config.c +++ b/src/config.c @@ -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(); diff --git a/src/rsync/rsync.c b/src/rsync/rsync.c index 3fab9f03..cfb90792 100644 --- a/src/rsync/rsync.c +++ b/src/rsync/rsync.c @@ -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(), - ©_args[i + 1]); - if (error) - return error; - } else + else copy_args[i + 1] = strdup(config_args->array[i]); if (copy_args[i + 1] == NULL) { diff --git a/test/rsync_test.c b/test/rsync_test.c index 81e102dc..ad4a9efe 100644 --- a/test/rsync_test.c +++ b/test/rsync_test.c @@ -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);