]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Temporary tweaks in hopes of locally reproducing #46 issue46
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 6 Mar 2021 00:18:38 +0000 (18:18 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 6 Mar 2021 00:22:10 +0000 (18:22 -0600)
The stack traces are not making much sense.
This disables all optimizations and prints extra garbage.
Not meant to be run in production.

src/Makefile.am
src/rtr/db/db_table.c

index ccf10fc8cd31415b06ac5dd4b3c289c34baddc11..1eb7f2dfe61483a4903c822e37d29c2cc2c5640b 100644 (file)
@@ -123,7 +123,7 @@ fort_SOURCES += $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS)
 fort_CFLAGS  = -Wall -Wno-cpp
 # Feel free to temporarily remove this one if you're not using gcc 7.3.0.
 #fort_CFLAGS += $(GCC_WARNS)
-fort_CFLAGS += -std=gnu11 -O2 -g $(FORT_FLAGS) ${XML2_CFLAGS}
+fort_CFLAGS += -std=gnu11 -O0 -g $(FORT_FLAGS) ${XML2_CFLAGS}
 fort_LDFLAGS = $(LDFLAGS_DEBUG)
 fort_LDADD   = ${JANSSON_LIBS} ${CURL_LIBS} ${XML2_LIBS}
 
index 9e86db20a99a4df535b15df7d19e20a98315a539..b068dd35fa0aa515c06dbba9b476cb5ed9ce96a8 100644 (file)
@@ -90,10 +90,14 @@ create_roa(uint32_t asn, uint8_t max_length)
 {
        struct hashable_roa *roa;
 
+       fprintf(stderr, "a");
        roa = malloc(sizeof(struct hashable_roa));
-       if (roa == NULL)
+       if (roa == NULL) {
+               fprintf(stderr, "b");
                return NULL;
+       }
        /* Needed by uthash */
+       fprintf(stderr, "c");
        memset(roa, 0, sizeof(struct hashable_roa));
 
        roa->data.asn = asn;
@@ -107,13 +111,20 @@ add_roa(struct db_table *table, struct hashable_roa *new)
 {
        struct hashable_roa *old;
 
+       fprintf(stderr, "h");
        errno = 0;
        HASH_REPLACE(hh, table->roas, data, sizeof(new->data), new, old);
-       if (errno)
+       fprintf(stderr, "i");
+       if (errno) {
+               fprintf(stderr, "j");
                return -pr_val_errno(errno, "ROA couldn't be added to hash table");
-       if (old != NULL)
+       }
+       if (old != NULL) {
+               fprintf(stderr, "k");
                free(old);
+       }
 
+       fprintf(stderr, "l");
        return 0;
 }
 
@@ -251,16 +262,26 @@ rtrhandler_handle_roa_v4(struct db_table *table, uint32_t asn,
        struct hashable_roa *roa;
        int error;
 
+       fprintf(stderr, "\n{");
        roa = create_roa(asn, max_length);
-       if (roa == NULL)
+       fprintf(stderr, "d");
+       if (roa == NULL) {
+               fprintf(stderr, "e}");
                return pr_enomem();
+       }
+       fprintf(stderr, "f");
        roa->data.prefix.v4 = prefix4->addr;
        roa->data.prefix_length = prefix4->len;
        roa->data.addr_fam = AF_INET;
 
+       fprintf(stderr, "g");
        error = add_roa(table, roa);
-       if (error)
+       if (error) {
+               fprintf(stderr, "m");
                free(roa);
+       }
+
+       fprintf(stderr, "n}");
        return error;
 }