summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-13 16:57:37 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-13 16:57:37 +0000
commit7e344f191aeb2de6ffb9509e0508ce8647764159 (patch)
tree6216fae66278d2cb541e6efa08a6564c63a7e2af /src/common
parent0fbe75ed1eba595a3c69858501e8719c13015f08 (diff)
downloadtor-7e344f191aeb2de6ffb9509e0508ce8647764159.tar.gz
tor-7e344f191aeb2de6ffb9509e0508ce8647764159.zip
add is_local_IP() function to help distinguish which bandwidth "matters"
svn:r2040
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c8
-rw-r--r--src/common/util.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 21ede0580e..7b22bb973a 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1468,6 +1468,14 @@ int is_internal_IP(uint32_t ip) {
return 0;
}
+/** Return true iff <b>ip</b> (in host order) is judged to be on the
+ * same network as us. For now, check if it's an internal IP. For XXX008,
+ * also check if it's on the same class C network as our public IP.
+ */
+int is_local_IP(uint32_t ip) {
+ return is_internal_IP(ip);
+}
+
/* Hold the result of our call to <b>uname</b>. */
static char uname_result[256];
/* True iff uname_result is set. */
diff --git a/src/common/util.h b/src/common/util.h
index 4b44d1a44c..cfcfaafece 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -232,6 +232,7 @@ void tor_mutex_free(tor_mutex_t *m);
int tor_socketpair(int family, int type, int protocol, int fd[2]);
int is_internal_IP(uint32_t ip);
+int is_local_IP(uint32_t ip);
const char *get_uname(void);