]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Bug 40566: Unhook unused congestion control algs
authorMike Perry <mikeperry-git@torproject.org>
Mon, 26 Jun 2023 18:51:48 +0000 (18:51 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Tue, 27 Jun 2023 16:44:07 +0000 (16:44 +0000)
src/core/or/congestion_control_common.c
src/core/or/include.am

index f747987957be07d5d66df3add1f28b889214933d..2039354c1fafb366ec2b86653ec5a41a92ef3bac 100644 (file)
@@ -22,8 +22,6 @@
 #include "core/or/congestion_control_st.h"
 #include "core/or/congestion_control_common.h"
 #include "core/or/congestion_control_vegas.h"
-#include "core/or/congestion_control_nola.h"
-#include "core/or/congestion_control_westwood.h"
 #include "core/or/congestion_control_st.h"
 #include "core/or/conflux.h"
 #include "core/or/conflux_util.h"
@@ -216,6 +214,13 @@ congestion_control_new_consensus_params(const networkstatus_t *ns)
         CC_ALG_DFLT,
         CC_ALG_MIN,
         CC_ALG_MAX);
+  if (cc_alg != CC_ALG_SENDME && cc_alg != CC_ALG_VEGAS) {
+    // Does not need rate limiting because consensus updates
+    // are at most 1x/hour
+    log_warn(LD_BUG, "Unsupported congestion control algorithm %d",
+               cc_alg);
+    cc_alg = CC_ALG_DFLT;
+  }
 
 #define BWE_SENDME_MIN_MIN 2
 #define BWE_SENDME_MIN_MAX (20)
@@ -316,37 +321,19 @@ congestion_control_init_params(congestion_control_t *cc,
     cc->cc_alg = cc_alg;
   }
 
-  bdp_alg_t default_bdp_alg = 0;
-
-  switch (cc->cc_alg) {
-    case CC_ALG_WESTWOOD:
-      default_bdp_alg = WESTWOOD_BDP_ALG;
-      break;
-    case CC_ALG_VEGAS:
-      default_bdp_alg = VEGAS_BDP_MIX_ALG;
-      break;
-    case CC_ALG_NOLA:
-      default_bdp_alg = NOLA_BDP_ALG;
-      break;
-    case CC_ALG_SENDME:
-    default:
-      tor_fragile_assert();
-      return; // No alg-specific params
-  }
-
   cc->bdp_alg =
     networkstatus_get_param(NULL, "cc_bdp_alg",
-        default_bdp_alg,
+        VEGAS_BDP_MIX_ALG,
         0,
         NUM_BDP_ALGS-1);
 
   /* Algorithm-specific parameters */
-  if (cc->cc_alg == CC_ALG_WESTWOOD) {
-    congestion_control_westwood_set_params(cc);
-  } else if (cc->cc_alg == CC_ALG_VEGAS) {
+  if (cc->cc_alg == CC_ALG_VEGAS) {
     congestion_control_vegas_set_params(cc, path);
-  } else if (cc->cc_alg == CC_ALG_NOLA) {
-    congestion_control_nola_set_params(cc);
+  } else {
+    // This should not happen anymore
+    log_warn(LD_BUG, "Unknown congestion control algorithm %d",
+             cc->cc_alg);
   }
 }
 
@@ -1203,23 +1190,9 @@ congestion_control_dispatch_cc_alg(congestion_control_t *cc,
                                    const crypt_path_t *layer_hint)
 {
   int ret = -END_CIRC_REASON_INTERNAL;
-  switch (cc->cc_alg) {
-    case CC_ALG_WESTWOOD:
-      ret = congestion_control_westwood_process_sendme(cc, circ, layer_hint);
-      break;
-
-    case CC_ALG_VEGAS:
-      ret = congestion_control_vegas_process_sendme(cc, circ, layer_hint);
-      break;
 
-    case CC_ALG_NOLA:
-      ret = congestion_control_nola_process_sendme(cc, circ, layer_hint);
-      break;
-
-    case CC_ALG_SENDME:
-    default:
-      tor_assert(0);
-  }
+  tor_assert_nonfatal_once(cc->cc_alg == CC_ALG_VEGAS);
+  ret = congestion_control_vegas_process_sendme(cc, circ, layer_hint);
 
   if (cc->cwnd > cwnd_max) {
     static ratelim_t cwnd_limit = RATELIM_INIT(60);
index 12456b98dd7355d0105fbe96861d4f87e71f6f18..d0dffd5d3b90260af4fbc7bba41f9e8f9dd731bc 100644 (file)
@@ -36,8 +36,6 @@ LIBTOR_APP_A_SOURCES +=                               \
        src/core/or/sendme.c                    \
        src/core/or/congestion_control_common.c                 \
        src/core/or/congestion_control_vegas.c                  \
-       src/core/or/congestion_control_nola.c                   \
-       src/core/or/congestion_control_westwood.c                       \
        src/core/or/congestion_control_flow.c                   \
        src/core/or/conflux.c                   \
        src/core/or/conflux_cell.c                      \
@@ -112,8 +110,6 @@ noinst_HEADERS +=                                   \
        src/core/or/congestion_control_flow.h                           \
        src/core/or/congestion_control_common.h                         \
        src/core/or/congestion_control_vegas.h                          \
-       src/core/or/congestion_control_nola.h                           \
-       src/core/or/congestion_control_westwood.h                               \
        src/core/or/conflux.h                           \
        src/core/or/conflux_cell.h                      \
        src/core/or/conflux_params.h                    \