From 3edeac9abf86578e5d052d26aed54abcce97f2fe Mon Sep 17 00:00:00 2001 From: Alberto Leiva Popper Date: Fri, 5 Mar 2021 18:18:38 -0600 Subject: [PATCH] Temporary tweaks in hopes of locally reproducing #46 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 | 2 +- src/rtr/db/db_table.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index ccf10fc8..1eb7f2df 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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} diff --git a/src/rtr/db/db_table.c b/src/rtr/db/db_table.c index 9e86db20..b068dd35 100644 --- a/src/rtr/db/db_table.c +++ b/src/rtr/db/db_table.c @@ -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; } -- 2.47.2