diff options
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/connection.c | 2 | ||||
-rw-r--r-- | src/or/include.am | 2 | ||||
-rw-r--r-- | src/or/main.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 32 | ||||
-rw-r--r-- | src/or/policies.c | 2 | ||||
-rw-r--r-- | src/or/port_cfg_st.h | 35 | ||||
-rw-r--r-- | src/or/router.c | 2 | ||||
-rw-r--r-- | src/or/server_port_cfg_st.h | 20 | ||||
-rw-r--r-- | src/test/test_config.c | 1 | ||||
-rw-r--r-- | src/test/test_dir.c | 2 | ||||
-rw-r--r-- | src/test/test_policy.c | 2 |
12 files changed, 74 insertions, 30 deletions
diff --git a/src/or/config.c b/src/or/config.c index 94a58f3488..51ecca4318 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -116,6 +116,8 @@ #include "dirauth/dirvote.h" #include "dirauth/mode.h" +#include "port_cfg_st.h" + #ifdef HAVE_SYSTEMD # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse diff --git a/src/or/connection.c b/src/or/connection.c index 5185b45b14..0f64982251 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -113,6 +113,8 @@ #include <sys/un.h> #endif +#include "port_cfg_st.h" + static connection_t *connection_listener_new( const struct sockaddr *listensockaddr, socklen_t listensocklen, int type, diff --git a/src/or/include.am b/src/or/include.am index c38e677a61..1dc6c79ca2 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -246,6 +246,7 @@ ORHEADERS = \ src/or/transports.h \ src/or/parsecommon.h \ src/or/periodic.h \ + src/or/port_cfg_st.h \ src/or/policies.h \ src/or/protover.h \ src/or/proto_cell.h \ @@ -270,6 +271,7 @@ ORHEADERS = \ src/or/routerset.h \ src/or/routerparse.h \ src/or/scheduler.h \ + src/or/server_port_cfg_st.h \ src/or/shared_random_client.h \ src/or/statefile.h \ src/or/status.h \ diff --git a/src/or/main.c b/src/or/main.c index 9dce158b33..1f6d16a19d 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -122,6 +122,8 @@ #include "dirauth/mode.h" #include "dirauth/shared_random.h" +#include "port_cfg_st.h" + #ifdef HAVE_SYSTEMD # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse diff --git a/src/or/or.h b/src/or/or.h index 5321c81c81..6c54c27520 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1248,15 +1248,7 @@ typedef struct { typedef struct socks_request_t socks_request_t; typedef struct entry_port_cfg_t entry_port_cfg_t; - -typedef struct server_port_cfg_t { - /* Server port types (or, dir) only: */ - unsigned int no_advertise : 1; - unsigned int no_listen : 1; - unsigned int all_addrs : 1; - unsigned int bind_ipv4_only : 1; - unsigned int bind_ipv6_only : 1; -} server_port_cfg_t; +typedef struct server_port_cfg_t server_port_cfg_t; /* Values for connection_t.magic: used to make sure that downcasts (casts from * connection_t to foo_connection_t) are safe. */ @@ -3585,27 +3577,7 @@ static inline const origin_circuit_t *CONST_TO_ORIGIN_CIRCUIT( /** First automatically allocated session group number */ #define SESSION_GROUP_FIRST_AUTO -4 -/** Configuration for a single port that we're listening on. */ -typedef struct port_cfg_t { - tor_addr_t addr; /**< The actual IP to listen on, if !is_unix_addr. */ - int port; /**< The configured port, or CFG_AUTO_PORT to tell Tor to pick its - * own port. */ - uint8_t type; /**< One of CONN_TYPE_*_LISTENER */ - unsigned is_unix_addr : 1; /**< True iff this is an AF_UNIX address. */ - - unsigned is_group_writable : 1; - unsigned is_world_writable : 1; - unsigned relax_dirmode_check : 1; - - entry_port_cfg_t entry_cfg; - - server_port_cfg_t server_cfg; - - /* Unix sockets only: */ - /** Path for an AF_UNIX address */ - char unix_addr[FLEXIBLE_ARRAY_MEMBER]; -} port_cfg_t; - +typedef struct port_cfg_t port_cfg_t; typedef struct routerset_t routerset_t; /** A magic value for the (Socks|OR|...)Port options below, telling Tor diff --git a/src/or/policies.c b/src/or/policies.c index 1210ca687d..a78e8a1c86 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -30,6 +30,8 @@ #include "geoip.h" #include "ht.h" +#include "port_cfg_st.h" + /** Policy that addresses for incoming SOCKS connections must match. */ static smartlist_t *socks_policy = NULL; /** Policy that addresses for incoming directory connections must match. */ diff --git a/src/or/port_cfg_st.h b/src/or/port_cfg_st.h new file mode 100644 index 0000000000..8b6b018c59 --- /dev/null +++ b/src/or/port_cfg_st.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2017, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +#ifndef PORT_CFG_ST_H +#define PORT_CFG_ST_H + +#include "entry_port_cfg_st.h" +#include "server_port_cfg_st.h" + +/** Configuration for a single port that we're listening on. */ +struct port_cfg_t { + tor_addr_t addr; /**< The actual IP to listen on, if !is_unix_addr. */ + int port; /**< The configured port, or CFG_AUTO_PORT to tell Tor to pick its + * own port. */ + uint8_t type; /**< One of CONN_TYPE_*_LISTENER */ + unsigned is_unix_addr : 1; /**< True iff this is an AF_UNIX address. */ + + unsigned is_group_writable : 1; + unsigned is_world_writable : 1; + unsigned relax_dirmode_check : 1; + + entry_port_cfg_t entry_cfg; + + server_port_cfg_t server_cfg; + + /* Unix sockets only: */ + /** Path for an AF_UNIX address */ + char unix_addr[FLEXIBLE_ARRAY_MEMBER]; +}; + +#endif + diff --git a/src/or/router.c b/src/or/router.c index 3879863e82..9eaef44605 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -39,6 +39,8 @@ #include "dirauth/mode.h" +#include "port_cfg_st.h" + /** * \file router.c * \brief Miscellaneous relay functionality, including RSA key maintenance, diff --git a/src/or/server_port_cfg_st.h b/src/or/server_port_cfg_st.h new file mode 100644 index 0000000000..7a6a0a53fe --- /dev/null +++ b/src/or/server_port_cfg_st.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2017, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +#ifndef SERVER_PORT_CFG_ST_H +#define SERVER_PORT_CFG_ST_H + +struct server_port_cfg_t { + /* Server port types (or, dir) only: */ + unsigned int no_advertise : 1; + unsigned int no_listen : 1; + unsigned int all_addrs : 1; + unsigned int bind_ipv4_only : 1; + unsigned int bind_ipv6_only : 1; +}; + +#endif + diff --git a/src/test/test_config.c b/src/test/test_config.c index 461aa646d6..e8bfe9e12e 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -43,6 +43,7 @@ #include "statefile.h" #include "test_helpers.h" +#include "port_cfg_st.h" static void test_config_addressmap(void *arg) diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 0106e40d97..538fb8db15 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -44,6 +44,8 @@ #include "log_test_helpers.h" #include "voting_schedule.h" +#include "port_cfg_st.h" + #define NS_MODULE dir static void diff --git a/src/test/test_policy.c b/src/test/test_policy.c index e89d49aaf5..e55452d3e4 100644 --- a/src/test/test_policy.c +++ b/src/test/test_policy.c @@ -10,6 +10,8 @@ #include "policies.h" #include "test.h" +#include "port_cfg_st.h" + /* Helper: assert that short_policy parses and writes back out as itself, or as <b>expected</b> if that's provided. */ static void |