Ticket #9188: tor-dumpguards.patch

File tor-dumpguards.patch, 2.2 KB (added by ra, 7 years ago)
  • src/or/circuitbuild.c

    diff -urN tor-0.2.3.25.orig/src/or/circuitbuild.c tor-0.2.3.25/src/or/circuitbuild.c
    old new  
    43814381  return changed ? 1 : 0;
    43824382}
    43834383
     4384void
     4385remove_all_entry_guards()
     4386{
     4387  char dbuf[HEX_DIGEST_LEN+1];
     4388  int i;
     4389
     4390  for (i = 0; i < smartlist_len(entry_guards); ) {
     4391    entry_guard_t *entry = smartlist_get(entry_guards, i);
     4392    base16_encode(dbuf, sizeof(dbuf), entry->identity, DIGEST_LEN);
     4393    log_info(LD_CIRC, "Entry guard '%s' (%s) has been dropped.",
     4394             entry->nickname, dbuf);
     4395    control_event_guard(entry->nickname, entry->identity, "DROPPED");
     4396    entry_guard_free(entry);
     4397    smartlist_del(entry_guards, 0);
     4398    log_entry_guards(LOG_INFO);
     4399  }
     4400}
     4401
    43844402/** A new directory or router-status has arrived; update the down/listed
    43854403 * status of the entry guards.
    43864404 *
  • src/or/circuitbuild.h

    diff -urN tor-0.2.3.25.orig/src/or/circuitbuild.h tor-0.2.3.25/src/or/circuitbuild.h
    old new  
    6868const node_t *build_state_get_exit_node(cpath_build_state_t *state);
    6969const char *build_state_get_exit_nickname(cpath_build_state_t *state);
    7070
     71void remove_all_entry_guards();
     72
    7173void entry_guards_compute_status(const or_options_t *options, time_t now);
    7274int entry_guard_register_connect_status(const char *digest, int succeeded,
    7375                                        int mark_relay_status, time_t now);
  • src/or/control.c

    diff -urN tor-0.2.3.25.orig/src/or/control.c tor-0.2.3.25/src/or/control.c
    old new  
    34363436  } else if (!strcasecmp(conn->incoming_cmd, "AUTHCHALLENGE")) {
    34373437    if (handle_control_authchallenge(conn, cmd_data_len, args))
    34383438      return -1;
     3439  } else if (!strcasecmp(conn->incoming_cmd, "DUMPGUARDS")) {
     3440    remove_all_entry_guards();
     3441    send_control_done(conn);
    34393442  } else {
    34403443    connection_printf_to_buf(conn, "510 Unrecognized command \"%s\"\r\n",
    34413444                             conn->incoming_cmd);