summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-08 10:17:00 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-08 10:17:00 -0400
commitf399887cfec8ddaf33cac06b2abad25a3d42aac9 (patch)
treef232f399301f68f64150d263e1b5bbd45fce6c2f
parent307008e869d3e1fc66490e49b70a0586a704f1d7 (diff)
parent2b734944af88f17dfe6ce9bf7402d6aa1211d710 (diff)
downloadtor-f399887cfec8ddaf33cac06b2abad25a3d42aac9.tar.gz
tor-f399887cfec8ddaf33cac06b2abad25a3d42aac9.zip
Merge remote-tracking branch 'mikeperry-github/bug26259'
-rw-r--r--changes/bug262594
-rw-r--r--src/or/relay.c2
-rw-r--r--src/test/test_relaycell.c7
3 files changed, 12 insertions, 1 deletions
diff --git a/changes/bug26259 b/changes/bug26259
new file mode 100644
index 0000000000..f5383dab32
--- /dev/null
+++ b/changes/bug26259
@@ -0,0 +1,4 @@
+ o Minor bugfixes (control port):
+ - Do not count 0-length RELAY_COMMAND_DATA cells as valid data in CIRC_BW
+ events. Previously, such cells were counted entirely in the OVERHEAD
+ field. Now they are not. Fixes bug 26259; bugfix on 0.3.4.1-alpha.
diff --git a/src/or/relay.c b/src/or/relay.c
index 0aa15203f3..50f59d6b99 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1556,7 +1556,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return -END_CIRC_REASON_TORPROTOCOL;
}
/* Total all valid application bytes delivered */
- if (CIRCUIT_IS_ORIGIN(circ)) {
+ if (CIRCUIT_IS_ORIGIN(circ) && rh.length > 0) {
circuit_read_valid_data(TO_ORIGIN_CIRCUIT(circ), rh.length);
}
diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c
index 1db5202739..52f4d6113e 100644
--- a/src/test/test_relaycell.c
+++ b/src/test/test_relaycell.c
@@ -233,6 +233,13 @@ test_circbw_relay(void *arg)
circ->cpath);
ASSERT_COUNTED_BW();
+ /* Empty Data cell on open connection: not counted */
+ ENTRY_TO_CONN(entryconn)->marked_for_close = 0;
+ PACK_CELL(1, RELAY_COMMAND_DATA, "");
+ connection_edge_process_relay_cell(&cell, TO_CIRCUIT(circ), edgeconn,
+ circ->cpath);
+ ASSERT_UNCOUNTED_BW();
+
/* Sendme on stream: not counted */
ENTRY_TO_CONN(entryconn)->outbuf_flushlen = 0;
PACK_CELL(1, RELAY_COMMAND_SENDME, "Data1234");