aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2015-02-22 17:34:00 +0200
committerNick Mathewson <nickm@torproject.org>2015-03-31 14:37:02 -0400
commit92fc728d83b7d02e95aae65b1eb083597bec141d (patch)
tree49ad291aee3366974dc4c526031a43bb56c9b606 /src/common/address.c
parent6af471f3944a91646db8b7ea0a915ed2f87cd705 (diff)
downloadtor-92fc728d83b7d02e95aae65b1eb083597bec141d.tar.gz
tor-92fc728d83b7d02e95aae65b1eb083597bec141d.zip
Bugfix: we don't want loopback/multicastaddress from _hack().
Diffstat (limited to 'src/common/address.c')
-rw-r--r--src/common/address.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/common/address.c b/src/common/address.c
index e3c2521235..3e26576815 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -1542,8 +1542,16 @@ get_interface_address6_via_udp_socket_hack(int severity,
goto err;
}
- tor_addr_from_sockaddr(addr, (struct sockaddr*)&my_addr, NULL);
- r=0;
+ if (tor_addr_from_sockaddr(addr, (struct sockaddr*)&my_addr, NULL) == 0) {
+ if (tor_addr_is_loopback(addr) || tor_addr_is_multicast(addr)) {
+ log_fn(severity, LD_NET, "Address that we determined via UDP socket"
+ " magic is unsuitable for public comms.");
+ }
+ else {
+ r=0;
+ }
+ }
+
err:
if (sock >= 0)
tor_close_socket(sock);