diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-12-06 00:21:24 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-03 11:29:47 -0500 |
commit | 5c68a1efaa9511baf2a2af0a49946e0a2de9e246 (patch) | |
tree | 2412460c251075f029c0d878dcf87bc2e97c3a15 /src/or/onion.c | |
parent | 1ed4786dba8912ab7a6eb16adf7554cf9a5c1ed1 (diff) | |
download | tor-5c68a1efaa9511baf2a2af0a49946e0a2de9e246.tar.gz tor-5c68a1efaa9511baf2a2af0a49946e0a2de9e246.zip |
Don't check create cells too much when we're relaying them
We want to sanity-check our own create cells carefully, and other
people's loosely.
Diffstat (limited to 'src/or/onion.c')
-rw-r--r-- | src/or/onion.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/or/onion.c b/src/or/onion.c index 753ddcff77..b42a66c5a8 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -808,13 +808,14 @@ extended_cell_parse(extended_cell_t *cell_out, /** Fill <b>cell_out</b> with a correctly formatted version of the * CREATE{,_FAST,2} cell in <b>cell_in</b>. Return 0 on success, -1 on - * failure. */ -int -create_cell_format(cell_t *cell_out, const create_cell_t *cell_in) + * failure. This is a cell we didn't originate if <b>relayed</b> is true. */ +static int +create_cell_format_impl(cell_t *cell_out, const create_cell_t *cell_in, + int relayed) { uint8_t *p; size_t space; - if (check_create_cell(cell_in, 0) < 0) + if (check_create_cell(cell_in, relayed) < 0) return -1; memset(cell_out->payload, 0, sizeof(cell_out->payload)); @@ -848,6 +849,18 @@ create_cell_format(cell_t *cell_out, const create_cell_t *cell_in) return 0; } +int +create_cell_format(cell_t *cell_out, const create_cell_t *cell_in) +{ + return create_cell_format_impl(cell_out, cell_in, 0); +} + +int +create_cell_format_relayed(cell_t *cell_out, const create_cell_t *cell_in) +{ + return create_cell_format_impl(cell_out, cell_in, 1); +} + /** Fill <b>cell_out</b> with a correctly formatted version of the * CREATED{,_FAST,2} cell in <b>cell_in</b>. Return 0 on success, -1 on * failure. */ |