[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #7952 [Tor]: Control port method to get the exit policy
#7952: Control port method to get the exit policy
----------------------------+-----------------------------------------------
Reporter: atagar | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Tor: 0.2.4.x-final
Component: Tor | Version:
Keywords: tor-relay easy | Parent:
Points: | Actualpoints:
----------------------------+-----------------------------------------------
Comment(by arma):
Here's the code from router_dump_router_to_string() that generates the
string:
{{{
int i;
for (i = 0; i < smartlist_len(router->exit_policy); ++i) {
addr_policy_t *tmpe = smartlist_get(router->exit_policy, i);
if (tor_addr_family(&tmpe->addr) == AF_INET6)
continue; /* Don't include IPv6 parts of address policy */
result = policy_write_item(s+written, maxlen-written, tmpe, 1);
if (result < 0) {
log_warn(LD_BUG,"descriptor policy_write_item ran out of room!");
return -1;
}
tor_assert(result == (int)strlen(s+written));
written += result;
if (written+2 > maxlen) {
log_warn(LD_BUG,"descriptor policy_write_item ran out of room
(2)!");
return -1;
}
s[written++] = '\n';
}
}}}
It would be smart to break that into its own function, so it can be called
from that function and also from control.c.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7952#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs