Tor  0.4.3.0-alpha-dev
control.c
Go to the documentation of this file.
1 /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
2  * Copyright (c) 2007-2019, The Tor Project, Inc. */
3 /* See LICENSE for licensing information */
4 
5 /**
6  * \file control.c
7  * \brief Implementation for Tor's control-socket interface.
8  *
9  * A "controller" is an external program that monitors and controls a Tor
10  * instance via a text-based protocol. It connects to Tor via a connection
11  * to a local socket.
12  *
13  * The protocol is line-driven. The controller sends commands terminated by a
14  * CRLF. Tor sends lines that are either <em>replies</em> to what the
15  * controller has said, or <em>events</em> that Tor sends to the controller
16  * asynchronously based on occurrences in the Tor network model.
17  *
18  * See the control-spec.txt file in the torspec.git repository for full
19  * details on protocol.
20  *
21  * This module generally has two kinds of entry points: those based on having
22  * received a command on a controller socket, which are handled in
23  * connection_control_process_inbuf(), and dispatched to individual functions
24  * with names like control_handle_COMMANDNAME(); and those based on events
25  * that occur elsewhere in Tor, which are handled by functions with names like
26  * control_event_EVENTTYPE().
27  *
28  * Controller events are not sent immediately; rather, they are inserted into
29  * the queued_control_events array, and flushed later from
30  * flush_queued_events_cb(). Doing this simplifies our callgraph greatly,
31  * by limiting the number of places in Tor that can call back into the network
32  * stack.
33  **/
34 
35 #define CONTROL_MODULE_PRIVATE
36 #define CONTROL_PRIVATE
37 
38 #include "core/or/or.h"
39 #include "app/config/config.h"
40 #include "app/main/main.h"
42 #include "core/mainloop/mainloop.h"
43 #include "core/or/connection_or.h"
45 #include "core/proto/proto_http.h"
53 #include "lib/evloop/procmon.h"
54 
56 
57 #ifdef HAVE_UNISTD_H
58 #include <unistd.h>
59 #endif
60 #ifdef HAVE_SYS_STAT_H
61 #include <sys/stat.h>
62 #endif
63 
64 /** Convert a connection_t* to an control_connection_t*; assert if the cast is
65  * invalid. */
68 {
69  tor_assert(c->magic == CONTROL_CONNECTION_MAGIC);
70  return DOWNCAST(control_connection_t, c);
71 }
72 
73 /** Create and add a new controller connection on <b>sock</b>. If
74  * <b>CC_LOCAL_FD_IS_OWNER</b> is set in <b>flags</b>, this Tor process should
75  * exit when the connection closes. If <b>CC_LOCAL_FD_IS_AUTHENTICATED</b>
76  * is set, then the connection does not need to authenticate.
77  */
78 int
80 {
81  if (BUG(! SOCKET_OK(sock)))
82  return -1;
83  const int is_owner = !!(flags & CC_LOCAL_FD_IS_OWNER);
84  const int is_authenticated = !!(flags & CC_LOCAL_FD_IS_AUTHENTICATED);
85  control_connection_t *control_conn = control_connection_new(AF_UNSPEC);
86  connection_t *conn = TO_CONN(control_conn);
87  conn->s = sock;
88  tor_addr_make_unspec(&conn->addr);
89  conn->port = 1;
90  conn->address = tor_strdup("<local socket>");
91 
92  /* We take ownership of this socket so that later, when we close it,
93  * we don't freak out. */
95 
96  if (set_socket_nonblocking(sock) < 0 ||
97  connection_add(conn) < 0) {
98  connection_free(conn);
99  return -1;
100  }
101 
102  control_conn->is_owning_control_connection = is_owner;
103 
104  if (connection_init_accepted_conn(conn, NULL) < 0) {
105  connection_mark_for_close(conn);
106  return -1;
107  }
108 
109  if (is_authenticated) {
111  }
112 
113  return 0;
114 }
115 
116 /** Write all of the open control ports to ControlPortWriteToFile */
117 void
119 {
120  smartlist_t *lines;
121  char *joined = NULL;
122  const or_options_t *options = get_options();
123 
124  if (!options->ControlPortWriteToFile)
125  return;
126 
127  lines = smartlist_new();
128 
130  if (conn->type != CONN_TYPE_CONTROL_LISTENER || conn->marked_for_close)
131  continue;
132 #ifdef AF_UNIX
133  if (conn->socket_family == AF_UNIX) {
134  smartlist_add_asprintf(lines, "UNIX_PORT=%s\n", conn->address);
135  continue;
136  }
137 #endif /* defined(AF_UNIX) */
138  smartlist_add_asprintf(lines, "PORT=%s:%d\n", conn->address, conn->port);
139  } SMARTLIST_FOREACH_END(conn);
140 
141  joined = smartlist_join_strings(lines, "", 0, NULL);
142 
143  if (write_str_to_file(options->ControlPortWriteToFile, joined, 0) < 0) {
144  log_warn(LD_CONTROL, "Writing %s failed: %s",
145  options->ControlPortWriteToFile, strerror(errno));
146  }
147 #ifndef _WIN32
148  if (options->ControlPortFileGroupReadable) {
149  if (chmod(options->ControlPortWriteToFile, 0640)) {
150  log_warn(LD_FS,"Unable to make %s group-readable.",
151  options->ControlPortWriteToFile);
152  }
153  }
154 #endif /* !defined(_WIN32) */
155  tor_free(joined);
156  SMARTLIST_FOREACH(lines, char *, cp, tor_free(cp));
157  smartlist_free(lines);
158 }
159 
160 const struct signal_name_t signal_table[] = {
161  { SIGHUP, "RELOAD" },
162  { SIGHUP, "HUP" },
163  { SIGINT, "SHUTDOWN" },
164  { SIGUSR1, "DUMP" },
165  { SIGUSR1, "USR1" },
166  { SIGUSR2, "DEBUG" },
167  { SIGUSR2, "USR2" },
168  { SIGTERM, "HALT" },
169  { SIGTERM, "TERM" },
170  { SIGTERM, "INT" },
171  { SIGNEWNYM, "NEWNYM" },
172  { SIGCLEARDNSCACHE, "CLEARDNSCACHE"},
173  { SIGHEARTBEAT, "HEARTBEAT"},
174  { SIGACTIVE, "ACTIVE" },
175  { SIGDORMANT, "DORMANT" },
176  { 0, NULL },
177 };
178 
179 /** Called when <b>conn</b> has no more bytes left on its outbuf. */
180 int
182 {
183  tor_assert(conn);
184  return 0;
185 }
186 
187 /** Called when <b>conn</b> has gotten its socket closed. */
188 int
190 {
191  tor_assert(conn);
192 
193  log_info(LD_CONTROL,"Control connection reached EOF. Closing.");
194  connection_mark_for_close(TO_CONN(conn));
195  return 0;
196 }
197 
198 /** Shut down this Tor instance in the same way that SIGINT would, but
199  * with a log message appropriate for the loss of an owning controller. */
200 static void
201 lost_owning_controller(const char *owner_type, const char *loss_manner)
202 {
203  log_notice(LD_CONTROL, "Owning controller %s has %s -- exiting now.",
204  owner_type, loss_manner);
205 
206  activate_signal(SIGTERM);
207 }
208 
209 /** Called when <b>conn</b> is being freed. */
210 void
212 {
213  tor_assert(conn);
214 
215  conn->event_mask = 0;
217 
218  /* Close all ephemeral Onion Services if any.
219  * The list and it's contents are scrubbed/freed in connection_free_.
220  */
221  if (conn->ephemeral_onion_services) {
223  if (rend_valid_v2_service_id(cp)) {
225  } else if (hs_address_is_valid(cp)) {
227  } else {
228  /* An invalid .onion in our list should NEVER happen */
230  }
231  } SMARTLIST_FOREACH_END(cp);
232  }
233 
234  if (conn->is_owning_control_connection) {
235  lost_owning_controller("connection", "closed");
236  }
237 }
238 
239 /** Return true iff <b>cmd</b> is allowable (or at least forgivable) at this
240  * stage of the protocol. */
241 static int
243 {
244  if (conn->base_.state == CONTROL_CONN_STATE_OPEN)
245  return 1;
246  if (!strcasecmp(cmd, "PROTOCOLINFO"))
247  return (!conn->have_sent_protocolinfo &&
248  conn->safecookie_client_hash == NULL);
249  if (!strcasecmp(cmd, "AUTHCHALLENGE"))
250  return (conn->safecookie_client_hash == NULL);
251  if (!strcasecmp(cmd, "AUTHENTICATE") ||
252  !strcasecmp(cmd, "QUIT"))
253  return 1;
254  return 0;
255 }
256 
257 /** Do not accept any control command of more than 1MB in length. Anything
258  * that needs to be anywhere near this long probably means that one of our
259  * interfaces is broken. */
260 #define MAX_COMMAND_LINE_LENGTH (1024*1024)
261 
262 /** Wrapper around peek_buf_has_control0 command: presents the same
263  * interface as that underlying functions, but takes a connection_t intead of
264  * a buf_t.
265  */
266 static int
268 {
269  return peek_buf_has_control0_command(conn->inbuf);
270 }
271 
272 static int
273 peek_connection_has_http_command(connection_t *conn)
274 {
275  return peek_buf_has_http_command(conn->inbuf);
276 }
277 
278 /**
279  * Helper: take a nul-terminated command of given length, and find where the
280  * command starts and the arguments begin. Separate them, allocate a new
281  * string in <b>current_cmd_out</b> for the command, and return a pointer
282  * to the arguments.
283  **/
284 STATIC char *
286  size_t *data_len,
287  char **current_cmd_out)
288 {
289  const bool is_multiline = *data_len && incoming_cmd[0] == '+';
290  size_t cmd_len = 0;
291  while (cmd_len < *data_len
292  && !TOR_ISSPACE(incoming_cmd[cmd_len]))
293  ++cmd_len;
294 
295  *current_cmd_out = tor_memdup_nulterm(incoming_cmd, cmd_len);
296  char *args = incoming_cmd+cmd_len;
297  tor_assert(*data_len>=cmd_len);
298  *data_len -= cmd_len;
299  if (is_multiline) {
300  // Only match horizontal space: any line after the first is data,
301  // not arguments.
302  while ((*args == '\t' || *args == ' ') && *data_len) {
303  ++args;
304  --*data_len;
305  }
306  } else {
307  while (TOR_ISSPACE(*args) && *data_len) {
308  ++args;
309  --*data_len;
310  }
311  }
312 
313  return args;
314 }
315 
316 static const char CONTROLPORT_IS_NOT_AN_HTTP_PROXY_MSG[] =
317  "HTTP/1.0 501 Tor ControlPort is not an HTTP proxy"
318  "\r\nContent-Type: text/html; charset=iso-8859-1\r\n\r\n"
319  "<html>\n"
320  "<head>\n"
321  "<title>Tor's ControlPort is not an HTTP proxy</title>\n"
322  "</head>\n"
323  "<body>\n"
324  "<h1>Tor's ControlPort is not an HTTP proxy</h1>\n"
325  "<p>\n"
326  "It appears you have configured your web browser to use Tor's control port"
327  " as an HTTP proxy.\n"
328  "This is not correct: Tor's default SOCKS proxy port is 9050.\n"
329  "Please configure your client accordingly.\n"
330  "</p>\n"
331  "<p>\n"
332  "See <a href=\"https://www.torproject.org/documentation.html\">"
333  "https://www.torproject.org/documentation.html</a> for more "
334  "information.\n"
335  "<!-- Plus this comment, to make the body response more than 512 bytes, so "
336  " IE will be willing to display it. Comment comment comment comment "
337  " comment comment comment comment comment comment comment comment.-->\n"
338  "</p>\n"
339  "</body>\n"
340  "</html>\n";
341 
342 /** Return an error on a control connection that tried to use the v0 protocol.
343  */
344 static void
346 {
347  size_t body_len;
348  char buf[128];
349  set_uint16(buf+2, htons(0x0000)); /* type == error */
350  set_uint16(buf+4, htons(0x0001)); /* code == internal error */
351  strlcpy(buf+6, "The v0 control protocol is not supported by Tor 0.1.2.17 "
352  "and later; upgrade your controller.",
353  sizeof(buf)-6);
354  body_len = 2+strlen(buf+6)+2; /* code, msg, nul. */
355  set_uint16(buf+0, htons(body_len));
356  connection_buf_add(buf, 4+body_len, TO_CONN(conn));
357 
358  connection_mark_and_flush(TO_CONN(conn));
359 }
360 
361 /** Return an error on a control connection that tried to use HTTP.
362  */
363 static void
365 {
366  connection_write_str_to_buf(CONTROLPORT_IS_NOT_AN_HTTP_PROXY_MSG, conn);
367  log_notice(LD_CONTROL, "Received HTTP request on ControlPort");
368  connection_mark_and_flush(TO_CONN(conn));
369 }
370 
371 /** Check if a control connection has tried to use a known invalid protocol.
372  * If it has, then:
373  * - send a reject response,
374  * - log a notice-level message, and
375  * - return false. */
376 static bool
378 {
379  /* Detect v0 commands and send a "no more v0" message. */
380  if (conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH &&
383  return 0;
384  }
385 
386  /* If the user has the HTTP proxy port and the control port confused. */
387  if (conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH &&
388  peek_connection_has_http_command(TO_CONN(conn))) {
390  return 0;
391  }
392 
393  return 1;
394 }
395 
396 /** Called when data has arrived on a v1 control connection: Try to fetch
397  * commands from conn->inbuf, and execute them.
398  */
399 int
401 {
402  size_t data_len;
403  uint32_t cmd_data_len;
404  char *args;
405 
406  tor_assert(conn);
407  tor_assert(conn->base_.state == CONTROL_CONN_STATE_OPEN ||
408  conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH);
409 
410  if (!conn->incoming_cmd) {
411  conn->incoming_cmd = tor_malloc(1024);
412  conn->incoming_cmd_len = 1024;
413  conn->incoming_cmd_cur_len = 0;
414  }
415 
416  if (!control_protocol_is_valid(conn)) {
417  return 0;
418  }
419 
420  again:
421  while (1) {
422  size_t last_idx;
423  int r;
424  /* First, fetch a line. */
425  do {
426  data_len = conn->incoming_cmd_len - conn->incoming_cmd_cur_len;
429  &data_len);
430  if (r == 0)
431  /* Line not all here yet. Wait. */
432  return 0;
433  else if (r == -1) {
434  if (data_len + conn->incoming_cmd_cur_len > MAX_COMMAND_LINE_LENGTH) {
435  control_write_endreply(conn, 500, "Line too long.");
437  connection_mark_and_flush(TO_CONN(conn));
438  }
439  while (conn->incoming_cmd_len < data_len+conn->incoming_cmd_cur_len)
440  conn->incoming_cmd_len *= 2;
441  conn->incoming_cmd = tor_realloc(conn->incoming_cmd,
442  conn->incoming_cmd_len);
443  }
444  } while (r != 1);
445 
446  tor_assert(data_len);
447 
448  last_idx = conn->incoming_cmd_cur_len;
449  conn->incoming_cmd_cur_len += (int)data_len;
450 
451  /* We have appended a line to incoming_cmd. Is the command done? */
452  if (last_idx == 0 && *conn->incoming_cmd != '+')
453  /* One line command, didn't start with '+'. */
454  break;
455  /* XXXX this code duplication is kind of dumb. */
456  if (last_idx+3 == conn->incoming_cmd_cur_len &&
457  tor_memeq(conn->incoming_cmd + last_idx, ".\r\n", 3)) {
458  /* Just appended ".\r\n"; we're done. Remove it. */
459  conn->incoming_cmd[last_idx] = '\0';
460  conn->incoming_cmd_cur_len -= 3;
461  break;
462  } else if (last_idx+2 == conn->incoming_cmd_cur_len &&
463  tor_memeq(conn->incoming_cmd + last_idx, ".\n", 2)) {
464  /* Just appended ".\n"; we're done. Remove it. */
465  conn->incoming_cmd[last_idx] = '\0';
466  conn->incoming_cmd_cur_len -= 2;
467  break;
468  }
469  /* Otherwise, read another line. */
470  }
471  data_len = conn->incoming_cmd_cur_len;
472 
473  /* Okay, we now have a command sitting on conn->incoming_cmd. See if we
474  * recognize it.
475  */
476  tor_free(conn->current_cmd);
477  args = control_split_incoming_command(conn->incoming_cmd, &data_len,
478  &conn->current_cmd);
479  if (BUG(!conn->current_cmd))
480  return -1;
481 
482  /* If the connection is already closing, ignore further commands */
483  if (TO_CONN(conn)->marked_for_close) {
484  return 0;
485  }
486 
487  /* Otherwise, Quit is always valid. */
488  if (!strcasecmp(conn->current_cmd, "QUIT")) {
489  control_write_endreply(conn, 250, "closing connection");
490  connection_mark_and_flush(TO_CONN(conn));
491  return 0;
492  }
493 
494  if (conn->base_.state == CONTROL_CONN_STATE_NEEDAUTH &&
495  !is_valid_initial_command(conn, conn->current_cmd)) {
496  control_write_endreply(conn, 514, "Authentication required.");
497  connection_mark_for_close(TO_CONN(conn));
498  return 0;
499  }
500 
501  if (data_len >= UINT32_MAX) {
502  control_write_endreply(conn, 500, "A 4GB command? Nice try.");
503  connection_mark_for_close(TO_CONN(conn));
504  return 0;
505  }
506 
507  cmd_data_len = (uint32_t)data_len;
508  if (handle_control_command(conn, cmd_data_len, args) < 0)
509  return -1;
510 
511  conn->incoming_cmd_cur_len = 0;
512  goto again;
513 }
514 
515 /** Cached liveness for network liveness events and GETINFO
516  */
517 
518 static int network_is_live = 0;
519 
520 int
521 get_cached_network_liveness(void)
522 {
523  return network_is_live;
524 }
525 
526 void
527 set_cached_network_liveness(int liveness)
528 {
529  network_is_live = liveness;
530 }
531 
532 /** A copy of the process specifier of Tor's owning controller, or
533  * NULL if this Tor instance is not currently owned by a process. */
534 static char *owning_controller_process_spec = NULL;
535 
536 /** A process-termination monitor for Tor's owning controller, or NULL
537  * if this Tor instance is not currently owned by a process. */
539 
540 /** Process-termination monitor callback for Tor's owning controller
541  * process. */
542 static void
544 {
545  (void)unused;
546 
547  lost_owning_controller("process", "vanished");
548 }
549 
550 /** Set <b>process_spec</b> as Tor's owning controller process.
551  * Exit on failure. */
552 void
553 monitor_owning_controller_process(const char *process_spec)
554 {
555  const char *msg;
556 
559 
560  if (owning_controller_process_spec != NULL) {
561  if ((process_spec != NULL) && !strcmp(process_spec,
563  /* Same process -- return now, instead of disposing of and
564  * recreating the process-termination monitor. */
565  return;
566  }
567 
568  /* We are currently owned by a process, and we should no longer be
569  * owned by it. Free the process-termination monitor. */
570  tor_process_monitor_free(owning_controller_process_monitor);
572 
575  }
576 
579 
580  if (process_spec == NULL)
581  return;
582 
583  owning_controller_process_spec = tor_strdup(process_spec);
587  LD_CONTROL,
589  &msg);
590 
591  if (owning_controller_process_monitor == NULL) {
592  log_err(LD_BUG, "Couldn't create process-termination monitor for "
593  "owning controller: %s. Exiting.",
594  msg);
597  }
598 }
599 
600 /** Free any leftover allocated memory of the control.c subsystem. */
601 void
603 {
604  control_auth_free_all();
605  control_events_free_all();
606  control_cmd_free_all();
608 }
int set_socket_nonblocking(tor_socket_t sock)
Definition: socket.c:561
smartlist_t * get_connection_array(void)
Definition: mainloop.c:452
Header file for rendcommon.c.
#define CONN_TYPE_CONTROL_LISTENER
Definition: connection.h:38
Header file for control_auth.c.
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define TO_CONN(c)
Definition: or.h:735
unsigned int have_sent_protocolinfo
void tor_addr_make_unspec(tor_addr_t *a)
Definition: address.c:225
Header file for connection.c.
void connection_write_str_to_buf(const char *s, control_connection_t *conn)
Definition: control_proto.c:30
static void set_uint16(void *cp, uint16_t v)
Definition: bytes.h:78
char * ControlPortWriteToFile
void tor_take_socket_ownership(tor_socket_t s)
Definition: socket.c:335
#define DOWNCAST(to, ptr)
Definition: or.h:110
Headers for procmon.c.
int peek_buf_has_control0_command(buf_t *buf)
int hs_address_is_valid(const char *address)
Definition: hs_common.c:950
void monitor_owning_controller_process(const char *process_spec)
Definition: control.c:553
#define CONTROL_CONN_STATE_OPEN
Definition: control.h:19
int hs_service_del_ephemeral(const char *address)
Definition: hs_service.c:3604
Header file for config.c.
control_connection_t * TO_CONTROL_CONN(connection_t *c)
Definition: control.c:67
static int network_is_live
Definition: control.c:518
const or_options_t * get_options(void)
Definition: config.c:941
#define tor_assert(expr)
Definition: util_bug.h:102
static int is_valid_initial_command(control_connection_t *conn, const char *cmd)
Definition: control.c:242
void connection_control_closed(control_connection_t *conn)
Definition: control.c:211
#define tor_free(p)
Definition: malloc.h:52
void tor_shutdown_event_loop_and_exit(int exitcode)
Definition: mainloop.c:765
#define tor_fragile_assert()
Definition: util_bug.h:246
Header file for mainloop.c.
smartlist_t * smartlist_new(void)
#define STATIC
Definition: testsupport.h:32
Header file for main.c.
int write_str_to_file(const char *fname, const char *str, int bin)
Definition: files.c:258
control_connection_t * control_connection_new(int socket_family)
Definition: connection.c:426
int handle_control_command(control_connection_t *conn, uint32_t cmd_data_len, char *args)
Definition: control_cmd.c:2373
#define SOCKET_OK(s)
Definition: nettypes.h:39
#define LD_CONTROL
Definition: log.h:80
void control_free_all(void)
Definition: control.c:602
int connection_control_reached_eof(control_connection_t *conn)
Definition: control.c:189
int tor_memeq(const void *a, const void *b, size_t sz)
Definition: di_ops.c:107
static int peek_connection_has_control0_command(connection_t *conn)
Definition: control.c:267
void control_update_global_event_mask(void)
int connection_control_process_inbuf(control_connection_t *conn)
Definition: control.c:400
tor_socket_t s
Definition: connection_st.h:93
#define CONTROL_CONN_STATE_NEEDAUTH
Definition: control.h:22
int connection_init_accepted_conn(connection_t *conn, const listener_connection_t *listener)
Definition: connection.c:1875
void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern,...)
Definition: smartlist.c:36
static tor_process_monitor_t * owning_controller_process_monitor
Definition: control.c:538
#define MAX_COMMAND_LINE_LENGTH
Definition: control.c:260
Master header file for Tor-specific functionality.
int peek_buf_has_http_command(const buf_t *buf)
Definition: proto_http.c:19
struct buf_t * inbuf
Definition: connection_st.h:98
void control_event_bootstrap_reset(void)
int control_connection_add_local_fd(tor_socket_t sock, unsigned flags)
Definition: control.c:79
Header for proto_control0.c.
STATIC char * control_split_incoming_command(char *incoming_cmd, size_t *data_len, char **current_cmd_out)
Definition: control.c:285
int rend_valid_v2_service_id(const char *query)
Definition: rendcommon.c:719
static void owning_controller_procmon_cb(void *unused)
Definition: control.c:543
struct event_base * tor_libevent_get_base(void)
Header file for control_cmd.c.
int rend_service_del_ephemeral(const char *service_id)
Definition: rendservice.c:972
Header file for rendservice.c.
#define tor_socket_t
Definition: nettypes.h:36
static void control_send_v0_reject(control_connection_t *conn)
Definition: control.c:345
#define LD_FS
Definition: log.h:70
int ControlPortFileGroupReadable
char * smartlist_join_strings(smartlist_t *sl, const char *join, int terminate, size_t *len_out)
Definition: smartlist.c:279
uint32_t magic
Definition: connection_st.h:46
void connection_stop_reading(connection_t *conn)
Definition: mainloop.c:610
#define SMARTLIST_FOREACH(sl, type, var, cmd)
uint16_t port
void control_write_endreply(control_connection_t *conn, int code, const char *s)
Controller connection structure.
int connection_control_finished_flushing(control_connection_t *conn)
Definition: control.c:181
Header file for control.c.
static char * owning_controller_process_spec
Definition: control.c:534
static bool control_protocol_is_valid(control_connection_t *conn)
Definition: control.c:377
Header for proto_http.c.
Header file for control_proto.c.
static void control_send_http_reject(control_connection_t *conn)
Definition: control.c:364
unsigned int is_owning_control_connection
tor_addr_t addr
Header file for connection_or.c.
smartlist_t * ephemeral_onion_services
Header file for control_events.c.
tor_process_monitor_t * tor_process_monitor_new(struct event_base *base, const char *process_spec, log_domain_mask_t log_domain, tor_procmon_callback_t cb, void *cb_arg, const char **msg)
Definition: procmon.c:181
int connection_buf_get_line(connection_t *conn, char *data, size_t *data_len)
Definition: connection.c:3898
static void lost_owning_controller(const char *owner_type, const char *loss_manner)
Definition: control.c:201
uint8_t state
Definition: connection_st.h:49
#define LD_BUG
Definition: log.h:86
void control_ports_write_to_file(void)
Definition: control.c:118