]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Add some small fixes.
authorpcarana <pc.moreno2099@gmail.com>
Tue, 2 Jul 2019 20:12:02 +0000 (15:12 -0500)
committerpcarana <pc.moreno2099@gmail.com>
Wed, 3 Jul 2019 20:32:30 +0000 (15:32 -0500)
-Update '--tal' and '--slurm' arguments doc.
-Update '-O' level to '2'.
-Remove unnecessary parameter '*serial' on 'vrps_foreach_base_roa'.

docs/doc/usage.md
src/Makefile.am
src/config.c
src/rtr/db/vrps.c
src/rtr/db/vrps.h
src/rtr/pdu_handler.c
test/rtr/db/vrps_test.c

index 1e540058d36a3c5253f2e085d7feb2be5857213a..357f76db4ce389747a4829ea22b23d4bda63b5d8 100644 (file)
@@ -40,15 +40,13 @@ command: fort
 
 ## Syntax
 
-<!-- TODO: Update this -->
-
 ```
 {{ page.command }}
         [--help]
         [--usage]
         [--version]
         [--configuration-file=<file>]
-        [--tal=<file>]
+        [--tal=<file>|<directory>]
         [--local-repository=<directory>]
         [--sync-strategy=off|strict|root|root-except-ta]
         [--shuffle-uris]
@@ -58,7 +56,7 @@ command: fort
         [--server.port=<string>]
         [--server.backlog=<unsigned integer>]
         [--server.validation-interval=<unsigned integer>]
-        [--slurm=<string>]
+        [--slurm=<file>|<directory>]
         [--log.color-output]
         [--log.file-name-format=global-url|local-path|file-name]
         [--output.roa=<file>]
index 76913ec239b794b8cc6d804b8d4d405aa21eb391..1155489e2da9ad51f6e4c239ff3a7af36094d48e 100644 (file)
@@ -104,7 +104,7 @@ fort_SOURCES += $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS)
 fort_CFLAGS  = -Wall
 # Feel free to temporarily remove this one if you're not using gcc 7.3.0.
 #fort_CFLAGS += $(GCC_WARNS)
-fort_CFLAGS += -std=gnu11 -O0 -g $(CFLAGS_DEBUG) $(FORT_FLAGS)
+fort_CFLAGS += -std=gnu11 -O2 -g $(CFLAGS_DEBUG) $(FORT_FLAGS)
 fort_LDFLAGS = $(LDFLAGS_DEBUG)
 fort_LDADD   = ${JANSSON_LIBS}
 
index f90ac9d8ec8766559e6e9544d5589628ca63fbcc..d1440dfd2d5ba37d14282f5c025e36252f2463b9 100644 (file)
@@ -155,7 +155,7 @@ static const struct option_field options[] = {
                .type = &gt_string,
                .offset = offsetof(struct rpki_config, tal),
                .doc = "Path to the TAL file or TALs directory",
-               .arg_doc = "<file or directory>",
+               .arg_doc = "<file>|<directory>",
        }, {
                .id = 'r',
                .name = "local-repository",
@@ -194,6 +194,7 @@ static const struct option_field options[] = {
                .type = &gt_string,
                .offset = offsetof(struct rpki_config, slurm),
                .doc = "Path to the SLURM file or SLURMs directory (files must have the extension .slurm)",
+               .arg_doc = "<file>|<directory>"
        }, {
                .id = 1004,
                .name = "mode",
index 53c374d767ba98e5b7b3eb8f2f7ab7609abe4696..df75bd4dd47a362654cd7a54e0051e7b89fea248 100644 (file)
@@ -319,11 +319,9 @@ revert_base:
  * important ones are
  * 1. 0: No errors.
  * 2. -EAGAIN: No data available; database still under construction.
- *
- * TODO (whatever) @serial is a dumb hack.
  */
 int
-vrps_foreach_base_roa(vrp_foreach_cb cb, void *arg, serial_t *serial)
+vrps_foreach_base_roa(vrp_foreach_cb cb, void *arg)
 {
        int error;
 
@@ -331,12 +329,10 @@ vrps_foreach_base_roa(vrp_foreach_cb cb, void *arg, serial_t *serial)
        if (error)
                return error;
 
-       if (state.base != NULL) {
+       if (state.base != NULL)
                error = roa_table_foreach_roa(state.base, cb, arg);
-               *serial = state.next_serial - 1;
-       } else {
+       else
                error = -EAGAIN;
-       }
 
        rwlock_unlock(&lock);
 
index 86f2b2b6dea2fab360d95dd38f69cfb101b86e2c..67116c5e3f53ff8dd9df3ba67a87fe80672348c8 100644 (file)
@@ -28,7 +28,7 @@ int vrps_update(bool *);
  * been called, or while it's still building the database.
  * Handle gracefully.
  */
-int vrps_foreach_base_roa(vrp_foreach_cb, void *, serial_t *);
+int vrps_foreach_base_roa(vrp_foreach_cb, void *);
 int vrps_get_deltas_from(serial_t, serial_t *, struct deltas_db *);
 int get_last_serial_number(serial_t *);
 
index c7b272f05f62951bad257fbb39c700935cc79ace..fa5bfd4e53b3ec70b4af627190553b9294fa1cb3 100644 (file)
@@ -124,6 +124,17 @@ handle_reset_query_pdu(int fd, struct rtr_request const *request)
        args.started = false;
        args.fd = fd;
 
+       error = get_last_serial_number(&current_serial);
+       switch (error) {
+       case 0:
+               break;
+       case -EAGAIN:
+               return err_pdu_send_no_data_available(fd);
+       default:
+               err_pdu_send_internal_error(fd);
+               return error;
+       }
+
        /*
         * It's probably best not to work on a copy, because the tree is large.
         * Unfortunately, this means we'll have to encourage writer stagnation,
@@ -131,7 +142,7 @@ handle_reset_query_pdu(int fd, struct rtr_request const *request)
         * queries than reset queries.
         */
 
-       error = vrps_foreach_base_roa(send_base_roa, &args, &current_serial);
+       error = vrps_foreach_base_roa(send_base_roa, &args);
 
        /* See handle_serial_query_pdu() for some comments. */
        switch (error) {
index ab43ef22196f42b4e3f7903cdedd68d960b786bc..c61988e1172055e3fd13144b5e27732e308ad8b0 100644 (file)
@@ -178,8 +178,8 @@ check_base(serial_t expected_serial, bool const *expected_base)
        array_index i;
 
        memset(actual_base, 0, sizeof(actual_base));
-       ck_assert_int_eq(0, vrps_foreach_base_roa(vrp_check, actual_base,
-           &actual_serial));
+       ck_assert_int_eq(0, get_last_serial_number(&actual_serial));
+       ck_assert_int_eq(0, vrps_foreach_base_roa(vrp_check, actual_base));
        ck_assert_uint_eq(expected_serial, actual_serial);
        for (i = 0; i < ARRAY_LEN(actual_base); i++)
                ck_assert_uint_eq(expected_base[i], actual_base[i]);
@@ -281,7 +281,7 @@ create_deltas_0to1(struct deltas_db *deltas, serial_t *serial, bool *changed,
        /* First validation not yet performed: Tell routers to wait */
        ck_assert_int_eq(-EAGAIN, get_last_serial_number(serial));
        ck_assert_int_eq(-EAGAIN, vrps_foreach_base_roa(vrp_fail,
-           iterated_entries, serial));
+           iterated_entries));
        ck_assert_int_eq(-EAGAIN, vrps_get_deltas_from(0, serial, deltas));
 
        /* First validation: One tree, no deltas */