[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #33618 [Core Tor/Tor]: Add IPv6 Support to is_local_addr()
#33618: Add IPv6 Support to is_local_addr()
------------------------------------------+--------------------------------
Reporter: kimimaro | Owner: (none)
Type: enhancement | Status: new
Priority: Medium | Milestone: Tor:
| 0.4.4.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: outreachy-ipv6 ipv6 prop312 | Actual Points:
Parent ID: | Points: 1
Reviewer: | Sponsor: Sponsor55-can
------------------------------------------+--------------------------------
Comment (by kimimaro):
{{{
// includes
#include "feature/relay/router.h"
#include "feature/nodelist/routerinfo_st.h"
// modified function
/** Return true iff <b>addr</b> is judged to be on the same network as us,
or
* on a private network.
*/
MOCK_IMPL(int,
is_local_addr, (const tor_addr_t *addr))
{
/* Check for an internal IPv4 or IPv6 address */
if (tor_addr_is_internal(addr, 0))
return 1;
/* Check whether ip is on the same /24 as we are. */
if (get_options()->EnforceDistinctSubnets == 0)
return 0;
if (tor_addr_family(addr) == AF_INET) {
uint32_t ip = tor_addr_to_ipv4h(addr);
/* It's possible that this next check will hit before the first time
* resolve_my_address actually succeeds. (For clients, it is likely
that
* resolve_my_address will never be called at all). In those cases,
* last_resolved_addr will be 0, and so checking to see whether ip is
on
* the same /24 as last_resolved_addr will be the same as checking
whether
* it was on net 0, which is already done by tor_addr_is_internal.
*/
if ((last_resolved_addr & (uint32_t)0xffffff00ul)
== (ip & (uint32_t)0xffffff00ul))
return 1;
}
/* Check for the same IPv6 /48 as the directory server */
if (tor_addr_family(addr) == AF_INET6) {
if (router_get_my_routerinfo() &&
tor_addr_is_valid(&(router_get_my_routerinfo()->ipv6_addr), true)) {
return tor_addr_compare_masked(addr,
&(router_get_my_routerinfo()->ipv6_addr), 48, CMP_EXACT);
}
}
return 0;
}
}}}
The error is quite interesting now:
{{{
tor ) make test-network
$CHUTNEY_PATH was not set.
Assuming test-network.sh will find ./../chutney
Running IPv4 flavors: bridges+hs-v23.
ping6 ::1 or ping ::1 succeeded, running IPv6 flavors: single-
onion-v23-ipv6-md.
FAIL: bridges+hs-v23
cat:
'/home/seneca/Documents/outreachy/tor/../chutney/net/nodes/*/info.log': No
such file or directory
FAIL: single-onion-v23-ipv6-md
cat:
'/home/seneca/Documents/outreachy/tor/../chutney/net/nodes/*/info.log': No
such file or directory
Log and result files are available in ./test_network_log.
Makefile:21723: recipe for target 'test-network-results' failed
make[1]: *** [test-network-results] Error 1
Makefile:21570: recipe for target 'test-network' failed
make: *** [test-network] Error 2
tor ) wc -l test_network_log/*
670 test_network_log/bridges+hs-v23.log
4 test_network_log/bridges+hs-v23.trs
599 test_network_log/single-onion-v23-ipv6-md.log
4 test_network_log/single-onion-v23-ipv6-md.trs
1277 total
}}}
Please tell me if you want me to attach the logs.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33618#comment:7>
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