[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] add is_local_IP() function to help distinguish which bandwi...



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common

Modified Files:
	util.c util.h 
Log Message:
add is_local_IP() function to help distinguish which bandwidth "matters"


Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- util.c	6 Jul 2004 23:29:34 -0000	1.110
+++ util.c	13 Jul 2004 16:57:37 -0000	1.111
@@ -1468,6 +1468,14 @@
   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. */

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- util.h	30 Jun 2004 16:37:08 -0000	1.72
+++ util.h	13 Jul 2004 16:57:37 -0000	1.73
@@ -232,6 +232,7 @@
 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);