From: pcarana Date: Tue, 15 Oct 2019 22:21:09 +0000 (-0500) Subject: Handle empty DB scenario and avoid error on Reset Query PDU received X-Git-Tag: v1.1.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=181a2be356e676669f930e79029686c4f3a1418f;p=thirdparty%2FFORT-validator.git Handle empty DB scenario and avoid error on Reset Query PDU received --- diff --git a/src/rtr/db/vrps.c b/src/rtr/db/vrps.c index 4279f14d..9d5dd0b1 100644 --- a/src/rtr/db/vrps.c +++ b/src/rtr/db/vrps.c @@ -321,6 +321,12 @@ vrps_update(bool *changed) goto revert_base; } } else { + /* There's also an empty base, don't alter state */ + if (db_table_roa_count(new_base) + + db_table_router_key_count(new_base) == 0) { + rwlock_unlock(&state_lock); + return 0; + } error = create_empty_delta(&deltas); if (error) { rwlock_unlock(&state_lock); diff --git a/src/rtr/pdu_handler.c b/src/rtr/pdu_handler.c index 5e3d4b6c..f8350465 100644 --- a/src/rtr/pdu_handler.c +++ b/src/rtr/pdu_handler.c @@ -174,6 +174,12 @@ handle_reset_query_pdu(int fd, struct rtr_request const *request) /* See handle_serial_query_pdu() for some comments. */ switch (error) { case 0: + /* Assure that cache response is (or was) sent */ + if (args.started) + break; + error = send_cache_response_pdu(fd, args.version); + if (error) + return error; break; case -EAGAIN: return err_pdu_send_no_data_available(fd, args.version);