summaryrefslogtreecommitdiff
path: root/src/common/address.c
AgeCommit message (Collapse)Author
2016-02-11Merge remote-tracking branch 'teor/feature17840-v11-merged-v2'Nick Mathewson
2016-02-06Document port_out argument to tor_addr_from_sockaddrNick Mathewson
2016-01-29Merge branch 'feature17840-v11-squashed' into feature17840-v11-mergedteor (Tim Wilson-Brown)
Conflicts: src/or/directory.c src/test/test_routerlist.c Fix minor conflicts.
2016-01-29Fix *_get_all_orports to use ipv6_orportteor (Tim Wilson-Brown)
node_get_all_orports and router_get_all_orports incorrectly used or_port with IPv6 addresses. They now use ipv6_orport. Also refactor and remove duplicated code.
2016-01-11Merge remote-tracking branch 'rl1987/feature17950'Nick Mathewson
2016-01-09Re-add the removed address family check.rl1987
2016-01-08Merge commit '110765f5564a588c5f019d32b5e6f66cc7806c41'Nick Mathewson
2016-01-06Use get_interface6_via_udp_socket_hack() properly in _list().rl1987
When _list() is called with AF_UNSPEC family and fails to enumerate network interfaces using platform specific API, have it call _hack() twice to find out IPv4 and/or IPv6 address of a machine Tor instance is running on. This is correct way to handle this case because _hack() can only be called with AF_INET and AF_INET6 and does not support any other address family.
2016-01-06Tweak ioctl case.rl1987
2016-01-03Add family argument to get_interface_addresses_raw (and subfunctions).rl1987
2016-01-03Fix a typo in the comment for tor_addr_port_splitteor (Tim Wilson-Brown)
2015-12-16Limit IPv6 mask bits to 128teor (Tim Wilson-Brown)
2015-12-07Consistently ignore multicast in internal reject private exit policiesteor (Tim Wilson-Brown)
Consistently ignore multicast addresses when automatically generating reject private exit policies. Closes ticket 17763. Bug fix on 10a6390deb3c9, not in any released version of Tor. Patch by "teor".
2015-11-18Update comments in get_interface_addresses_ioctlteor (Tim Wilson-Brown)
Comment-only change noting platforms that can return IPv6 addresses from SIOCGIFCONF (or SIOCGLIFCONF).
2015-09-29Add checks and unit tests for get_interface_address* failureteor (Tim Wilson-Brown)
Ensure that either a valid address is returned in address pointers, or that the address data is zeroed on error. Ensure that free_interface_address6_list handles NULL lists. Add unit tests for get_interface_address* failure cases. Fixes bug #17173. Patch by fk/teor, not in any released version of tor.
2015-09-29get_interface_address6_list(): Bring back a return code checkFabian Keil
... that was removed by 31eb486c46 which first appeared in 0.2.7.3-rc. If tor is running in a ElectroBSD (or FreeBSD) jail it can't get any IP addresses that aren't assigned to the jail by looking at the interfaces and (by design) the get_interface_address6_via_udp_socket_hack() fallback doesn't work either. The missing return code check resulted in tor_addr_is_internal() complaining about a "non-IP address of type 49", due to reading uninitialised memory. Fixes #17173.
2015-09-16Merge branch 'bug17027-reject-private-all-interfaces-v2' into bug16069-bug17027teor (Tim Wilson-Brown)
src/test/test_policy.c: Merged calls to policies_parse_exit_policy by adding additional arguments. fixup to remaining instance of ~EXIT_POLICY_IPV6_ENABLED. Compacting logic test now produces previous list length of 4, corrected this. src/config/torrc.sample.in: src/config/torrc.minimal.in-staging: Merged torrc modification dates in favour of latest.
2015-09-16ExitPolicyRejectPrivate rejects local IPv6 address and interface addressesteor (Tim Wilson-Brown)
ExitPolicyRejectPrivate now rejects more local addresses by default: * the relay's published IPv6 address (if any), and * any publicly routable IPv4 or IPv6 addresses on any local interfaces. This resolves a security issue for IPv6 Exits and multihomed Exits that trust connections originating from localhost. Resolves ticket 17027. Patch by "teor". Patch on 42b8fb5a1523 (11 Nov 2007), released in 0.2.0.11-alpha.
2015-09-16ExitPolicy accept6/reject6 produces IPv6 wildcard addresses onlyteor (Tim Wilson-Brown)
In previous versions of Tor, ExitPolicy accept6/reject6 * produced policy entries for IPv4 and IPv6 wildcard addresses. To reduce operator confusion, change accept6/reject6 * to only produce an IPv6 wildcard address. Resolves bug #16069. Patch on 2eb7eafc9d78 and a96c0affcb4c (25 Oct 2012), released in 0.2.4.7-alpha.
2015-09-16Ignore accept6/reject6 IPv4, warn about unexpected rule outcomesteor (Tim Wilson-Brown)
When parsing torrc ExitPolicies, we now warn if: * an IPv4 address is used on an accept6 or reject6 line. The line is ignored, but the rest of the policy items in the list are used. (accept/reject continue to allow both IPv4 and IPv6 addresses in torrcs.) * a "private" address alias is used on an accept6 or reject6 line. The line filters both IPv4 and IPv6 private addresses, disregarding the 6 in accept6/reject6. When parsing torrc ExitPolicies, we now issue an info-level message: * when expanding an accept/reject * line to include both IPv4 and IPv6 wildcard addresses. In each instance, usage advice is provided to avoid the message. Partial fix for ticket 16069. Patch by "teor". Patch on 2eb7eafc9d78 and a96c0affcb4c (25 Oct 2012), released in 0.2.4.7-alpha.
2015-09-15Add get_interface_address[6]_list for a list of interface IP addressesteor (Tim Wilson-Brown)
Add get_interface_address[6]_list by refactoring get_interface_address6. Add unit tests for new and existing functions. Preparation for ticket 17027. Patch by "teor". Patch on 42b8fb5a1523 (11 Nov 2007), released in 0.2.0.11-alpha.
2015-07-31Move formatting functions around.Nick Mathewson
The base64 and base32 functions used to be in crypto.c; crypto_format.h had no header; some general-purpose functions were in crypto_curve25519.c. This patch makes a {crypto,util}_format.[ch], and puts more functions there. Small modules are beautiful!
2015-06-29Try a little harder to fix the tor-ci-windows builder, or figure out why it ↵Nick Mathewson
is broke
2015-06-29Remove checks for visual C 6.Nick Mathewson
2015-03-31Merge branch 'ticket14710_squashed'Nick Mathewson
2015-03-31Whitebox test for get_interface_address6_via_udp_socket_hack().rl1987
Also, fix some whitespace mishaps.
2015-03-31Bugfix: we don't want loopback/multicastaddress from _hack().rl1987
2015-03-31Moving the hacky part of get_interface_address6() into separate function.rl1987
2015-02-16Fix deadcode warning in get_interface_addresses_raw().Nick Mathewson
CID 1268070
2015-02-16Fix a trivial double-close in address.c. CID 1268071Nick Mathewson
2015-02-12Avoid undefined behaviour in ifreq_to_smartlistSebastian Hahn
This could trigger where _SIZEOF_ADDR_IFREQ() might not return a multiple of sizeof(void *). Fixes bug 14875; not in any released version of Tor.
2015-02-12Actually get all interface addressesSebastian Hahn
If we guessed a buffer size too small, we never increased the buffer and tried again Also simplify the interface of ifreq_to_smartlist a little
2015-01-23Merge branch 'if_addr_refactoring_squashed'Nick Mathewson
Conflicts: src/test/include.am src/test/test.c
2015-01-23Refactor code that looks up addresses from interfacesrl1987
Now the code has separate implementation and examination functions, uses smartlists sanely, and has relatively decent test coverage.
2015-01-07Commit second draft of Jake's SOCKS5-over-AF_UNIX patch. See ticket #12585.Jacob Appelbaum
Signed-off-by: Andrea Shepard <andrea@torproject.org>
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-30Remove a logically dead check to please coverityNick Mathewson
2014-12-29Wipe all of the target space in tor_addr_{to,from}_sockaddr()Nick Mathewson
Otherwise we risk a subsequent memdup or memcpy copying uninitialized RAM into some other place that might eventually expose it. Let's make sure that doesn't happen. Closes ticket 14041
2014-12-29Merge branch 'resolvemyaddr_squashed'Nick Mathewson
2014-12-29Adding comprehensive test cases for resolve_my_address.rl1987
Also, improve comments on resolve_my_address to explain what it actually does.
2014-12-21Fix a comment in tor_addr_parseteor
2014-11-12Merge remote-tracking branch 'public/bug7484'Nick Mathewson
Conflicts: src/test/test_addr.c
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-10-23Fix minor typos, two line lengths, and a repeated includeteor
2014-09-25Tell autoconf to make the compiler act as c99Nick Mathewson
Apparently some compilers want extra switches.
2014-09-25Tweak address.c to use a little c99 syntaxNick Mathewson
Since address.c is the first file to get compiled, let's have it use a little judicious c99 in order to catch broken compilers that somehow make it past our autoconf tests.
2014-09-15Clear up another clangalyzer issueNick Mathewson
"The NULL pointer warnings on the return value of tor_addr_to_in6_addr32() are incorrect. But clang can't work this out itself due to limited analysis depth. To teach the analyser that the return value is safe to dereference, I applied tor_assert to the return value." Patch from teor. Part of 13157.
2014-09-02Fix a number of clang analyzer false-positivesNick Mathewson
Most of these are in somewhat non-obvious code where it is probably a good idea to initialize variables and add extra assertions anyway. Closes 13036. Patches from "teor".
2014-05-22sandbox: revamp sandbox_getaddrinfo cacheingNick Mathewson
The old cache had problems: * It needed to be manually preloaded. (It didn't remember any address you didn't tell it to remember) * It was AF_INET only. * It looked at its cache even if the sandbox wasn't turned on. * It couldn't remember errors. * It had some memory management problems. (You can't use memcpy to copy an addrinfo safely; it has pointers in.) This patch fixes those issues, and moves to a hash table. Fixes bug 11970; bugfix on 0.2.5.1-alpha.
2014-04-18scan-build: Add a check for result from getaddrinfoNick Mathewson
As documented, getaddrinfo always sets its result when it returns no error. But scan-build doesn't know that, and thinks we might be def