]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'ticket20895'
authorNick Mathewson <nickm@torproject.org>
Thu, 9 Nov 2017 14:17:53 +0000 (09:17 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 9 Nov 2017 14:17:53 +0000 (09:17 -0500)
1  2 
src/or/circuitbuild.c
src/or/connection_or.c
src/or/dirserv.c
src/or/hs_service.c
src/or/nodelist.c
src/or/nodelist.h
src/or/or.h
src/or/protover.c
src/or/protover.h
src/or/routerparse.c
src/test/test_protover.c

Simple merge
Simple merge
Simple merge
index a2082b39142a7239ef19865d4949825962fcbb85,5ae7614e2963ac24e0d3400bbb9cf86fdff1dfc4..8e2f52dcf01affb7656da43689b1c54e81ce4840
@@@ -1572,12 -1494,8 +1572,12 @@@ pick_intro_point(unsigned int direct_co
    /* Let's do a basic sanity check here so that we don't end up advertising the
     * ed25519 identity key of relays that don't actually support the link
     * protocol */
-   if (!node_supports_ed25519_link_authentication(node)) {
+   if (!node_supports_ed25519_link_authentication(node, 0)) {
      tor_assert_nonfatal(ed25519_public_key_is_zero(&info->ed_identity));
 +  } else {
 +    /* Make sure we *do* have an ed key if we support the link authentication.
 +     * Sending an empty key would result in a failure to extend. */
 +    tor_assert_nonfatal(!ed25519_public_key_is_zero(&info->ed_identity));
    }
  
    /* Create our objects and populate them with the node information. */
Simple merge
Simple merge
diff --cc src/or/or.h
Simple merge
Simple merge
Simple merge
Simple merge
index 9ae907183b4ac100a783a4cdc6c4c6871cc8e4f6,874b3154909b73f4ae828bc8fed3260e5aa2f46f..6865362115d54738454f3b474af2b4ee84d6044d
@@@ -195,32 -182,35 +195,61 @@@ test_protover_all_supported(void *arg
    tor_free(msg);
  }
  
 +static void
 +test_protover_list_supports_protocol_returns_true(void *arg)
 +{
 +  (void)arg;
 +
 +  const char *protocols = "Link=1";
 +  int is_supported = protocol_list_supports_protocol(protocols, PRT_LINK, 1);
 +  tt_int_op(is_supported, OP_EQ, 1);
 +
 + done:
 +  ;
 +}
 +
 +static void
 +test_protover_list_supports_protocol_for_unsupported_returns_false(void *arg)
 +{
 +  (void)arg;
 +
 +  const char *protocols = "Link=1";
 +  int is_supported = protocol_list_supports_protocol(protocols, PRT_LINK, 10);
 +  tt_int_op(is_supported, OP_EQ, 0);
 +
 + done:
 +  ;
 +}
 +
+ static void
+ test_protover_supports_version(void *arg)
+ {
+   (void)arg;
+   tt_assert(protocol_list_supports_protocol("Link=3-6", PRT_LINK, 3));
+   tt_assert(protocol_list_supports_protocol("Link=3-6", PRT_LINK, 6));
+   tt_assert(!protocol_list_supports_protocol("Link=3-6", PRT_LINK, 7));
+   tt_assert(!protocol_list_supports_protocol("Link=3-6", PRT_LINKAUTH, 3));
+   tt_assert(!protocol_list_supports_protocol("Link=4-6 LinkAuth=3",
+                                             PRT_LINKAUTH, 2));
+   tt_assert(protocol_list_supports_protocol("Link=4-6 LinkAuth=3",
+                                             PRT_LINKAUTH, 3));
+   tt_assert(!protocol_list_supports_protocol("Link=4-6 LinkAuth=3",
+                                              PRT_LINKAUTH, 4));
+   tt_assert(!protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3",
+                                              PRT_LINKAUTH, 4));
+   tt_assert(protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3",
+                                              PRT_LINKAUTH, 3));
+   tt_assert(protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3",
+                                              PRT_LINKAUTH, 2));
+   tt_assert(!protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3",
+                                                       PRT_DESC, 2));
+  done:
+  ;
+ }
  #define PV_TEST(name, flags)                       \
    { #name, test_protover_ ##name, (flags), NULL, NULL }
  
@@@ -229,8 -219,7 +258,9 @@@ struct testcase_t protover_tests[] = 
    PV_TEST(parse_fail, 0),
    PV_TEST(vote, 0),
    PV_TEST(all_supported, 0),
 +  PV_TEST(list_supports_protocol_for_unsupported_returns_false, 0),
 +  PV_TEST(list_supports_protocol_returns_true, 0),
+   PV_TEST(supports_version, 0),
    END_OF_TESTCASES
  };