Commit b9628f26 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

change WARNING to WARN

and fix a few typos


svn:r571
parent 36fb8e83
......@@ -221,7 +221,7 @@ int write_to_buf(const char *string, int string_len, buf_t *buf) {
/* this is the point where you would grow the buffer, if you want to */
if (string_len + buf->datalen > buf->len) { /* we're out of luck */
log_fn(LOG_WARNING, "buflen too small. Time to implement growing dynamic bufs.");
log_fn(LOG_WARN, "buflen too small. Time to implement growing dynamic bufs.");
return -1;
}
......@@ -280,11 +280,11 @@ int fetch_from_buf_http(buf_t *buf,
log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.",headerlen,bodylen);
if(headers_out && max_headerlen <= headerlen) {
log_fn(LOG_WARNING,"headerlen %d larger than %d. Failing.", headerlen, max_headerlen-1);
log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", headerlen, max_headerlen-1);
return -1;
}
if(body_out && max_bodylen <= bodylen) {
log_fn(LOG_WARNING,"bodylen %d larger than %d. Failing.", bodylen, max_bodylen-1);
log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", bodylen, max_bodylen-1);
return -1;
}
......@@ -356,7 +356,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
if(buf->datalen < 2+nummethods)
return 0;
if(!nummethods || !memchr(buf->buf+2, 0, nummethods)) {
log_fn(LOG_WARNING,"socks5: offered methods don't include 'no auth'. Rejecting.");
log_fn(LOG_WARN,"socks5: offered methods don't include 'no auth'. Rejecting.");
*replylen = 2; /* 2 bytes of response */
*reply = 5; /* socks5 reply */
*(reply+1) = 0xFF; /* reject all methods */
......@@ -377,7 +377,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
if(buf->datalen < 8) /* basic info plus >=2 for addr plus 2 for port */
return 0; /* not yet */
if(*(buf->buf+1) != 1) { /* not a connect? we don't support it. */
log_fn(LOG_WARNING,"socks5: command %d not '1'.",*(buf->buf+1));
log_fn(LOG_WARN,"socks5: command %d not '1'.",*(buf->buf+1));
return -1;
}
switch(*(buf->buf+3)) { /* address type */
......@@ -389,7 +389,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
in.s_addr = htonl(destip);
tmpbuf = inet_ntoa(in);
if(strlen(tmpbuf)+1 > max_addrlen) {
log_fn(LOG_WARNING,"socks5 IP takes %d bytes, which doesn't fit in %d",
log_fn(LOG_WARN,"socks5 IP takes %d bytes, which doesn't fit in %d",
strlen(tmpbuf)+1,max_addrlen);
return -1;
}
......@@ -404,7 +404,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
if(buf->datalen < 7+len) /* addr/port there? */
return 0; /* not yet */
if(len+1 > max_addrlen) {
log_fn(LOG_WARNING,"socks5 hostname is %d bytes, which doesn't fit in %d",
log_fn(LOG_WARN,"socks5 hostname is %d bytes, which doesn't fit in %d",
len+1,max_addrlen);
return -1;
}
......@@ -415,7 +415,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
memmove(buf->buf, buf->buf+(5+len+2), buf->datalen);
return 1;
default: /* unsupported */
log_fn(LOG_WARNING,"socks5: unsupported address type %d",*(buf->buf+3));
log_fn(LOG_WARN,"socks5: unsupported address type %d",*(buf->buf+3));
return -1;
}
assert(0);
......@@ -426,14 +426,14 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
return 0; /* not yet */
if(*(buf->buf+1) != 1) { /* not a connect? we don't support it. */
log_fn(LOG_WARNING,"socks4: command %d not '1'.",*(buf->buf+1));
log_fn(LOG_WARN,"socks4: command %d not '1'.",*(buf->buf+1));
return -1;
}
*port_out = ntohs(*(uint16_t*)(buf->buf+2));
destip = ntohl(*(uint32_t*)(buf->buf+4));
if(!*port_out || !destip) {
log_fn(LOG_WARNING,"socks4: Port or DestIP is zero.");
log_fn(LOG_WARN,"socks4: Port or DestIP is zero.");
return -1;
}
if(destip >> 8) {
......@@ -441,7 +441,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
in.s_addr = htonl(destip);
tmpbuf = inet_ntoa(in);
if(strlen(tmpbuf)+1 > max_addrlen) {
log_fn(LOG_WARNING,"socks4 addr (%d bytes) too long.", strlen(tmpbuf));
log_fn(LOG_WARN,"socks4 addr (%d bytes) too long.", strlen(tmpbuf));
return -1;
}
log_fn(LOG_DEBUG,"socks4: successfully read destip (%s)", tmpbuf);
......@@ -462,7 +462,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
return 0;
}
if(max_addrlen <= next-startaddr) {
log_fn(LOG_WARNING,"Destaddr too long.");
log_fn(LOG_WARN,"Destaddr too long.");
return -1;
}
}
......@@ -473,7 +473,7 @@ int fetch_from_buf_socks(buf_t *buf, char *socks_version,
return 1;
default: /* version is not socks4 or socks5 */
log_fn(LOG_WARNING,"Socks version %d not recognized.",*(buf->buf));
log_fn(LOG_WARN,"Socks version %d not recognized.",*(buf->buf));
return -1;
}
}
......
......@@ -231,7 +231,7 @@ int circuit_deliver_relay_cell(cell_t *cell, circuit_t *circ,
log_fn(LOG_DEBUG,"direction %d, streamid %d before crypt.", cell_direction, *(int*)(cell->payload+1));
if(relay_crypt(circ, buf, 1+CELL_PAYLOAD_SIZE, cell_direction, &layer_hint, &recognized, &conn) < 0) {
log_fn(LOG_WARNING,"relay crypt failed. Dropping connection.");
log_fn(LOG_WARN,"relay crypt failed. Dropping connection.");
return -1;
}
......@@ -281,7 +281,7 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
if(circ->cpath) { /* we're at the beginning of the circuit. We'll want to do layered crypts. */
thishop = circ->cpath;
if(thishop->state != CPATH_STATE_OPEN) {
log_fn(LOG_WARNING,"Relay cell before first created cell?");
log_fn(LOG_WARN,"Relay cell before first created cell?");
return -1;
}
do { /* Remember: cpath is in forward order, that is, first hop first. */
......@@ -290,7 +290,7 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
log_fn(LOG_DEBUG,"before decrypt: %d",*(int*)(in+2));
/* decrypt */
if(crypto_cipher_decrypt(thishop->b_crypto, in, inlen, out)) {
log_fn(LOG_WARNING,"Error performing onion decryption: %s", crypto_perror());
log_fn(LOG_WARN,"Error performing onion decryption: %s", crypto_perror());
return -1;
}
memcpy(in,out,inlen);
......@@ -309,7 +309,7 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
log_fn(LOG_DEBUG,"before encrypt: %d",*(int*)(in+2));
if(crypto_cipher_encrypt(circ->p_crypto, in, inlen, out)) {
log_fn(LOG_WARNING,"Onion encryption failed for ACI %u: %s",
log_fn(LOG_WARN,"Onion encryption failed for ACI %u: %s",
circ->p_aci, crypto_perror());
return -1;
}
......@@ -330,7 +330,7 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
log_fn(LOG_DEBUG,"before encrypt: %d",*(int*)(in+2));
if(crypto_cipher_encrypt(thishop->f_crypto, in, inlen, out)) {
log_fn(LOG_WARNING,"Error performing encryption: %s", crypto_perror());
log_fn(LOG_WARN,"Error performing encryption: %s", crypto_perror());
return -1;
}
memcpy(in,out,inlen);
......@@ -341,7 +341,7 @@ int relay_crypt(circuit_t *circ, char *in, int inlen, char cell_direction,
} else { /* we're in the middle. Just one crypt. */
if(crypto_cipher_decrypt(circ->n_crypto,in, inlen, out)) {
log_fn(LOG_WARNING,"Decryption failed for ACI %u: %s",
log_fn(LOG_WARN,"Decryption failed for ACI %u: %s",
circ->n_aci, crypto_perror());
return -1;
}
......@@ -729,7 +729,7 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
cell.length = DH_ONIONSKIN_LEN;
if(onion_skin_create(circ->n_conn->onion_pkey, &(circ->cpath->handshake_state), cell.payload) < 0) {
log_fn(LOG_WARNING,"onion_skin_create (first hop) failed.");
log_fn(LOG_WARN,"onion_skin_create (first hop) failed.");
return -1;
}
......@@ -753,7 +753,7 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
router = router_get_by_addr_port(hop->addr,hop->port);
if(!router) {
log_fn(LOG_WARNING,"couldn't lookup router %d:%d",hop->addr,hop->port);
log_fn(LOG_WARN,"couldn't lookup router %d:%d",hop->addr,hop->port);
return -1;
}
......@@ -767,14 +767,14 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
*(uint32_t*)(cell.payload+RELAY_HEADER_SIZE) = htonl(hop->addr);
*(uint16_t*)(cell.payload+RELAY_HEADER_SIZE+4) = htons(hop->port);
if(onion_skin_create(router->onion_pkey, &(hop->handshake_state), cell.payload+RELAY_HEADER_SIZE+6) < 0) {
log_fn(LOG_WARNING,"onion_skin_create failed.");
log_fn(LOG_WARN,"onion_skin_create failed.");
return -1;
}
log_fn(LOG_DEBUG,"Sending extend relay cell.");
/* send it to hop->prev, because it will transfer it to a create cell and then send to hop */
if(circuit_deliver_relay_cell(&cell, circ, CELL_DIRECTION_OUT, hop->prev) < 0) {
log_fn(LOG_WARNING,"failed to deliver extend cell. Closing.");
log_fn(LOG_WARN,"failed to deliver extend cell. Closing.");
return -1;
}
hop->state = CPATH_STATE_AWAITING_KEYS;
......@@ -792,7 +792,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
cell_t newcell;
if(circ->n_conn) {
log_fn(LOG_WARNING,"n_conn already set. Bug/attack. Closing.");
log_fn(LOG_WARN,"n_conn already set. Bug/attack. Closing.");
return -1;
}
......@@ -825,7 +825,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
log_fn(LOG_DEBUG,"aci_type = %u.",aci_type);
circ->n_aci = get_unique_aci_by_addr_port(circ->n_addr, circ->n_port, aci_type);
if(!circ->n_aci) {
log_fn(LOG_WARNING,"failed to get unique aci.");
log_fn(LOG_WARN,"failed to get unique aci.");
return -1;
}
log_fn(LOG_DEBUG,"Chosen ACI %u.",circ->n_aci);
......@@ -856,14 +856,14 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
hop != circ->cpath && hop->state == CPATH_STATE_OPEN;
hop=hop->next) ;
if(hop == circ->cpath) { /* got an extended when we're all done? */
log_fn(LOG_WARNING,"got extended when circ already built? Closing.");
log_fn(LOG_WARN,"got extended when circ already built? Closing.");
return -1;
}
}
assert(hop->state == CPATH_STATE_AWAITING_KEYS);
if(onion_skin_client_handshake(hop->handshake_state, reply, keys, 32) < 0) {
log_fn(LOG_WARNING,"onion_skin_client_handshake failed.");
log_fn(LOG_WARN,"onion_skin_client_handshake failed.");
return -1;
}
......@@ -873,13 +873,13 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
log_fn(LOG_DEBUG,"hop %d init cipher forward %d, backward %d.", (uint32_t)hop, *(uint32_t*)keys, *(uint32_t*)(keys+16));
if (!(hop->f_crypto =
crypto_create_init_cipher(CIRCUIT_CIPHER,keys,iv,1))) {
log(LOG_WARNING,"forward cipher initialization failed.");
log(LOG_WARN,"forward cipher initialization failed.");
return -1;
}
if (!(hop->b_crypto =
crypto_create_init_cipher(CIRCUIT_CIPHER,keys+16,iv,0))) {
log(LOG_WARNING,"backward cipher initialization failed.");
log(LOG_WARN,"backward cipher initialization failed.");
return -1;
}
......
......@@ -86,7 +86,7 @@ void command_process_cell(cell_t *cell, connection_t *conn) {
command_process_destroy_cell);
break;
default:
log_fn(LOG_WARNING,"Cell of unknown type (%d) received. Dropping.", cell->command);
log_fn(LOG_WARN,"Cell of unknown type (%d) received. Dropping.", cell->command);
break;
}
}
......@@ -97,14 +97,14 @@ static void command_process_create_cell(cell_t *cell, connection_t *conn) {
circ = circuit_get_by_aci_conn(cell->aci, conn);
if(circ) {
log_fn(LOG_WARNING,"received CREATE cell (aci %d) for known circ. Dropping.", cell->aci);
log_fn(LOG_WARN,"received CREATE cell (aci %d) for known circ. Dropping.", cell->aci);
return;
}
circ = circuit_new(cell->aci, conn);
circ->state = CIRCUIT_STATE_ONIONSKIN_PENDING;
if(cell->length != DH_ONIONSKIN_LEN) {
log_fn(LOG_WARNING,"Bad cell length %d. Dropping.", cell->length);
log_fn(LOG_WARN,"Bad cell length %d. Dropping.", cell->length);
circuit_close(circ);
return;
}
......@@ -113,7 +113,7 @@ static void command_process_create_cell(cell_t *cell, connection_t *conn) {
/* hand it off to the cpuworkers, and then return */
if(assign_to_cpuworker(NULL, CPUWORKER_TASK_ONION, circ) < 0) {
log_fn(LOG_WARNING,"Failed to hand off onionskin. Closing.");
log_fn(LOG_WARN,"Failed to hand off onionskin. Closing.");
circuit_close(circ);
return;
}
......@@ -131,7 +131,7 @@ static void command_process_created_cell(cell_t *cell, connection_t *conn) {
}
if(circ->n_aci != cell->aci) {
log_fn(LOG_WARNING,"got created cell from OPward? Closing.");
log_fn(LOG_WARN,"got created cell from OPward? Closing.");
circuit_close(circ);
return;
}
......@@ -140,13 +140,13 @@ static void command_process_created_cell(cell_t *cell, connection_t *conn) {
if(circ->cpath) { /* we're the OP. Handshake this. */
log_fn(LOG_DEBUG,"at OP. Finishing handshake.");
if(circuit_finish_handshake(circ, cell->payload) < 0) {
log_fn(LOG_WARNING,"circuit_finish_handshake failed.");
log_fn(LOG_WARN,"circuit_finish_handshake failed.");
circuit_close(circ);
return;
}
log_fn(LOG_DEBUG,"Moving to next skin.");
if(circuit_send_next_onion_skin(circ) < 0) {
log_fn(LOG_WARNING,"circuit_send_next_onion_skin failed.");
log_fn(LOG_WARN,"circuit_send_next_onion_skin failed.");
circuit_close(circ);
return;
}
......@@ -168,7 +168,7 @@ static void command_process_relay_cell(cell_t *cell, connection_t *conn) {
}
if(circ->state == CIRCUIT_STATE_ONIONSKIN_PENDING) {
log_fn(LOG_WARNING,"circuit in create_wait. Closing.");
log_fn(LOG_WARN,"circuit in create_wait. Closing.");
circuit_close(circ);
return;
}
......@@ -176,14 +176,14 @@ static void command_process_relay_cell(cell_t *cell, connection_t *conn) {
if(cell->aci == circ->p_aci) { /* it's an outgoing cell */
cell->aci = circ->n_aci; /* switch it */
if(circuit_deliver_relay_cell(cell, circ, CELL_DIRECTION_OUT, conn->cpath_layer) < 0) {
log_fn(LOG_WARNING,"circuit_deliver_relay_cell (forward) failed. Closing.");
log_fn(LOG_WARN,"circuit_deliver_relay_cell (forward) failed. Closing.");
circuit_close(circ);
return;
}
} else { /* it's an ingoing cell */
cell->aci = circ->p_aci; /* switch it */
if(circuit_deliver_relay_cell(cell, circ, CELL_DIRECTION_IN, NULL) < 0) {
log_fn(LOG_WARNING,"circuit_deliver_relay_cell (backward) failed. Closing.");
log_fn(LOG_WARN,"circuit_deliver_relay_cell (backward) failed. Closing.");
circuit_close(circ);
return;
}
......
......@@ -125,7 +125,7 @@ static int config_compare(struct config_line *c, char *key, int type, void *arg)
case CONFIG_TYPE_BOOL:
i = atoi(c->value);
if (i != 0 && i != 1) {
log(LOG_WARNING, "Boolean keyword '%s' expects 0 or 1", c->key);
log(LOG_WARN, "Boolean keyword '%s' expects 0 or 1", c->key);
return 0;
}
*(int *)arg = i;
......@@ -182,7 +182,7 @@ static void config_assign(or_options_t *options, struct config_line *list) {
) {
/* then we're ok. it matched something. */
} else {
log_fn(LOG_WARNING,"Ignoring unknown keyword '%s'.",list->key);
log_fn(LOG_WARN,"Ignoring unknown keyword '%s'.",list->key);
}
list = list->next;
......@@ -227,7 +227,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
cf = config_open(fname);
if(!cf) {
log(LOG_WARNING, "Unable to open configuration file '%s'.",fname);
log(LOG_WARN, "Unable to open configuration file '%s'.",fname);
return -1;
}
......@@ -247,76 +247,76 @@ int getconfig(int argc, char **argv, or_options_t *options) {
if(options->LogLevel) {
if(!strcmp(options->LogLevel,"err"))
options->loglevel = LOG_ERR;
else if(!strncmp(options->LogLevel,"warn",4))
options->loglevel = LOG_WARNING;
else if(!strcmp(options->LogLevel,"warn"))
options->loglevel = LOG_WARN;
else if(!strcmp(options->LogLevel,"info"))
options->loglevel = LOG_INFO;
else if(!strcmp(options->LogLevel,"debug"))
options->loglevel = LOG_DEBUG;
else {
log(LOG_WARNING,"LogLevel must be one of err|warning|info|debug.");
log(LOG_WARN,"LogLevel must be one of err|warn|info|debug.");
result = -1;
}
}
if(options->RouterFile == NULL) {
log(LOG_WARNING,"RouterFile option required, but not found.");
log(LOG_WARN,"RouterFile option required, but not found.");
result = -1;
}
if(options->ORPort < 0) {
log(LOG_WARNING,"ORPort option can't be negative.");
log(LOG_WARN,"ORPort option can't be negative.");
result = -1;
}
if(options->OnionRouter && options->ORPort == 0) {
log(LOG_WARNING,"If OnionRouter is set, then ORPort must be positive.");
log(LOG_WARN,"If OnionRouter is set, then ORPort must be positive.");
result = -1;
}
if(options->OnionRouter && options->DataDirectory == NULL) {
log(LOG_WARNING,"DataDirectory option required for OnionRouter, but not found.");
log(LOG_WARN,"DataDirectory option required for OnionRouter, but not found.");
result = -1;
}
if(options->OnionRouter && options->Nickname == NULL) {
log_fn(LOG_WARNING,"Nickname required for OnionRouter, but not found.");
log_fn(LOG_WARN,"Nickname required for OnionRouter, but not found.");
result = -1;
}
if(options->APPort < 0) {
log(LOG_WARNING,"APPort option can't be negative.");
log(LOG_WARN,"APPort option can't be negative.");
result = -1;
}
if(options->DirPort < 0) {
log(LOG_WARNING,"DirPort option can't be negative.");
log(LOG_WARN,"DirPort option can't be negative.");
result = -1;
}
if(options->APPort > 1 &&
(options->CoinWeight < 0.0 || options->CoinWeight >= 1.0)) {
log(LOG_WARNING,"CoinWeight option must be >=0.0 and <1.0.");
log(LOG_WARN,"CoinWeight option must be >=0.0 and <1.0.");
result = -1;
}
if(options->MaxConn < 1) {
log(LOG_WARNING,"MaxConn option must be a non-zero positive integer.");
log(LOG_WARN,"MaxConn option must be a non-zero positive integer.");
result = -1;
}
if(options->MaxConn >= MAXCONNECTIONS) {
log(LOG_WARNING,"MaxConn option must be less than %d.", MAXCONNECTIONS);
log(LOG_WARN,"MaxConn option must be less than %d.", MAXCONNECTIONS);
result = -1;
}
if(options->DirFetchPostPeriod < 1) {
log(LOG_WARNING,"DirFetchPostPeriod option must be positive.");
log(LOG_WARN,"DirFetchPostPeriod option must be positive.");
result = -1;
}
if(options->KeepalivePeriod < 1) {
log(LOG_WARNING,"KeepalivePeriod option must be positive.");
log(LOG_WARN,"KeepalivePeriod option must be positive.");
result = -1;
}
......
......@@ -127,7 +127,7 @@ int connection_create_listener(struct sockaddr_in *bindaddr, int type) {
s = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
if (s < 0) {
log_fn(LOG_WARNING,"Socket creation failed.");
log_fn(LOG_WARN,"Socket creation failed.");
return -1;
}
......@@ -135,12 +135,12 @@ int connection_create_listener(struct sockaddr_in *bindaddr, int type) {
if(bind(s,(struct sockaddr *)bindaddr,sizeof(*bindaddr)) < 0) {
perror("bind ");
log(LOG_WARNING,"Could not bind to port %u.",ntohs(bindaddr->sin_port));
log(LOG_WARN,"Could not bind to port %u.",ntohs(bindaddr->sin_port));
return -1;
}
if(listen(s,SOMAXCONN) < 0) {
log(LOG_WARNING,"Could not listen on port %u.",ntohs(bindaddr->sin_port));
log(LOG_WARN,"Could not listen on port %u.",ntohs(bindaddr->sin_port));
return -1;
}
......@@ -150,7 +150,7 @@ int connection_create_listener(struct sockaddr_in *bindaddr, int type) {
conn->s = s;
if(connection_add(conn) < 0) { /* no space, forget it */
log_fn(LOG_WARNING,"connection_add failed. Giving up.");
log_fn(LOG_WARN,"connection_add failed. Giving up.");
connection_free(conn);
return -1;
}
......@@ -184,7 +184,7 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) {
#endif
}
/* else there was a real error. */
log_fn(LOG_WARNING,"accept() failed. Closing listener.");
log_fn(LOG_WARN,"accept() failed. Closing listener.");
return -1;
}
log(LOG_INFO,"Connection accepted on socket %d (child of fd %d).",news, conn->s);
......@@ -238,7 +238,7 @@ int connection_connect(connection_t *conn, char *address, uint32_t addr, uint16_
s=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
if (s < 0) {
log_fn(LOG_WARNING,"Error creating network socket.");
log_fn(LOG_WARN,"Error creating network socket.");
return -1;
}
set_socket_nonblocking(s);
......@@ -430,7 +430,7 @@ int connection_flush_buf(connection_t *conn) {
int connection_handle_write(connection_t *conn) {
if(connection_is_listener(conn)) {
log_fn(LOG_WARNING,"Got a listener socket. Can't happen!");
log_fn(LOG_WARN,"Got a listener socket. Can't happen!");
return -1;
}
......@@ -497,7 +497,7 @@ void connection_write_to_buf(const char *string, int len, connection_t *conn) {
}
if(write_to_buf(string, len, conn->outbuf) < 0) {
log_fn(LOG_WARNING,"write_to_buf failed. Closing connection (fd %d).", conn->s);
log_fn(LOG_WARN,"write_to_buf failed. Closing connection (fd %d).", conn->s);
conn->marked_for_close = 1;
}
}
......@@ -667,7 +667,7 @@ int connection_process_inbuf(connection_t *conn) {
case CONN_TYPE_CPUWORKER:
return connection_cpu_process_inbuf(conn);
default:
log_fn(LOG_WARNING,"got unexpected conn->type %d.", conn->type);
log_fn(LOG_WARN,"got unexpected conn->type %d.", conn->type);
return -1;
}
}
......@@ -691,7 +691,7 @@ int connection_finished_flushing(connection_t *conn) {
case CONN_TYPE_CPUWORKER:
return connection_cpu_finished_flushing(conn);
default:
log_fn(LOG_WARNING,"got unexpected conn->type %d.", conn->type);
log_fn(LOG_WARN,"got unexpected conn->type %d.", conn->type);
return -1;
}
}
......
......@@ -63,7 +63,7 @@ void connection_edge_send_command(connection_t *fromconn, circuit_t *circ, int r
int is_control_cell=0;
if(!circ) {
log_fn(LOG_WARNING,"no circ. Closing.");
log_fn(LOG_WARN,"no circ. Closing.");
return;
}
......@@ -95,7 +95,7 @@ void connection_edge_send_command(connection_t *fromconn, circuit_t *circ, int r
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
if(circuit_deliver_relay_cell(&cell, circ, cell_direction, cpath_layer) < 0) {
log_fn(LOG_WARNING,"circuit_deliver_relay_cell failed. Closing.");
log_fn(LOG_WARN,"circuit_deliver_relay_cell failed. Closing.");
circuit_close(circ);
}
}
......@@ -127,7 +127,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
}
return 0;
} else {
log_fn(LOG_WARNING,"Got an unexpected relay cell, not in 'open' state. Closing.");
log_fn(LOG_WARN,"Got an unexpected relay cell, not in 'open' state. Closing.");
return -1;
}
}
......@@ -135,11 +135,11 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
switch(relay_command) {
case RELAY_COMMAND_BEGIN:
if(edge_type == EDGE_AP) {
log_fn(LOG_WARNING,"relay begin request unsupported at AP. Dropping.");
log_fn(LOG_WARN,"relay begin request unsupported at AP. Dropping.");
return 0;
}
if(conn) {
log_fn(LOG_WARNING,"begin cell for known stream. Dropping.");
log_fn(LOG_WARN,"begin cell for known stream. Dropping.");
return 0;
}
return connection_exit_begin_conn(cell, circ);
......@@ -147,7 +147,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
++stats_n_data_cells_received;
if((edge_type == EDGE_AP && --layer_hint->deliver_window < 0) ||
(edge_type == EDGE_EXIT && --circ->deliver_window < 0)) {
log_fn(LOG_WARNING,"(relay data) circ deliver_window below 0. Killing.");
log_fn(LOG_WARN,"(relay data) circ deliver_window below 0. Killing.");
return -1;
}
log_fn(LOG_DEBUG,"circ deliver_window now %d.", edge_type == EDGE_AP ? layer_hint->deliver_window : circ->deliver_window);
......@@ -161,7 +161,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
}
if(--conn->deliver_window < 0) { /* is it below 0 after decrement? */
log_fn(LOG_WARNING,"(relay data) conn deliver_window below 0. Killing.");
log_fn(LOG_WARN,"(relay data) conn deliver_window below 0. Killing.");
return -1; /* somebody's breaking protocol. kill the whole circuit. */
}
......@@ -188,24 +188,24 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
break;
case RELAY_COMMAND_EXTEND:
if(conn) {
log_fn(LOG_WARNING,"'extend' for non-zero stream. Dropping.");
log_fn(LOG_WARN,"'extend' for non-zero stream. Dropping.");
return 0;
}
return circuit_extend(cell, circ);
case RELAY_COMMAND_EXTENDED:
if(edge_type == EDGE_EXIT) {
log_fn(LOG_WARNING,"'extended' unsupported at exit. Dropping.");
log_fn(LOG_WARN,"'extended' unsupported at exit. Dropping.");
return 0;
}
log_fn(LOG_DEBUG,"Got an extended cell! Yay.");
if(circuit_finish_handshake(circ, cell->payload+RELAY_HEADER_SIZE) < 0) {
log_fn(LOG_WARNING,"circuit_finish_handshake failed.");
log_fn(LOG_WARN,"circuit_finish_handshake failed.");
return -1;
}
return circuit_send_next_onion_skin(circ);
case RELAY_COMMAND_TRUNCATE:
if(edge_type == EDGE_AP) {
log_fn(LOG_WARNING,"'truncate' unsupported at AP. Dropping.");
log_fn(LOG_WARN,"'truncate' unsupported at AP. Dropping.");
return 0;
}
if(circ->n_conn) {
......@@ -218,13 +218,13 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
return 0;
case RELAY_COMMAND_TRUNCATED:
if(edge_type == EDGE_EXIT) {
log_fn(LOG_WARNING,"'truncated' unsupported at exit. Dropping.");
log_fn(LOG_WARN,"'truncated' unsupported at exit. Dropping.");
return 0;
}
return circuit_truncated(circ, layer_hint);
case RELAY_COMMAND_CONNECTED: