diff options
author | Linus Nordberg <linus@nordberg.se> | 2012-05-09 17:58:01 +0200 |
---|---|---|
committer | Linus Nordberg <linus@torproject.org> | 2012-07-19 18:21:20 +0200 |
commit | 4cce8ab742999900a4c5f1f3f8faf13d217014e0 (patch) | |
tree | f891650b4bc6fd3c0f8cb6b2f31590eb16425cc7 /src/or/router.c | |
parent | c1ff07440e67f1ae690acbfceddb6174fdb092df (diff) | |
download | tor-4cce8ab742999900a4c5f1f3f8faf13d217014e0.tar.gz tor-4cce8ab742999900a4c5f1f3f8faf13d217014e0.zip |
Add last_reachable and testing_since for IPv6 OR port.
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c index df44a76d8a..20767d8a3f 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2230,6 +2230,26 @@ router_get_pref_ipv6_orport(const routerinfo_t *router, ap_out->port = router->ipv6_orport; } +/** Return 1 if any of <b>router</b>'s addresses are <b>addr</b>. + * Otherwise return 0. */ +int +router_has_addr(const routerinfo_t *router, const tor_addr_t *addr) +{ + return + tor_addr_eq_ipv4h(addr, router->addr) || + tor_addr_eq(&router->ipv6_addr, addr); +} + +int +router_has_orport(const routerinfo_t *router, const tor_addr_port_t *orport) +{ + return + (tor_addr_eq_ipv4h(&orport->addr, router->addr) && + orport->port == router->or_port) || + (tor_addr_eq(&orport->addr, &router->ipv6_addr) && + orport->port == router->ipv6_orport); +} + /** Load the contents of <b>filename</b>, find the last line starting with * <b>end_line</b>, ensure that its timestamp is not more than 25 hours in * the past or more than 1 hour in the future with respect to <b>now</b>, |