aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/sendme.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-01-09 12:02:01 -0500
committerDavid Goulet <dgoulet@torproject.org>2019-04-29 12:17:57 -0400
commitc38d46bf4adf4107d39a2ce46aeacb630f3f112a (patch)
tree6c2630c98b68825043d39c62e80946669ecc8344 /src/core/or/sendme.c
parent0e6e800c89c7cfef255491179473e13de5f72d03 (diff)
downloadtor-c38d46bf4adf4107d39a2ce46aeacb630f3f112a.tar.gz
tor-c38d46bf4adf4107d39a2ce46aeacb630f3f112a.zip
prop289: Add two consensus parameters
In order to be able to deploy the authenticated SENDMEs, these two consensus parameters are needed to control the minimum version that we can emit and accept. See section 4 in prop289 for more details. Note that at this commit, the functions that return the values aren't used so compilation fails if warnings are set to errors. Closes #26842 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/sendme.c')
-rw-r--r--src/core/or/sendme.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/or/sendme.c b/src/core/or/sendme.c
index d7feb6bfc6..bba760ae98 100644
--- a/src/core/or/sendme.c
+++ b/src/core/or/sendme.c
@@ -15,6 +15,39 @@
#include "core/or/circuituse.h"
#include "core/or/relay.h"
#include "core/or/sendme.h"
+#include "feature/nodelist/networkstatus.h"
+
+/* The cell version constants for when emitting a cell. */
+#define SENDME_EMIT_MIN_VERSION_DEFAULT 0
+#define SENDME_EMIT_MIN_VERSION_MIN 0
+#define SENDME_EMIT_MIN_VERSION_MAX UINT8_MAX
+
+/* The cell version constants for when accepting a cell. */
+#define SENDME_ACCEPT_MIN_VERSION_DEFAULT 0
+#define SENDME_ACCEPT_MIN_VERSION_MIN 0
+#define SENDME_ACCEPT_MIN_VERSION_MAX UINT8_MAX
+
+/* Return the minimum version given by the consensus (if any) that should be
+ * used when emitting a SENDME cell. */
+static int
+get_emit_min_version(void)
+{
+ return networkstatus_get_param(NULL, "sendme_emit_min_version",
+ SENDME_EMIT_MIN_VERSION_DEFAULT,
+ SENDME_EMIT_MIN_VERSION_MIN,
+ SENDME_EMIT_MIN_VERSION_MAX);
+}
+
+/* Return the minimum version given by the consensus (if any) that should be
+ * accepted when receiving a SENDME cell. */
+static int
+get_accept_min_version(void)
+{
+ return networkstatus_get_param(NULL, "sendme_accept_min_version",
+ SENDME_ACCEPT_MIN_VERSION_DEFAULT,
+ SENDME_ACCEPT_MIN_VERSION_MIN,
+ SENDME_ACCEPT_MIN_VERSION_MAX);
+}
/** Called when we've just received a relay data cell, when we've just
* finished flushing all bytes to stream <b>conn</b>, or when we've flushed