[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Upload to trusted dir servers based on DirServer config opt...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] Upload to trusted dir servers based on DirServer config opt...
- From: nickm@seul.org (Nick Mathewson)
- Date: Fri, 15 Oct 2004 15:04:40 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 15 Oct 2004 15:04:58 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv6699/src/or
Modified Files:
directory.c or.h routerlist.c
Log Message:
Upload to trusted dir servers based on DirServer config options, not on routerinfos.
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- directory.c 15 Oct 2004 04:57:36 -0000 1.146
+++ directory.c 15 Oct 2004 19:04:37 -0000 1.147
@@ -73,28 +73,27 @@
directory_post_to_dirservers(uint8_t purpose, const char *payload,
size_t payload_len)
{
- int i;
+ smartlist_t *dirservers;
+
routerinfo_t *router;
routerlist_t *rl;
char buf[16];
- router_get_routerlist(&rl);
- if(!rl)
- return;
-
- for(i=0; i < smartlist_len(rl->routers); i++) {
- router = smartlist_get(rl->routers, i);
- /* Note: this posts our descriptor to ourselves, if we're an
- * authdirserver. But I think that's ok. */
- if(!router->is_trusted_dir)
- continue;
- if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR) {
- sprintf(buf,"%d",router->dir_port);
- if (!smartlist_string_isin(options.FirewallPorts, buf))
- continue;
- }
- directory_initiate_command_router(router, purpose, payload, payload_len);
- }
+ router_get_trusted_dir_servers(&dirservers);
+ tor_assert(dirservers);
+ SMARTLIST_FOREACH(dirservers, trusted_dir_server_t *, ds,
+ {
+ /* Pay attention to fascistfirewall when we're uploading a
+ * router descriptor, but not when uploading a service
+ * descriptor -- those use Tor. */
+ if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR &&
+ !options.HttpProxy) {
+ sprintf(buf,"%d",ds->dir_port);
+ if (!smartlist_string_isin(options.FirewallPorts, buf))
+ continue;
+ }
+ directory_initiate_command_trusted_dir(ds, purpose, payload, payload_len);
+ });
}
/** Start a connection to a random running directory server, using
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.434
retrieving revision 1.435
diff -u -d -r1.434 -r1.435
--- or.h 15 Oct 2004 05:09:48 -0000 1.434
+++ or.h 15 Oct 2004 19:04:37 -0000 1.435
@@ -1413,6 +1413,7 @@
} trusted_dir_server_t;
int router_reload_router_list(void);
+void router_get_trusted_dir_servers(smartlist_t **outp);
routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall);
trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, int fascistfirewall);
int all_trusted_directory_servers_down(void);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- routerlist.c 15 Oct 2004 04:57:36 -0000 1.160
+++ routerlist.c 15 Oct 2004 19:04:38 -0000 1.161
@@ -69,6 +69,18 @@
return 0;
}
+/* Set *<b>outp</b> to a smartlist containing a list of
+ * trusted_dir_server_t * for all known trusted dirservers. Callers
+ * must not modify the list or its contents.
+ */
+void router_get_trusted_dir_servers(smartlist_t **outp)
+{
+ if (!trusted_dir_servers)
+ trusted_dir_servers = smartlist_create();
+
+ *outp = trusted_dir_servers;
+}
+
/** Try to find a running dirserver. If there are no running dirservers
* in our routerlist, set all the authoritative ones as running again,
* and pick one. If there are no dirservers at all in our routerlist,