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

[or-cvs] We"re printing the host mask wrong in exit policies in serv...



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

Modified Files:
	router.c 
Log Message:
We're printing the host mask wrong in exit policies in server descriptors.
I believe this isn't a critical bug tho, since we're still obeying the
exit policy internally.


Index: router.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- router.c	1 Apr 2005 20:15:55 -0000	1.166
+++ router.c	2 Apr 2005 08:55:31 -0000	1.167
@@ -861,8 +861,8 @@
 
   /* Write the exit policy to the end of 's'. */
   for (tmpe=router->exit_policy; tmpe; tmpe=tmpe->next) {
-    in.s_addr = htonl(tmpe->addr);
     /* Write: "accept 1.2.3.4" */
+    in.s_addr = htonl(tmpe->addr);
     tor_inet_ntoa(&in, addrbuf, sizeof(addrbuf));
     result = tor_snprintf(s+written, maxlen-written, "%s %s",
         tmpe->policy_type == ADDR_POLICY_ACCEPT ? "accept" : "reject",
@@ -872,8 +872,8 @@
     written += result;
     if (tmpe->msk != 0xFFFFFFFFu && tmpe->msk != 0) {
       /* Write "/255.255.0.0" */
-      tor_inet_ntoa(&in, addrbuf, sizeof(addrbuf));
       in.s_addr = htonl(tmpe->msk);
+      tor_inet_ntoa(&in, addrbuf, sizeof(addrbuf));
       result = tor_snprintf(s+written, maxlen-written, "/%s", addrbuf);
       if (result<0)
         return -1;