r7304@Kushana: nickm | 2006-08-10 01:58:05 -0700

Fix verbose compilation errors; make sure transparent proxy fails when no method is configured.


svn:r7012
This commit is contained in:
Nick Mathewson 2006-08-10 09:02:26 +00:00
parent 3da737ac98
commit 7ddd9e8cd9
3 changed files with 13 additions and 7 deletions

View File

@ -2072,6 +2072,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
int is_socks = i==0; int is_socks = i==0;
config_line_t *line, *opt, *old; config_line_t *line, *opt, *old;
const char *tp = is_socks ? "SOCKS proxy" : "transparent proxy";
if (is_socks) { if (is_socks) {
opt = options->SocksListenAddress; opt = options->SocksListenAddress;
old = old_options->SocksListenAddress; old = old_options->SocksListenAddress;
@ -2079,7 +2080,6 @@ options_validate(or_options_t *old_options, or_options_t *options,
opt = options->TransListenAddress; opt = options->TransListenAddress;
old = old_options->TransListenAddress; old = old_options->TransListenAddress;
} }
const char *tp = is_socks ? "SOCKS proxy" : "transparent proxy";
for (line = opt; line; line = line->next) { for (line = opt; line; line = line->next) {
char *address = NULL; char *address = NULL;

View File

@ -1290,9 +1290,9 @@ connection_ap_get_original_destination(edge_connection_t *conn,
tor_inet_ntoa(&orig_dst.sin_addr, tmpbuf, sizeof(tmpbuf)); tor_inet_ntoa(&orig_dst.sin_addr, tmpbuf, sizeof(tmpbuf));
strlcpy(req->address, tmpbuf, sizeof(req->address)); strlcpy(req->address, tmpbuf, sizeof(req->address));
req->port = ntohs(orig_dst.sin_port); req->port = ntohs(orig_dst.sin_port);
#endif
#ifdef TRANS_PF return 0;
#elif defined(TRANS_PF)
struct sockaddr_in proxy_addr; struct sockaddr_in proxy_addr;
socklen_t proxy_addr_len = sizeof(proxy_addr); socklen_t proxy_addr_len = sizeof(proxy_addr);
char tmpbuf[INET_NTOA_BUF_LEN]; char tmpbuf[INET_NTOA_BUF_LEN];
@ -1327,9 +1327,15 @@ connection_ap_get_original_destination(edge_connection_t *conn,
tor_inet_ntoa(&pnl.rdaddr.v4, tmpbuf, sizeof(tmpbuf)); tor_inet_ntoa(&pnl.rdaddr.v4, tmpbuf, sizeof(tmpbuf));
strlcpy(req->address, tmpbuf, sizeof(req->address)); strlcpy(req->address, tmpbuf, sizeof(req->address));
req->port = ntohs(pnl.rdport); req->port = ntohs(pnl.rdport);
#endif
return 0; return 0;
#else
(void)conn;
(void)req;
log_warn(LD_BUG, "Called connection_ap_get_original_destination, but no "
"transparent proxy method was configured.");
return -1;
#endif
} }
/** connection_edge_process_inbuf() found a conn in state /** connection_edge_process_inbuf() found a conn in state

View File

@ -95,7 +95,7 @@ typedef struct cached_resolve_t {
pending_connection_t *pending_connections; pending_connection_t *pending_connections;
} cached_resolve_t; } cached_resolve_t;
static void purge_expired_resolves(uint32_t now); static void purge_expired_resolves(time_t now);
static void dns_found_answer(const char *address, uint32_t addr, char outcome, static void dns_found_answer(const char *address, uint32_t addr, char outcome,
uint32_t ttl); uint32_t ttl);
static void send_resolved_cell(edge_connection_t *conn, uint8_t answer_type); static void send_resolved_cell(edge_connection_t *conn, uint8_t answer_type);
@ -253,7 +253,7 @@ dns_free_all(void)
/** Remove every cached_resolve whose <b>expire</b> time is before <b>now</b> /** Remove every cached_resolve whose <b>expire</b> time is before <b>now</b>
* from the cache. */ * from the cache. */
static void static void
purge_expired_resolves(uint32_t now) purge_expired_resolves(time_t now)
{ {
cached_resolve_t *resolve, *removed; cached_resolve_t *resolve, *removed;
pending_connection_t *pend; pending_connection_t *pend;
@ -386,7 +386,7 @@ dns_resolve(edge_connection_t *exitconn)
pending_connection_t *pending_connection; pending_connection_t *pending_connection;
struct in_addr in; struct in_addr in;
circuit_t *circ; circuit_t *circ;
uint32_t now = time(NULL); time_t now = time(NULL);
assert_connection_ok(TO_CONN(exitconn), 0); assert_connection_ok(TO_CONN(exitconn), 0);
tor_assert(exitconn->_base.s == -1); tor_assert(exitconn->_base.s == -1);