aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-12 11:34:54 -0400
committerNick Mathewson <nickm@torproject.org>2012-10-12 11:34:54 -0400
commit8586611718ee9c4cc81eb8fe50c937619393ade6 (patch)
tree3d9fce44c28899ffbeeaf93b6bf627f4ea6f0b20 /src/common
parent9c605ecb7eeb62823dcb2042a5fbfde835f98618 (diff)
downloadtor-8586611718ee9c4cc81eb8fe50c937619393ade6.tar
tor-8586611718ee9c4cc81eb8fe50c937619393ade6.tar.gz
Make tor_addr_is_internal log the calling function on error
This might make it a little easier to track down bug 7086.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c7
-rw-r--r--src/common/address.h5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/common/address.c b/src/common/address.c
index 9a61872af..2c0c97db9 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -305,7 +305,8 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
* also treated as internal for now.)
*/
int
-tor_addr_is_internal(const tor_addr_t *addr, int for_listening)
+tor_addr_is_internal_(const tor_addr_t *addr, int for_listening,
+ const char *filename, int lineno)
{
uint32_t iph4 = 0;
uint32_t iph6[4];
@@ -355,8 +356,8 @@ tor_addr_is_internal(const tor_addr_t *addr, int for_listening)
/* unknown address family... assume it's not safe for external use */
/* rather than tor_assert(0) */
- log_warn(LD_BUG, "tor_addr_is_internal() called with a non-IP address of "
- "type %d", (int)v_family);
+ log_warn(LD_BUG, "tor_addr_is_internal() called from %s:%d with a "
+ "non-IP address of type %d", filename, lineno, (int)v_family);
tor_fragile_assert();
return 1;
}
diff --git a/src/common/address.h b/src/common/address.h
index 68775fb29..9e7d75012 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -168,7 +168,10 @@ int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
unsigned int tor_addr_hash(const tor_addr_t *addr);
int tor_addr_is_v4(const tor_addr_t *addr);
-int tor_addr_is_internal(const tor_addr_t *ip, int for_listening);
+int tor_addr_is_internal_(const tor_addr_t *ip, int for_listening,
+ const char *filename, int lineno);
+#define tor_addr_is_internal(addr, for_listening) \
+ tor_addr_is_internal_((addr), (for_listening), _SHORT_FILE_, __LINE__)
/** Longest length that can be required for a reverse lookup name. */
/* 32 nybbles, 32 dots, 8 characters of "ip6.arpa", 1 NUL: 73 characters. */