[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] fix assert triggers in 0.0.7.x: if the other side returns
- To: or-cvs@freehaven.net
- Subject: [or-cvs] fix assert triggers in 0.0.7.x: if the other side returns
- From: arma@seul.org (Roger Dingledine)
- Date: Sun, 15 Aug 2004 16:05:37 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sun, 15 Aug 2004 16:05:52 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
connection_edge.c relay.c
Log Message:
fix assert triggers in 0.0.7.x: if the other side returns
an address 0.0.0.0, don't put it into the client dns cache.
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- connection_edge.c 8 Aug 2004 05:26:13 -0000 1.206
+++ connection_edge.c 15 Aug 2004 20:05:35 -0000 1.207
@@ -633,7 +633,8 @@
if (answer_type == RESOLVED_TYPE_IPV4) {
uint32_t a = get_uint32(answer);
- client_dns_set_entry(conn->socks_request->address, ntohl(a));
+ if(a)
+ client_dns_set_entry(conn->socks_request->address, ntohl(a));
}
if (conn->socks_request->socks_version == 4) {
Index: relay.c
===================================================================
RCS file: /home/or/cvsroot/src/or/relay.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- relay.c 15 Aug 2004 08:15:12 -0000 1.10
+++ relay.c 15 Aug 2004 20:05:35 -0000 1.11
@@ -502,9 +502,17 @@
log_fn(LOG_WARN,"Got an end because of exitpolicy, but we're not an AP. Closing.");
return -1;
}
- log_fn(LOG_INFO,"Address %s refused due to exit policy. Retrying.",
- conn->socks_request->address);
addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE+1));
+ if(addr) {
+ log_fn(LOG_INFO,"Address %s refused due to exit policy. Retrying.",
+ conn->socks_request->address);
+ } else {
+ log_fn(LOG_INFO,"Address %s resolved to 0.0.0.0. Closing,",
+ conn->socks_request->address);
+ conn->has_sent_end = 1; /* we just got an 'end', don't need to send one */
+ connection_mark_for_close(conn);
+ return 0;
+ }
client_dns_set_entry(conn->socks_request->address, addr);
/* check if he *ought* to have allowed it */
@@ -564,12 +572,18 @@
}
// log_fn(LOG_INFO,"Connected! Notifying application.");
conn->state = AP_CONN_STATE_OPEN;
+ log_fn(LOG_INFO,"'connected' received after %d seconds.",
+ (int)(time(NULL) - conn->timestamp_lastread));
if (rh->length >= 4) {
addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE));
+ if(!addr) {
+ log_fn(LOG_INFO,"...but it claims the IP address was 0.0.0.0. Closing.");
+ connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer);
+ connection_mark_for_close(conn);
+ return 0;
+ }
client_dns_set_entry(conn->socks_request->address, addr);
}
- log_fn(LOG_INFO,"'connected' received after %d seconds.",
- (int)(time(NULL) - conn->timestamp_lastread));
circuit_log_path(LOG_INFO,circ);
connection_ap_handshake_socks_reply(conn, NULL, 0, 1);
conn->socks_request->has_finished = 1;