summaryrefslogtreecommitdiff
path: root/src/trunnel
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-08-12 11:59:51 -0400
committerGeorge Kadianakis <desnacked@riseup.net>2019-08-26 15:53:46 +0300
commitd692c5fd0368da79f83307f6f023ae5793472e1a (patch)
tree13c27ca06b30caa7ab1a8a6a7240db1255a71c7f /src/trunnel
parent7faf10495fa50528fc8a9c45e729b9bc284fab19 (diff)
downloadtor-d692c5fd0368da79f83307f6f023ae5793472e1a.tar.gz
tor-d692c5fd0368da79f83307f6f023ae5793472e1a.zip
hs-v3: Encode DoS ESTABLISH_INTRO cell extension
This commit makes tor add the DoS cell extension to the ESTABLISH_INTRO cell if the defense is enabled on the service side with a torrc option. Furthermore, the cell extension is only added if the introduction point supports it. The protover version HSIntro=5 is looked for. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/trunnel')
-rw-r--r--src/trunnel/hs/cell_establish_intro.h2
-rw-r--r--src/trunnel/hs/cell_establish_intro.trunnel4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/trunnel/hs/cell_establish_intro.h b/src/trunnel/hs/cell_establish_intro.h
index cc3797fc99..1924d9cab6 100644
--- a/src/trunnel/hs/cell_establish_intro.h
+++ b/src/trunnel/hs/cell_establish_intro.h
@@ -11,6 +11,8 @@
struct trn_cell_extension_st;
#define TRUNNEL_SHA3_256_LEN 32
#define TRUNNEL_CELL_EXTENSION_TYPE_DOS 1
+#define TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC 1
+#define TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC 2
#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_DOS_PARAM)
struct trn_cell_extension_dos_param_st {
uint8_t type;
diff --git a/src/trunnel/hs/cell_establish_intro.trunnel b/src/trunnel/hs/cell_establish_intro.trunnel
index 08a110953c..e30938f6c2 100644
--- a/src/trunnel/hs/cell_establish_intro.trunnel
+++ b/src/trunnel/hs/cell_establish_intro.trunnel
@@ -46,6 +46,10 @@ struct trn_cell_intro_established {
const TRUNNEL_CELL_EXTENSION_TYPE_DOS = 0x01;
+/* DoS Parameter types. */
+const TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC = 0x01;
+const TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC = 0x02;
+
/*
* DoS Parameters Extension. See proposal 305 for more details.
*/