tor_free(canonical_family);
}
+ if (consensus_method >= MIN_METHOD_FOR_FAMILY_IDS &&
+ ri->family_ids && smartlist_len(ri->family_ids)) {
+ char *family_ids = smartlist_join_strings(ri->family_ids, " ", 0, NULL);
+ smartlist_add_asprintf(chunks, "family-ids %s\n", family_ids);
+ tor_free(family_ids);
+ }
+
if (summary && strcmp(summary, "reject 1-65535"))
smartlist_add_asprintf(chunks, "p %s\n", summary);
int high;
} microdesc_consensus_methods[] = {
{MIN_SUPPORTED_CONSENSUS_METHOD,
+ MIN_METHOD_FOR_FAMILY_IDS - 1},
+ {MIN_METHOD_FOR_FAMILY_IDS,
MAX_SUPPORTED_CONSENSUS_METHOD},
{-1, -1}
};
#define MIN_SUPPORTED_CONSENSUS_METHOD 32
/** The highest consensus method that we currently support. */
-#define MAX_SUPPORTED_CONSENSUS_METHOD 34
+#define MAX_SUPPORTED_CONSENSUS_METHOD 35
/**
* Lowest consensus method for which we suppress the published time in
**/
#define MIN_METHOD_TO_OMIT_PACKAGE_FINGERPRINTS 34
+/**
+ * Lowest supported consensus method for which we include `family-ids`
+ * in microdescs.
+ */
+#define MIN_METHOD_FOR_FAMILY_IDS 35
+
/** Default bandwidth to clip unmeasured bandwidths to using method >=
* MIN_METHOD_TO_CLIP_UNMEASURED_BW. (This is not a consensus method; do not
* get confused with the above macros.) */
"p accept 1-65535\n"
"id ed25519 J5lkRqyL6qW+CpN3E4RIlgJZeLgwjtmOOrjZvVhuwLQ\n";
+static const char test_md2_withfamilyids_35[] =
+ "onion-key\n"
+ "-----BEGIN RSA PUBLIC KEY-----\n"
+ "MIGJAoGBAMvEJ/JVNK7I38PPWhQMuCgkET/ki4WIas4tj5Kmqfb9kHqxMR+EunRD\n"
+ "83k4pel1yB7QdV+iTd/4SZOI8RpZP+BO1KnOTWfpztAU1lDGr19/PwdwcHaILpBD\n"
+ "nNzm6otk4/bKUQ0vqpOfJljtg0DfAm4uMAQ6BMFy6uEAF7+JupuPAgMBAAE=\n"
+ "-----END RSA PUBLIC KEY-----\n"
+ "ntor-onion-key FChIfm77vrWB7JsxQ+jMbN6VSSp1P0DYbw/2aqey4iA\n"
+ "family !Strange $D219590AC9513BCDEBBA9AB721007A4CC01BBAE3 othernode\n"
+ "family-ids "
+ "ed25519:YWxsIGhhcHB5IGZhbWlsaWVzIGFyZSBhbGlrZSAtTFQ "
+ "rlwe:0YHRh9Cw0YHRgtC70LjQstGL0LUg0YHQtdC80YzQuC0\n"
+ "p accept 1-65535\n"
+ "id ed25519 J5lkRqyL6qW+CpN3E4RIlgJZeLgwjtmOOrjZvVhuwLQ\n";
+
static void
test_md_generate(void *arg)
{
md = dirvote_create_microdescriptor(ri, 33);
tt_str_op(md->body, OP_EQ, test_md2_withfamily_33);
+ // Try family-ids.
+ microdesc_free(md);
+ ri->family_ids = smartlist_new();
+ smartlist_add_strdup(ri->family_ids,
+ "ed25519:YWxsIGhhcHB5IGZhbWlsaWVzIGFyZSBhbGlrZSAtTFQ");
+ smartlist_add_strdup(ri->family_ids,
+ "rlwe:0YHRh9Cw0YHRgtC70LjQstGL0LUg0YHQtdC80YzQuC0");
+ md = dirvote_create_microdescriptor(ri, 35);
+ tt_str_op(md->body, OP_EQ, test_md2_withfamilyids_35);
+
done:
microdesc_free(md);
routerinfo_free(ri);