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

[tor-commits] [tor/master] Remove the AUTHDIR_NEWDESCS feature: nobody is using it any more



commit 408ed52e3d5b9ec973f12ed21d2a77abc4f15d8f
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Aug 24 16:51:46 2017 -0400

    Remove the AUTHDIR_NEWDESCS feature: nobody is using it any more
    
    If somebody asks for it, log a warning.
    
    Closes ticket 22377.
---
 changes/ticket22377 |  4 ++++
 src/or/control.c    | 47 ++++-------------------------------------------
 src/or/control.h    |  9 ++-------
 src/or/dirserv.c    | 12 ------------
 4 files changed, 10 insertions(+), 62 deletions(-)

diff --git a/changes/ticket22377 b/changes/ticket22377
new file mode 100644
index 000000000..4f15c1620
--- /dev/null
+++ b/changes/ticket22377
@@ -0,0 +1,4 @@
+  o Removed features:
+    - The controller API no longer includes an AUTHDIR_NEWDESCS event:
+      nobody was using it any longer. Closes ticket 22377.
+
diff --git a/src/or/control.c b/src/or/control.c
index bc173a6e1..c9551829f 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1154,7 +1154,6 @@ static const struct control_event_t control_event_table[] = {
   { EVENT_ERR_MSG, "ERR" },
   { EVENT_NEW_DESC, "NEWDESC" },
   { EVENT_ADDRMAP, "ADDRMAP" },
-  { EVENT_AUTHDIR_NEWDESCS, "AUTHDIR_NEWDESCS" },
   { EVENT_DESCCHANGED, "DESCCHANGED" },
   { EVENT_NS, "NS" },
   { EVENT_STATUS_GENERAL, "STATUS_GENERAL" },
@@ -1194,7 +1193,10 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
                          SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
   SMARTLIST_FOREACH_BEGIN(events, const char *, ev)
     {
-      if (!strcasecmp(ev, "EXTENDED")) {
+      if (!strcasecmp(ev, "EXTENDED") ||
+          !strcasecmp(ev, "AUTHDIR_NEWDESCS")) {
+        log_warn(LD_CONTROL, "The \"%s\" SETEVENTS argument is no longer "
+                 "supported.", ev);
         continue;
       } else {
         int i;
@@ -6053,47 +6055,6 @@ control_event_address_mapped(const char *from, const char *to, time_t expires,
   return 0;
 }
 
-/** The authoritative dirserver has received a new descriptor that
- * has passed basic syntax checks and is properly self-signed.
- *
- * Notify any interested party of the new descriptor and what has
- * been done with it, and also optionally give an explanation/reason. */
-int
-control_event_or_authdir_new_descriptor(const char *action,
-                                        const char *desc, size_t desclen,
-                                        const char *msg)
-{
-  char firstline[1024];
-  char *buf;
-  size_t totallen;
-  char *esc = NULL;
-  size_t esclen;
-
-  if (!EVENT_IS_INTERESTING(EVENT_AUTHDIR_NEWDESCS))
-    return 0;
-
-  tor_snprintf(firstline, sizeof(firstline),
-               "650+AUTHDIR_NEWDESC=\r\n%s\r\n%s\r\n",
-               action,
-               msg ? msg : "");
-
-  /* Escape the server descriptor properly */
-  esclen = write_escaped_data(desc, desclen, &esc);
-
-  totallen = strlen(firstline) + esclen + 1;
-  buf = tor_malloc(totallen);
-  strlcpy(buf, firstline, totallen);
-  strlcpy(buf+strlen(firstline), esc, totallen);
-  send_control_event_string(EVENT_AUTHDIR_NEWDESCS,
-                            buf);
-  send_control_event_string(EVENT_AUTHDIR_NEWDESCS,
-                            "650 OK\r\n");
-  tor_free(esc);
-  tor_free(buf);
-
-  return 0;
-}
-
 /** Cached liveness for network liveness events and GETINFO
  */
 
diff --git a/src/or/control.h b/src/or/control.h
index 41a194bfc..5f6dcc352 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -33,7 +33,6 @@ void connection_control_closed(control_connection_t *conn);
 
 int connection_control_process_inbuf(control_connection_t *conn);
 
-#define EVENT_AUTHDIR_NEWDESCS 0x000D
 #define EVENT_NS 0x000F
 int control_event_is_interesting(int event);
 
@@ -64,10 +63,6 @@ int control_event_descriptors_changed(smartlist_t *routers);
 int control_event_address_mapped(const char *from, const char *to,
                                  time_t expires, const char *error,
                                  const int cached);
-int control_event_or_authdir_new_descriptor(const char *action,
-                                            const char *desc,
-                                            size_t desclen,
-                                            const char *msg);
 int control_event_my_descriptor_changed(void);
 int control_event_network_liveness_update(int liveness);
 int control_event_networkstatus_changed(smartlist_t *statuses);
@@ -169,8 +164,8 @@ void control_free_all(void);
 #define EVENT_WARN_MSG                0x000A
 #define EVENT_ERR_MSG                 0x000B
 #define EVENT_ADDRMAP                 0x000C
-/* Exposed above */
-// #define EVENT_AUTHDIR_NEWDESCS     0x000D
+/* There was an AUTHDIR_NEWDESCS event, but it no longer exists.  We
+   can reclaim 0x000D. */
 #define EVENT_DESCCHANGED             0x000E
 /* Exposed above */
 // #define EVENT_NS                   0x000F
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index e5654e3b9..109857ee1 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -673,9 +673,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
                ri->nickname, source, (int)ri->cache_info.signed_descriptor_len,
                MAX_DESCRIPTOR_UPLOAD_SIZE);
     *msg = "Router descriptor was too large.";
-    control_event_or_authdir_new_descriptor("REJECTED",
-               ri->cache_info.signed_descriptor_body,
-                                            desclen, *msg);
     r = ROUTER_AUTHDIR_REJECTS;
     goto fail;
   }
@@ -694,9 +691,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
              router_describe(ri), source);
     *msg = "Not replacing router descriptor; no information has changed since "
       "the last one with this identity.";
-    control_event_or_authdir_new_descriptor("DROPPED",
-                         ri->cache_info.signed_descriptor_body,
-                                            desclen, *msg);
     r = ROUTER_IS_ALREADY_KNOWN;
     goto fail;
   }
@@ -709,9 +703,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
     if (ed25519_validate_pubkey(pkey) < 0) {
       log_warn(LD_DIRSERV, "Received bad key from %s (source %s)",
                router_describe(ri), source);
-      control_event_or_authdir_new_descriptor("REJECTED",
-                                         ri->cache_info.signed_descriptor_body,
-                                         desclen, *msg);
       routerinfo_free(ri);
       return ROUTER_AUTHDIR_REJECTS;
     }
@@ -749,14 +740,11 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
   r = router_add_to_routerlist(ri, msg, 0, 0);
   if (!WRA_WAS_ADDED(r)) {
     /* unless the routerinfo was fine, just out-of-date */
-    if (WRA_WAS_REJECTED(r))
-      control_event_or_authdir_new_descriptor("REJECTED", desc, desclen, *msg);
     log_info(LD_DIRSERV,
              "Did not add descriptor from '%s' (source: %s): %s.",
              nickname, source, *msg ? *msg : "(no message)");
   } else {
     smartlist_t *changed;
-    control_event_or_authdir_new_descriptor("ACCEPTED", desc, desclen, *msg);
 
     changed = smartlist_new();
     smartlist_add(changed, ri);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits