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

[tor-commits] [tor/master] Remove "GETINFO network-status".



commit f7d0bde4f0d69d815c90b70f4bf8b7f9efddceaf
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 28 11:47:06 2020 -0400

    Remove "GETINFO network-status".
    
    It was deprecated 0.3.1.1-alpha.
    
    According to #22473, nothing uses it.
    
    Closes #22473.
---
 changes/ticket22473                    |   3 +
 src/feature/control/control_getinfo.c  |  13 -----
 src/feature/control/fmt_serverstatus.c | 103 ---------------------------------
 src/feature/control/fmt_serverstatus.h |  18 ------
 src/feature/control/include.am         |   2 -
 5 files changed, 3 insertions(+), 136 deletions(-)

diff --git a/changes/ticket22473 b/changes/ticket22473
new file mode 100644
index 0000000000..c7496f9da7
--- /dev/null
+++ b/changes/ticket22473
@@ -0,0 +1,3 @@
+  o Removed features (controller):
+    - Remove the "GETINFO network-status" controller command. It has
+      been deprecated since 0.3.1.1-alpha.  Closes ticket 22473.
diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c
index cfac59d499..5feadd23d1 100644
--- a/src/feature/control/control_getinfo.c
+++ b/src/feature/control/control_getinfo.c
@@ -29,7 +29,6 @@
 #include "feature/control/control_fmt.h"
 #include "feature/control/control_getinfo.h"
 #include "feature/control/control_proto.h"
-#include "feature/control/fmt_serverstatus.h"
 #include "feature/control/getinfo_geoip.h"
 #include "feature/dircache/dirserv.h"
 #include "feature/dirclient/dirclient.h"
@@ -721,18 +720,6 @@ getinfo_helper_dir(control_connection_t *control_conn,
     if (consensus_result < 0) {
       return -1;
     }
-  } else if (!strcmp(question, "network-status")) { /* v1 */
-    static int network_status_warned = 0;
-    if (!network_status_warned) {
-      log_warn(LD_CONTROL, "GETINFO network-status is deprecated; it will "
-               "go away in a future version of Tor.");
-      network_status_warned = 1;
-    }
-    routerlist_t *routerlist = router_get_routerlist();
-    if (!routerlist || !routerlist->routers ||
-        list_server_status_v1(routerlist->routers, answer, 1) < 0) {
-      return -1;
-    }
   } else if (!strcmpstart(question, "extra-info/digest/")) {
     question += strlen("extra-info/digest/");
     if (strlen(question) == HEX_DIGEST_LEN) {
diff --git a/src/feature/control/fmt_serverstatus.c b/src/feature/control/fmt_serverstatus.c
deleted file mode 100644
index ed9ad95ce2..0000000000
--- a/src/feature/control/fmt_serverstatus.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright (c) 2001-2004, Roger Dingledine.
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2020, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * @file fmt_serverstatus.c
- * @brief Format relay info for a controller.
- **/
-
-#include "core/or/or.h"
-#include "feature/control/fmt_serverstatus.h"
-
-#include "app/config/config.h"
-#include "feature/dirauth/authmode.h"
-#include "feature/dirauth/voteflags.h"// XXXX remove
-#include "feature/nodelist/describe.h"
-#include "feature/nodelist/nodelist.h"
-
-#include "feature/nodelist/node_st.h"
-#include "feature/nodelist/routerinfo_st.h"
-
-/**
- * Allocate and return a description of the status of the server <b>desc</b>,
- * for use in a v1-style router-status line.  The server is listed
- * as running iff <b>is_live</b> is true.
- *
- * This is deprecated: it's only used for controllers that want outputs in
- * the old format.
- */
-static char *
-list_single_server_status(const routerinfo_t *desc, int is_live)
-{
-  char buf[MAX_NICKNAME_LEN+HEX_DIGEST_LEN+4]; /* !nickname=$hexdigest\0 */
-  char *cp;
-  const node_t *node;
-
-  tor_assert(desc);
-
-  cp = buf;
-  if (!is_live) {
-    *cp++ = '!';
-  }
-  node = node_get_by_id(desc->cache_info.identity_digest);
-  if (node && node->is_valid) {
-    strlcpy(cp, desc->nickname, sizeof(buf)-(cp-buf));
-    cp += strlen(cp);
-    *cp++ = '=';
-  }
-  *cp++ = '$';
-  base16_encode(cp, HEX_DIGEST_LEN+1, desc->cache_info.identity_digest,
-                DIGEST_LEN);
-  return tor_strdup(buf);
-}
-
-/** Based on the routerinfo_ts in <b>routers</b>, allocate the
- * contents of a v1-style router-status line, and store it in
- * *<b>router_status_out</b>.  Return 0 on success, -1 on failure.
- *
- * If for_controller is true, include the routers with very old descriptors.
- *
- * This is deprecated: it's only used for controllers that want outputs in
- * the old format.
- */
-int
-list_server_status_v1(smartlist_t *routers, char **router_status_out,
-                      int for_controller)
-{
-  /* List of entries in a router-status style: An optional !, then an optional
-   * equals-suffixed nickname, then a dollar-prefixed hexdigest. */
-  smartlist_t *rs_entries;
-  time_t now = time(NULL);
-  time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
-  /* We include v2 dir auths here too, because they need to answer
-   * controllers. Eventually we'll deprecate this whole function;
-   * see also networkstatus_getinfo_by_purpose(). */
-  tor_assert(router_status_out);
-
-  rs_entries = smartlist_new();
-
-  SMARTLIST_FOREACH_BEGIN(routers, routerinfo_t *, ri) {
-    const node_t *node = node_get_by_id(ri->cache_info.identity_digest);
-    tor_assert(node);
-    if (for_controller) {
-      char name_buf[MAX_VERBOSE_NICKNAME_LEN+2];
-      char *cp = name_buf;
-      if (!node->is_running)
-        *cp++ = '!';
-      router_get_verbose_nickname(cp, ri);
-      smartlist_add_strdup(rs_entries, name_buf);
-    } else if (ri->cache_info.published_on >= cutoff) {
-      smartlist_add(rs_entries, list_single_server_status(ri,
-                                                          node->is_running));
-    }
-  } SMARTLIST_FOREACH_END(ri);
-
-  *router_status_out = smartlist_join_strings(rs_entries, " ", 0, NULL);
-
-  SMARTLIST_FOREACH(rs_entries, char *, cp, tor_free(cp));
-  smartlist_free(rs_entries);
-
-  return 0;
-}
diff --git a/src/feature/control/fmt_serverstatus.h b/src/feature/control/fmt_serverstatus.h
deleted file mode 100644
index 9dd9fe125c..0000000000
--- a/src/feature/control/fmt_serverstatus.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2001 Matej Pfajfar.
- * Copyright (c) 2001-2004, Roger Dingledine.
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2020, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file fmt_serverstatus.h
- * \brief Header file for fmt_serverstatus.c.
- **/
-
-#ifndef TOR_FMT_SERVERSTATUS_H
-#define TOR_FMT_SERVERSTATUS_H
-
-int list_server_status_v1(smartlist_t *routers, char **router_status_out,
-                          int for_controller);
-
-#endif /* !defined(TOR_FMT_SERVERSTATUS_H) */
diff --git a/src/feature/control/include.am b/src/feature/control/include.am
index 07094f23bb..101fe3c705 100644
--- a/src/feature/control/include.am
+++ b/src/feature/control/include.am
@@ -15,7 +15,6 @@ LIBTOR_APP_A_SOURCES += 				\
 	src/feature/control/control_fmt.c	\
 	src/feature/control/control_getinfo.c	\
 	src/feature/control/control_proto.c	\
-	src/feature/control/fmt_serverstatus.c  \
 	src/feature/control/getinfo_geoip.c
 
 # ADD_C_FILE: INSERT HEADERS HERE.
@@ -35,5 +34,4 @@ noinst_HEADERS +=					\
 	src/feature/control/control_fmt.h		\
 	src/feature/control/control_getinfo.h		\
 	src/feature/control/control_proto.h		\
-	src/feature/control/fmt_serverstatus.h		\
 	src/feature/control/getinfo_geoip.h



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