From 2b146bdb9af55931aa7cbabc6009d0f66142a0d8 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Fri, 21 Sep 2018 19:23:19 +0300 Subject: [PATCH 1/3] Refrain from using SMARTLIST_DEL_CURRENT in retry_all_listeners --- src/core/mainloop/connection.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index d8326a5be8..5ef140b6b3 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -2900,9 +2900,6 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol) "(replaced by %s:%d)", conn_type_to_string(old_conn->type), old_conn->address, old_conn->port, new_conn->address, new_conn->port); - - tor_free(r); - SMARTLIST_DEL_CURRENT(replacements, r); } SMARTLIST_FOREACH_END(r); #endif From 9d886185c1783cb16a4bc94cf12f78481d5b985d Mon Sep 17 00:00:00 2001 From: rl1987 Date: Wed, 3 Oct 2018 15:45:48 +0300 Subject: [PATCH 2/3] Make sure we're removing conn from old_conns *once* --- src/core/mainloop/connection.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 5ef140b6b3..ef8c60a3da 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -2762,6 +2762,11 @@ retry_listener_ports(smartlist_t *old_conns, const port_cfg_t *found_port = NULL; /* Okay, so this is a listener. Is it configured? */ + /* That is, is it either: 1) exact match - address and port + * pair match exactly between old listener and new port; or 2) + * wildcard match - port matches exactly, but *one* of the + * addresses is wildcard (0.0.0.0 or ::)? + */ SMARTLIST_FOREACH_BEGIN(launch, const port_cfg_t *, wanted) { if (conn->type != wanted->type) continue; @@ -2805,6 +2810,7 @@ retry_listener_ports(smartlist_t *old_conns, SMARTLIST_DEL_CURRENT(launch, wanted); SMARTLIST_DEL_CURRENT(old_conns, conn); + break; } #endif } From fb1d37f34f0f3fcd6c5124834e0f3abb8159311e Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 7 Oct 2018 18:28:04 +0300 Subject: [PATCH 3/3] Add changes file --- changes/bug27808 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/bug27808 diff --git a/changes/bug27808 b/changes/bug27808 new file mode 100644 index 0000000000..90d3c9e0a4 --- /dev/null +++ b/changes/bug27808 @@ -0,0 +1,4 @@ + o Minor bugfixes (networking): + - In retry_listeners_ports() make sure that we're removing + a member of old_conns smartlist at most once. + Fixes bug 27808; bugfix on 0.3.5.1-alpha.