diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-06-30 15:45:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-02 09:51:03 -0400 |
commit | 81d312f12c196a87f6fb0a4ba7c445afe95b6d4a (patch) | |
tree | 25abc676c57c29e922fb778d884f7fd7836364ab /src/core/or/extendinfo.c | |
parent | 8f362b7bce5ebbba5c8d79cf10c5ec42bbde1519 (diff) | |
download | tor-81d312f12c196a87f6fb0a4ba7c445afe95b6d4a.tar.gz tor-81d312f12c196a87f6fb0a4ba7c445afe95b6d4a.zip |
Add a function for comparing the orport on an extendinfo.
Diffstat (limited to 'src/core/or/extendinfo.c')
-rw-r--r-- | src/core/or/extendinfo.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/or/extendinfo.c b/src/core/or/extendinfo.c index 74d4a54a33..874a0a58f8 100644 --- a/src/core/or/extendinfo.c +++ b/src/core/or/extendinfo.c @@ -207,3 +207,16 @@ extend_info_addr_is_allowed(const tor_addr_t *addr) disallow: return 0; } + +/** + * Return true if @a addr : @a port is a listed ORPort in @a ei. + **/ +bool +extend_info_has_orport(const extend_info_t *ei, + const tor_addr_t *addr, uint16_t port) +{ + IF_BUG_ONCE(ei == NULL) + return false; + + return tor_addr_eq(&ei->addr, addr) && ei->port == port; +} |