mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Merge branch 'tor-gitlab/mr/49'
This commit is contained in:
commit
c53c0e82b4
@ -36,8 +36,8 @@ STATIC const char *
|
|||||||
format_node_description(char *buf,
|
format_node_description(char *buf,
|
||||||
const char *id_digest,
|
const char *id_digest,
|
||||||
const char *nickname,
|
const char *nickname,
|
||||||
const tor_addr_t *ipv6_addr,
|
const tor_addr_t *ipv4_addr,
|
||||||
const tor_addr_t *ipv4_addr)
|
const tor_addr_t *ipv6_addr)
|
||||||
{
|
{
|
||||||
size_t rv = 0;
|
size_t rv = 0;
|
||||||
bool has_ipv6 = ipv6_addr && !tor_addr_is_null(ipv6_addr);
|
bool has_ipv6 = ipv6_addr && !tor_addr_is_null(ipv6_addr);
|
||||||
@ -129,8 +129,8 @@ router_describe(const routerinfo_t *ri)
|
|||||||
return format_node_description(buf,
|
return format_node_description(buf,
|
||||||
ri->cache_info.identity_digest,
|
ri->cache_info.identity_digest,
|
||||||
ri->nickname,
|
ri->nickname,
|
||||||
&ri->ipv6_addr,
|
&ri->ipv4_addr,
|
||||||
&ri->ipv4_addr);
|
&ri->ipv6_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a human-readable description of the node_t <b>node</b>.
|
/** Return a human-readable description of the node_t <b>node</b>.
|
||||||
@ -169,8 +169,8 @@ node_describe(const node_t *node)
|
|||||||
return format_node_description(buf,
|
return format_node_description(buf,
|
||||||
node->identity,
|
node->identity,
|
||||||
nickname,
|
nickname,
|
||||||
ipv6_addr,
|
ipv4_addr,
|
||||||
ipv4_addr);
|
ipv6_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a human-readable description of the routerstatus_t <b>rs</b>.
|
/** Return a human-readable description of the routerstatus_t <b>rs</b>.
|
||||||
@ -189,8 +189,8 @@ routerstatus_describe(const routerstatus_t *rs)
|
|||||||
return format_node_description(buf,
|
return format_node_description(buf,
|
||||||
rs->identity_digest,
|
rs->identity_digest,
|
||||||
rs->nickname,
|
rs->nickname,
|
||||||
&rs->ipv6_addr,
|
&rs->ipv4_addr,
|
||||||
&rs->ipv4_addr);
|
&rs->ipv6_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a human-readable description of the extend_info_t <b>ei</b>.
|
/** Return a human-readable description of the extend_info_t <b>ei</b>.
|
||||||
@ -214,8 +214,8 @@ extend_info_describe(const extend_info_t *ei)
|
|||||||
return format_node_description(buf,
|
return format_node_description(buf,
|
||||||
ei->identity_digest,
|
ei->identity_digest,
|
||||||
ei->nickname,
|
ei->nickname,
|
||||||
addr6,
|
addr4,
|
||||||
addr4);
|
addr6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set <b>buf</b> (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the
|
/** Set <b>buf</b> (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the
|
||||||
|
@ -49,8 +49,8 @@ void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
|
|||||||
STATIC const char *format_node_description(char *buf,
|
STATIC const char *format_node_description(char *buf,
|
||||||
const char *id_digest,
|
const char *id_digest,
|
||||||
const char *nickname,
|
const char *nickname,
|
||||||
const tor_addr_t *ipv6_addr,
|
const tor_addr_t *ipv4_addr,
|
||||||
const tor_addr_t *ipv4_addr);
|
const tor_addr_t *ipv6_addr);
|
||||||
|
|
||||||
#endif /* defined(TOR_UNIT_TESTS) */
|
#endif /* defined(TOR_UNIT_TESTS) */
|
||||||
|
|
||||||
|
@ -703,8 +703,8 @@ test_nodelist_format_node_description(void *arg)
|
|||||||
rv = format_node_description(ndesc,
|
rv = format_node_description(ndesc,
|
||||||
mock_digest,
|
mock_digest,
|
||||||
mock_nickname,
|
mock_nickname,
|
||||||
&mock_null_ip,
|
NULL,
|
||||||
NULL);
|
&mock_null_ip);
|
||||||
tt_ptr_op(rv, OP_EQ, ndesc);
|
tt_ptr_op(rv, OP_EQ, ndesc);
|
||||||
tt_str_op(ndesc, OP_EQ,
|
tt_str_op(ndesc, OP_EQ,
|
||||||
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789");
|
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789");
|
||||||
@ -722,8 +722,8 @@ test_nodelist_format_node_description(void *arg)
|
|||||||
rv = format_node_description(ndesc,
|
rv = format_node_description(ndesc,
|
||||||
mock_digest,
|
mock_digest,
|
||||||
mock_nickname,
|
mock_nickname,
|
||||||
&mock_ipv6,
|
NULL,
|
||||||
NULL);
|
&mock_ipv6);
|
||||||
tt_ptr_op(rv, OP_EQ, ndesc);
|
tt_ptr_op(rv, OP_EQ, ndesc);
|
||||||
tt_str_op(ndesc, OP_EQ,
|
tt_str_op(ndesc, OP_EQ,
|
||||||
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 at "
|
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 at "
|
||||||
@ -732,18 +732,18 @@ test_nodelist_format_node_description(void *arg)
|
|||||||
rv = format_node_description(ndesc,
|
rv = format_node_description(ndesc,
|
||||||
mock_digest,
|
mock_digest,
|
||||||
mock_nickname,
|
mock_nickname,
|
||||||
&mock_ipv6,
|
&mock_ipv4,
|
||||||
&mock_ipv4);
|
&mock_ipv6);
|
||||||
tt_ptr_op(rv, OP_EQ, ndesc);
|
tt_ptr_op(rv, OP_EQ, ndesc);
|
||||||
tt_str_op(ndesc, OP_EQ,
|
tt_str_op(ndesc, OP_EQ,
|
||||||
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 at "
|
"$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~TestOR7890123456789 at "
|
||||||
"111.222.233.244 and [1111:2222:3333:4444:5555:6666:7777:8888]");
|
"111.222.233.244 and [1111:2222:3333:4444:5555:6666:7777:8888]");
|
||||||
|
|
||||||
/* test NULL handling */
|
/* test NULL handling */
|
||||||
rv = format_node_description(NULL, NULL, NULL, NULL, 0);
|
rv = format_node_description(NULL, NULL, NULL, NULL, NULL);
|
||||||
tt_str_op(rv, OP_EQ, "<NULL BUFFER>");
|
tt_str_op(rv, OP_EQ, "<NULL BUFFER>");
|
||||||
|
|
||||||
rv = format_node_description(ndesc, NULL, NULL, NULL, 0);
|
rv = format_node_description(ndesc, NULL, NULL, NULL, NULL);
|
||||||
tt_ptr_op(rv, OP_EQ, ndesc);
|
tt_ptr_op(rv, OP_EQ, ndesc);
|
||||||
tt_str_op(rv, OP_EQ, "<NULL ID DIGEST>");
|
tt_str_op(rv, OP_EQ, "<NULL ID DIGEST>");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user