summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-24 19:35:32 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-24 19:35:32 -0400
commitb95ef19a77e2e04c740bbbe16d3b0ed7a5239aee (patch)
tree5555ffd9074588e5a9939f0d55ce5385e1ba3a00
parent594cf92498c8ea12dc0b19f743d6b88d4a98f1eb (diff)
parentf3af74ccf594c07f7edbf0bdfa576b9af21563d9 (diff)
downloadtor-b95ef19a77e2e04c740bbbe16d3b0ed7a5239aee.tar.gz
tor-b95ef19a77e2e04c740bbbe16d3b0ed7a5239aee.zip
Merge branch 'feature18329_029_squashed' into maint-0.3.2
-rw-r--r--changes/feature183292
-rw-r--r--src/test/test_config.c18
-rw-r--r--src/test/test_router.c7
3 files changed, 19 insertions, 8 deletions
diff --git a/changes/feature18329 b/changes/feature18329
index f534c76145..1dabf50244 100644
--- a/changes/feature18329
+++ b/changes/feature18329
@@ -1,4 +1,4 @@
- o Minor features:
+ o Minor features (bridge):
- Bridge relays can now set the BridgeDistribution config option to
add a "bridge-distribution-request" line to their bridge descriptor,
which tells BridgeDB how they'd like their bridge address to be
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 68eb5419cd..456d8bcc3e 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5449,7 +5449,8 @@ test_config_dup_and_filter(void *arg)
/* If we're not configured to be a bridge, but we set
* BridgeDistribution, then options_validate () should return -1. */
static void
-test_config_check_bridge_distribution_setting_not_a_bridge(void *arg) {
+test_config_check_bridge_distribution_setting_not_a_bridge(void *arg)
+{
or_options_t* options = get_options_mutable();
or_options_t* old_options = options;
or_options_t* default_options = options;
@@ -5470,7 +5471,8 @@ test_config_check_bridge_distribution_setting_not_a_bridge(void *arg) {
/* If the BridgeDistribution setting was valid, 0 should be returned. */
static void
-test_config_check_bridge_distribution_setting_valid(void *arg) {
+test_config_check_bridge_distribution_setting_valid(void *arg)
+{
int ret = check_bridge_distribution_setting("https");
(void)arg;
@@ -5482,11 +5484,16 @@ test_config_check_bridge_distribution_setting_valid(void *arg) {
/* If the BridgeDistribution setting was invalid, -1 should be returned. */
static void
-test_config_check_bridge_distribution_setting_invalid(void *arg) {
- int ret = check_bridge_distribution_setting("hyphens-are-not-allowed");
+test_config_check_bridge_distribution_setting_invalid(void *arg)
+{
+ int ret = check_bridge_distribution_setting("hyphens-are-allowed");
(void)arg;
+ tt_int_op(ret, OP_EQ, 0);
+
+ ret = check_bridge_distribution_setting("asterisks*are*forbidden");
+
tt_int_op(ret, OP_EQ, -1);
done:
return;
@@ -5495,7 +5502,8 @@ test_config_check_bridge_distribution_setting_invalid(void *arg) {
/* If the BridgeDistribution setting was unrecognised, a warning should be
* logged and 0 should be returned. */
static void
-test_config_check_bridge_distribution_setting_unrecognised(void *arg) {
+test_config_check_bridge_distribution_setting_unrecognised(void *arg)
+{
int ret = check_bridge_distribution_setting("unicorn");
(void)arg;
diff --git a/src/test/test_router.c b/src/test/test_router.c
index 64434035ef..4e96e24534 100644
--- a/src/test/test_router.c
+++ b/src/test/test_router.c
@@ -22,7 +22,8 @@ NS_DECL(const routerinfo_t *, router_get_my_routerinfo, (void));
static routerinfo_t* mock_routerinfo;
static const routerinfo_t*
-NS(router_get_my_routerinfo)(void) {
+NS(router_get_my_routerinfo)(void)
+{
crypto_pk_t* ident_key;
crypto_pk_t* tap_key;
time_t now;
@@ -57,7 +58,8 @@ NS(router_get_my_routerinfo)(void) {
/* If no distribution option was set, then check_bridge_distribution_setting()
* should have set it to "any". */
static void
-test_router_dump_router_to_string_no_bridge_distribution_method(void *arg) {
+test_router_dump_router_to_string_no_bridge_distribution_method(void *arg)
+{
const char* needle = "bridge-distribution-request any";
or_options_t* options = get_options_mutable();
routerinfo_t* router = NULL;
@@ -107,3 +109,4 @@ struct testcase_t router_tests[] = {
ROUTER_TEST(dump_router_to_string_no_bridge_distribution_method, TT_FORK),
END_OF_TESTCASES
};
+