diff options
author | Roger Dingledine <arma@torproject.org> | 2003-10-10 01:48:32 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-10-10 01:48:32 +0000 |
commit | b9628f266fedca397b33816a31c01d5e4775e19a (patch) | |
tree | 0d34c40f8e174ed456b050450df3d3899e78e87a /src | |
parent | 36fb8e839df7fadc5aac8be71cf026c4966cad76 (diff) | |
download | tor-b9628f266fedca397b33816a31c01d5e4775e19a.tar.gz tor-b9628f266fedca397b33816a31c01d5e4775e19a.zip |
change WARNING to WARN
and fix a few typos
svn:r571
Diffstat (limited to 'src')
-rw-r--r-- | src/or/buffers.c | 26 | ||||
-rw-r--r-- | src/or/circuit.c | 32 | ||||
-rw-r--r-- | src/or/command.c | 20 | ||||
-rw-r--r-- | src/or/config.c | 36 | ||||
-rw-r--r-- | src/or/connection.c | 20 | ||||
-rw-r--r-- | src/or/connection_edge.c | 48 | ||||
-rw-r--r-- | src/or/connection_or.c | 20 | ||||
-rw-r--r-- | src/or/cpuworker.c | 14 | ||||
-rw-r--r-- | src/or/directory.c | 18 | ||||
-rw-r--r-- | src/or/dirserv.c | 34 | ||||
-rw-r--r-- | src/or/dns.c | 12 | ||||
-rw-r--r-- | src/or/main.c | 25 | ||||
-rw-r--r-- | src/or/onion.c | 10 | ||||
-rw-r--r-- | src/or/routers.c | 120 | ||||
-rw-r--r-- | src/or/test.c | 2 |
15 files changed, 219 insertions, 218 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 71bff0007b..0cb3dae8ab 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -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; } } diff --git a/src/or/circuit.c b/src/or/circuit.c index 0f825139a3..2eed5f8bc4 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -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; } diff --git a/src/or/command.c b/src/or/command.c index 8648fcc6b3..4e090909f6 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -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; } diff --git a/src/or/config.c b/src/or/config.c index fc40e9cb73..ae14d3bff7 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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; } diff --git a/src/or/connection.c b/src/or/connection.c index 20677c466c..dcdb474a16 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -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; } } diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index b1fa4ef28f..b02e156cc8 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -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: if(edge_type == EDGE_EXIT) { - log_fn(LOG_WARNING,"'connected' unsupported at exit. Dropping."); + log_fn(LOG_WARN,"'connected' unsupported at exit. Dropping."); return 0; } if(!conn) { @@ -257,7 +257,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection connection_edge_package_raw_inbuf(conn); /* handle whatever might still be on the inbuf */ break; default: - log_fn(LOG_WARNING,"unknown relay command %d.",relay_command); + log_fn(LOG_WARN,"unknown relay command %d.",relay_command); return -1; } return 0; @@ -303,7 +303,7 @@ int connection_edge_finished_flushing(connection_t *conn) { connection_stop_writing(conn); return 0; default: - log_fn(LOG_WARNING,"BUG: called in unexpected state."); + log_fn(LOG_WARN,"BUG: called in unexpected state."); return -1; } return 0; @@ -334,7 +334,7 @@ repeat_connection_edge_package_raw_inbuf: return 0; if(conn->package_window <= 0) { - log_fn(LOG_WARNING,"called with package_window %d. Tell Roger.", conn->package_window); + log_fn(LOG_WARN,"called with package_window %d. Tell Roger.", conn->package_window); connection_stop_reading(conn); return 0; } @@ -410,7 +410,7 @@ static void connection_edge_consider_sending_sendme(connection_t *conn, int edge log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", conn->outbuf_flushlen); conn->deliver_window += STREAMWINDOW_INCREMENT; if(circuit_deliver_relay_cell(&cell, circ, CELL_DIRECTION(edge_type), conn->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); return; } @@ -436,7 +436,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) { log_fn(LOG_DEBUG,"reply is already set for us. Using it."); connection_ap_handshake_socks_reply(conn, reply, replylen, 0); } else if(sockshere == -1) { /* send normal reject */ - log_fn(LOG_WARNING,"Fetching socks handshake failed. Closing."); + log_fn(LOG_WARN,"Fetching socks handshake failed. Closing."); connection_ap_handshake_socks_reply(conn, NULL, 0, 0); } else { log_fn(LOG_DEBUG,"socks handshake not all here yet."); @@ -535,18 +535,18 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply, if(!memchr(cell->payload+RELAY_HEADER_SIZE+STREAM_ID_SIZE,0, cell->length-RELAY_HEADER_SIZE-STREAM_ID_SIZE)) { - log_fn(LOG_WARNING,"relay begin cell has no \\0. Dropping."); + log_fn(LOG_WARN,"relay begin cell has no \\0. Dropping."); return 0; } colon = strchr(cell->payload+RELAY_HEADER_SIZE+STREAM_ID_SIZE, ':'); if(!colon) { - log_fn(LOG_WARNING,"relay begin cell has no colon. Dropping."); + log_fn(LOG_WARN,"relay begin cell has no colon. Dropping."); return 0; } *colon = 0; if(!atoi(colon+1)) { /* bad port */ - log_fn(LOG_WARNING,"relay begin cell has invalid port. Dropping."); + log_fn(LOG_WARN,"relay begin cell has invalid port. Dropping."); return 0; } @@ -561,7 +561,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply, n_stream->package_window = STREAMWINDOW_START; n_stream->deliver_window = STREAMWINDOW_START; if(connection_add(n_stream) < 0) { /* no space, forget it */ - log_fn(LOG_WARNING,"connection_add failed. Dropping."); + log_fn(LOG_WARN,"connection_add failed. Dropping."); connection_free(n_stream); return 0; } @@ -577,7 +577,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply, return 0; /* else fall through */ case -1: /* resolve failed */ - log_fn(LOG_WARNING,"Couldn't queue resolve request."); + log_fn(LOG_WARN,"Couldn't queue resolve request."); connection_remove(n_stream); connection_free(n_stream); case 0: /* resolve added to pending list */ @@ -610,7 +610,7 @@ int connection_exit_connect(connection_t *conn) { connection_set_poll_socket(conn); conn->state = EXIT_CONN_STATE_OPEN; if(connection_wants_to_flush(conn)) { /* in case there are any queued data cells */ - log_fn(LOG_WARNING,"tell roger: newly connected conn had data waiting!"); + log_fn(LOG_WARN,"tell roger: newly connected conn had data waiting!"); // connection_start_writing(conn); } // connection_process_inbuf(conn); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index ece6c66e96..3af6cc5b53 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -70,7 +70,7 @@ int connection_or_finished_flushing(connection_t *conn) { connection_stop_writing(conn); return 0; default: - log_fn(LOG_WARNING,"BUG: called in unexpected state."); + log_fn(LOG_WARN,"BUG: called in unexpected state."); return 0; } } @@ -96,7 +96,7 @@ connection_t *connection_or_connect(routerinfo_t *router) { assert(router); if(options.Nickname && !strcmp(router->nickname,options.Nickname)) { - log_fn(LOG_WARNING,"You asked me to connect to myself! Failing."); + log_fn(LOG_WARN,"You asked me to connect to myself! Failing."); return NULL; } @@ -148,7 +148,7 @@ int connection_tls_start_handshake(connection_t *conn, int receiving) { conn->state = OR_CONN_STATE_HANDSHAKING; conn->tls = tor_tls_new(conn->s, receiving); if(!conn->tls) { - log_fn(LOG_WARNING,"tor_tls_new failed. Closing."); + log_fn(LOG_WARN,"tor_tls_new failed. Closing."); return -1; } connection_start_reading(conn); @@ -189,20 +189,20 @@ static int connection_tls_finish_handshake(connection_t *conn) { if(tor_tls_peer_has_cert(conn->tls)) { /* it's another OR */ pk = tor_tls_verify(conn->tls); if(!pk) { - log_fn(LOG_WARNING,"Other side (%s:%d) has a cert but it's invalid. Closing.", + log_fn(LOG_WARN,"Other side (%s:%d) has a cert but it's invalid. Closing.", conn->address, conn->port); return -1; } router = router_get_by_link_pk(pk); if (!router) { - log_fn(LOG_WARNING,"Unrecognized public key from peer (%s:%d). Closing.", + log_fn(LOG_WARN,"Unrecognized public key from peer (%s:%d). Closing.", conn->address, conn->port); crypto_free_pk_env(pk); return -1; } if(conn->link_pkey) { /* I initiated this connection. */ if(crypto_pk_cmp_keys(conn->link_pkey, pk)) { - log_fn(LOG_WARNING,"We connected to '%s' but he gave us a different key. Closing.", + log_fn(LOG_WARN,"We connected to '%s' but he gave us a different key. Closing.", router->nickname); crypto_free_pk_env(pk); return -1; @@ -221,24 +221,24 @@ static int connection_tls_finish_handshake(connection_t *conn) { } } else { /* I'm a client */ if(!tor_tls_peer_has_cert(conn->tls)) { /* it's a client too?! */ - log_fn(LOG_WARNING,"Neither peer sent a cert! Closing."); + log_fn(LOG_WARN,"Neither peer sent a cert! Closing."); return -1; } pk = tor_tls_verify(conn->tls); if(!pk) { - log_fn(LOG_WARNING,"Other side (%s:%d) has a cert but it's invalid. Closing.", + log_fn(LOG_WARN,"Other side (%s:%d) has a cert but it's invalid. Closing.", conn->address, conn->port); return -1; } router = router_get_by_link_pk(pk); if (!router) { - log_fn(LOG_WARNING,"Unrecognized public key from peer (%s:%d). Closing.", + log_fn(LOG_WARN,"Unrecognized public key from peer (%s:%d). Closing.", conn->address, conn->port); crypto_free_pk_env(pk); return -1; } if(crypto_pk_cmp_keys(conn->link_pkey, pk)) { - log_fn(LOG_WARNING,"We connected to '%s' but he gave us a different key. Closing.", + log_fn(LOG_WARN,"We connected to '%s' but he gave us a different key. Closing.", router->nickname); crypto_free_pk_env(pk); return -1; diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 85ba9ec1a2..0a6d7c714a 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -58,7 +58,7 @@ int connection_cpu_process_inbuf(connection_t *conn) { assert(conn && conn->type == CONN_TYPE_CPUWORKER); if(conn->inbuf_reached_eof) { - log_fn(LOG_WARNING,"Read eof. Worker dying."); + log_fn(LOG_WARN,"Read eof. Worker dying."); if(conn->state != CPUWORKER_STATE_IDLE) { /* XXX the circ associated with this cpuworker will wait forever. Oops. */ num_cpuworkers_busy--; @@ -87,12 +87,12 @@ int connection_cpu_process_inbuf(connection_t *conn) { } assert(circ->p_conn); if(*buf == 0) { - log_fn(LOG_WARNING,"decoding onionskin failed. Closing."); + log_fn(LOG_WARN,"decoding onionskin failed. Closing."); circuit_close(circ); goto done_processing; } if(onionskin_answer(circ, buf+1+TAG_LEN, buf+1+TAG_LEN+DH_KEY_LEN) < 0) { - log_fn(LOG_WARNING,"onionskin_answer failed. Closing."); + log_fn(LOG_WARN,"onionskin_answer failed. Closing."); circuit_close(circ); goto done_processing; } @@ -145,7 +145,7 @@ int cpuworker_main(void *data) { if(onion_skin_server_handshake(question, get_onion_key(), reply_to_proxy, keys, 32) < 0) { /* failure */ - log_fn(LOG_WARNING,"onion_skin_server_handshake failed."); + log_fn(LOG_WARN,"onion_skin_server_handshake failed."); memset(buf,0,LEN_ONION_RESPONSE); /* send all zeros for failure */ } else { /* success */ @@ -187,7 +187,7 @@ static int spawn_cpuworker(void) { conn->address = tor_strdup("localhost"); 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); /* this closes fd[0] */ return -1; } @@ -208,7 +208,7 @@ static void spawn_enough_cpuworkers(void) { while(num_cpuworkers < num_cpuworkers_needed) { if(spawn_cpuworker() < 0) { - log_fn(LOG_WARNING,"spawn failed!"); + log_fn(LOG_WARN,"spawn failed!"); return; } num_cpuworkers++; @@ -227,7 +227,7 @@ static void process_pending_task(connection_t *cpuworker) { if(!circ) return; if(assign_to_cpuworker(cpuworker, CPUWORKER_TASK_ONION, circ) < 0) - log_fn(LOG_WARNING,"assign_to_cpuworker failed. Ignoring."); + log_fn(LOG_WARN,"assign_to_cpuworker failed. Ignoring."); } /* if cpuworker is defined, assert that he's idle, and use him. else, diff --git a/src/or/directory.c b/src/or/directory.c index e3b7f14eac..9581f7cae8 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -22,7 +22,7 @@ void directory_initiate_command(routerinfo_t *router, int command) { connection_t *conn; if(!router) { /* i guess they didn't have one in mind for me to use */ - log_fn(LOG_WARNING,"No running dirservers known. This is really bad."); + log_fn(LOG_WARN,"No running dirservers known. This is really bad."); /* XXX never again will a directory fetch work. Should we exit here, or what? */ return; } @@ -50,7 +50,7 @@ void directory_initiate_command(routerinfo_t *router, int command) { if (router->identity_pkey) conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey); else { - log_fn(LOG_WARNING, "No signing key known for dirserver %s; signature won't be checked", conn->address); + log_fn(LOG_WARN, "No signing key known for dirserver %s; signature won't be checked", conn->address); conn->identity_pkey = NULL; /* XXX is there really any situation where router doesn't have an identity_pkey? */ } @@ -96,7 +96,7 @@ static int directory_send_command(connection_t *conn, int command) { case DIR_CONN_STATE_CONNECTING_UPLOAD: s = router_get_my_descriptor(); if(!s) { - log_fn(LOG_WARNING,"Failed to get my descriptor."); + log_fn(LOG_WARN,"Failed to get my descriptor."); return -1; } snprintf(tmp, sizeof(tmp), "POST / HTTP/1.0\r\nContent-Length: %d\r\n\r\n%s", @@ -119,7 +119,7 @@ int connection_dir_process_inbuf(connection_t *conn) { switch(fetch_from_buf_http(conn->inbuf, NULL, 0, the_directory, MAX_DIR_SIZE)) { case -1: /* overflow */ - log_fn(LOG_WARNING,"'fetch' response too large. Failing."); + log_fn(LOG_WARN,"'fetch' response too large. Failing."); return -1; case 0: log_fn(LOG_INFO,"'fetch' response not all here, but we're at eof. Closing."); @@ -173,7 +173,7 @@ static int directory_handle_command(connection_t *conn) { switch(fetch_from_buf_http(conn->inbuf, headers, sizeof(headers), body, sizeof(body))) { case -1: /* overflow */ - log_fn(LOG_WARNING,"input too large. Failing."); + log_fn(LOG_WARN,"input too large. Failing."); return -1; case 0: log_fn(LOG_DEBUG,"command not all here yet."); @@ -189,7 +189,7 @@ static int directory_handle_command(connection_t *conn) { dlen = dirserv_get_directory(&cp); if(dlen == 0) { - log_fn(LOG_WARNING,"My directory is empty. Closing."); + log_fn(LOG_WARN,"My directory is empty. Closing."); return -1; /* XXX send some helpful http error code */ } @@ -205,7 +205,7 @@ static int directory_handle_command(connection_t *conn) { log_fn(LOG_DEBUG,"Received POST command."); cp = body; if(dirserv_add_descriptor(&cp) < 0) { - log_fn(LOG_WARNING,"dirserv_add_descriptor() failed. Dropping."); + log_fn(LOG_WARN,"dirserv_add_descriptor() failed. Dropping."); return -1; /* XXX should write an http failed code */ } dirserv_get_directory(&cp); /* rebuild and write to disk */ @@ -214,7 +214,7 @@ static int directory_handle_command(connection_t *conn) { return 0; } - log_fn(LOG_WARNING,"Got headers with unknown command. Closing."); + log_fn(LOG_WARN,"Got headers with unknown command. Closing."); return -1; } @@ -255,7 +255,7 @@ int connection_dir_finished_flushing(connection_t *conn) { log_fn(LOG_INFO,"Finished writing server response. Closing."); return -1; /* kill it */ default: - log_fn(LOG_WARNING,"BUG: called in unexpected state."); + log_fn(LOG_WARN,"BUG: called in unexpected state."); return -1; } return 0; diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 9090f6f626..cb64c2b697 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -62,23 +62,23 @@ dirserv_parse_fingerprint_file(const char *fname) int i, result; if(!(file = fopen(fname, "r"))) { - log_fn(LOG_WARNING, "Cannot open fingerprint file %s", fname); + log_fn(LOG_WARN, "Cannot open fingerprint file %s", fname); return -1; } while( (result=parse_line_from_file(line, sizeof(line),file,&nickname,&fingerprint)) > 0) { if (strlen(nickname) > MAX_NICKNAME_LEN) { - log(LOG_WARNING, "Nickname %s too long in fingerprint file. Skipping.", nickname); + log(LOG_WARN, "Nickname %s too long in fingerprint file. Skipping.", nickname); continue; } if(strlen(fingerprint) != FINGERPRINT_LEN || !crypto_pk_check_fingerprint_syntax(fingerprint)) { - log_fn(LOG_WARNING, "Invalid fingerprint (nickname %s, fingerprint %s). Skipping.", + log_fn(LOG_WARN, "Invalid fingerprint (nickname %s, fingerprint %s). Skipping.", nickname, fingerprint); continue; } for (i = 0; i < n_fingerprints_tmp; ++i) { if (0==strcasecmp(fingerprint_list_tmp[i].nickname, nickname)) { - log(LOG_WARNING, "Duplicate nickname %s. Skipping.",nickname); + log(LOG_WARN, "Duplicate nickname %s. Skipping.",nickname); break; /* out of the for. the 'if' below means skip to the next line. */ } } @@ -97,7 +97,7 @@ dirserv_parse_fingerprint_file(const char *fname) return 0; } /* error */ - log_fn(LOG_WARNING, "Error reading from fingerprint file"); + log_fn(LOG_WARN, "Error reading from fingerprint file"); for (i = 0; i < n_fingerprints_tmp; ++i) { free(fingerprint_list_tmp[i].nickname); free(fingerprint_list_tmp[i].fingerprint); @@ -123,18 +123,18 @@ dirserv_router_fingerprint_is_known(const routerinfo_t *router) } if (!ent) { /* No such server known */ - log_fn(LOG_WARNING,"no fingerprint found for %s",router->nickname); + log_fn(LOG_WARN,"no fingerprint found for %s",router->nickname); return 0; } if (crypto_pk_get_fingerprint(router->identity_pkey, fp)) { - log_fn(LOG_WARNING,"error computing fingerprint"); + log_fn(LOG_WARN,"error computing fingerprint"); return 0; } if (0==strcasecmp(ent->fingerprint, fp)) { log_fn(LOG_DEBUG,"good fingerprint for %s",router->nickname); return 1; /* Right fingerprint. */ } else { - log_fn(LOG_WARNING,"mismatched fingerprint for %s",router->nickname); + log_fn(LOG_WARN,"mismatched fingerprint for %s",router->nickname); return 0; /* Wrong fingerprint. */ } } @@ -197,7 +197,7 @@ dirserv_add_descriptor(const char **desc) start = strstr(*desc, "router "); if (!start) { - log(LOG_WARNING, "no descriptor found."); + log(LOG_WARN, "no descriptor found."); goto err; } if ((end = strstr(start+6, "\nrouter "))) { @@ -215,13 +215,13 @@ dirserv_add_descriptor(const char **desc) /* Check: is the descriptor syntactically valid? */ ri = router_get_entry_from_string(&cp); if (!ri) { - log(LOG_WARNING, "Couldn't parse descriptor"); + log(LOG_WARN, "Couldn't parse descriptor"); goto err; } free(desc_tmp); desc_tmp = NULL; /* Okay. Now check whether the fingerprint is recognized. */ if (!dirserv_router_fingerprint_is_known(ri)) { - log(LOG_WARNING, "Identity is unrecognized for descriptor"); + log(LOG_WARN, "Identity is unrecognized for descriptor"); goto err; } /* Do we already have an entry for this router? */ @@ -372,11 +372,11 @@ dirserv_dump_directory_to_string(char *s, int maxlen, cp = s + i; if (router_get_dir_hash(s,digest)) { - log_fn(LOG_WARNING,"couldn't compute digest"); + log_fn(LOG_WARN,"couldn't compute digest"); return -1; } if (crypto_pk_private_sign(private_key, digest, 20, signature) < 0) { - log_fn(LOG_WARNING,"couldn't sign digest"); + log_fn(LOG_WARN,"couldn't sign digest"); return -1; } log(LOG_DEBUG,"generated directory digest begins with %02x:%02x:%02x:%02x", @@ -389,7 +389,7 @@ dirserv_dump_directory_to_string(char *s, int maxlen, i = strlen(s); cp = s+i; if (base64_encode(cp, maxlen-i, signature, 128) < 0) { - log_fn(LOG_WARNING,"couldn't base64-encode signature"); + log_fn(LOG_WARN,"couldn't base64-encode signature"); return -1; } @@ -398,7 +398,7 @@ dirserv_dump_directory_to_string(char *s, int maxlen, strncat(cp, "-----END SIGNATURE-----\n", maxlen-i); i = strlen(s); if (i == maxlen) { - log_fn(LOG_WARNING,"tried to exceed string length."); + log_fn(LOG_WARN,"tried to exceed string length."); return -1; } @@ -413,7 +413,7 @@ size_t dirserv_get_directory(const char **directory) new_directory = tor_malloc(MAX_DIR_SIZE); if (dirserv_dump_directory_to_string(new_directory, MAX_DIR_SIZE, get_identity_key())) { - log(LOG_WARNING, "Error creating directory."); + log(LOG_WARN, "Error creating directory."); free(new_directory); return 0; } @@ -436,7 +436,7 @@ size_t dirserv_get_directory(const char **directory) free(new_directory); sprintf(filename,"%s/cached-directory", options.DataDirectory); if(write_str_to_file(filename,the_directory) < 0) { - log_fn(LOG_WARNING, "Couldn't write cached directory to disk. Ignoring."); + log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring."); } } else { log(LOG_INFO,"Directory still clean, reusing."); diff --git a/src/or/dns.c b/src/or/dns.c index fdd9742685..50a3492c17 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -160,7 +160,7 @@ static int assign_to_dnsworker(connection_t *exitconn) { dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER, DNSWORKER_STATE_IDLE); if(!dnsconn) { - log_fn(LOG_WARNING,"no idle dns workers. Failing."); + log_fn(LOG_WARN,"no idle dns workers. Failing."); dns_cancel_pending_resolve(exitconn->address, NULL); return -1; } @@ -190,7 +190,7 @@ void dns_cancel_pending_resolve(char *question, connection_t *onlyconn) { resolve = SPLAY_FIND(cache_tree, &cache_root, &search); if(!resolve) { - log_fn(LOG_WARNING,"Question '%s' is not pending. Dropping.", question); + log_fn(LOG_WARN,"Question '%s' is not pending. Dropping.", question); return; } @@ -255,7 +255,7 @@ static void dns_found_answer(char *question, uint32_t answer) { resolve = SPLAY_FIND(cache_tree, &cache_root, &search); if(!resolve) { - log_fn(LOG_WARNING,"Answer to unasked question '%s'? Dropping.", question); + log_fn(LOG_WARN,"Answer to unasked question '%s'? Dropping.", question); return; } @@ -293,7 +293,7 @@ int connection_dns_process_inbuf(connection_t *conn) { assert(conn && conn->type == CONN_TYPE_DNSWORKER); if(conn->inbuf_reached_eof) { - log_fn(LOG_WARNING,"Read eof. Worker dying."); + log_fn(LOG_WARN,"Read eof. Worker dying."); if(conn->state == DNSWORKER_STATE_BUSY) { dns_cancel_pending_resolve(conn->address, NULL); num_dnsworkers_busy--; @@ -384,7 +384,7 @@ static int spawn_dnsworker(void) { conn->address = tor_strdup("localhost"); 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); /* this closes fd[0] */ return -1; } @@ -422,7 +422,7 @@ static void spawn_enough_dnsworkers(void) { while(num_dnsworkers < num_dnsworkers_needed) { if(spawn_dnsworker() < 0) { - log(LOG_WARNING,"spawn_enough_dnsworkers(): spawn failed!"); + log(LOG_WARN,"spawn_enough_dnsworkers(): spawn failed!"); return; } num_dnsworkers++; diff --git a/src/or/main.c b/src/or/main.c index 11bbe33962..1040a190a7 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -80,7 +80,7 @@ crypto_pk_env_t *get_identity_key(void) { int connection_add(connection_t *conn) { if(nfds >= options.MaxConn-1) { - log(LOG_WARNING,"connection_add(): failing because nfds is too high."); + log(LOG_WARN,"connection_add(): failing because nfds is too high."); return -1; } @@ -103,7 +103,7 @@ void connection_set_poll_socket(connection_t *conn) { poll_array[conn->poll_index].fd = conn->s; } -/* Remove the current function from the global list, and remove the +/* Remove the connection from the global list, and remove the * corresponding poll entry. Calling this function will shift the last * connection (if any) into the position occupied by conn. */ @@ -114,10 +114,11 @@ int connection_remove(connection_t *conn) { assert(nfds>0); log(LOG_INFO,"connection_remove(): removing socket %d, nfds now %d",conn->s, nfds-1); - circuit_about_to_close_connection(conn); /* if it's an edge conn, remove it from the list - * of conn's on this circuit. If it's not on an edge, - * flush and send destroys for all circuits on this conn - */ + /* if it's an edge conn, remove it from the list + * of conn's on this circuit. If it's not on an edge, + * flush and send destroys for all circuits on this conn + */ + circuit_about_to_close_connection(conn); current_index = conn->poll_index; if(current_index == nfds-1) { /* this is the end */ @@ -251,7 +252,7 @@ static void conn_close_if_marked(int i) { flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); } if(connection_wants_to_flush(conn)) /* not done flushing */ - log_fn(LOG_WARNING,"Conn (socket %d) still wants to flush. Losing %d bytes!",conn->s, (int)buf_datalen(conn->inbuf)); + log_fn(LOG_WARN,"Conn (socket %d) still wants to flush. Losing %d bytes!",conn->s, (int)buf_datalen(conn->inbuf)); } connection_remove(conn); connection_free(conn); @@ -262,7 +263,7 @@ static void conn_close_if_marked(int i) { } } -/* Perform regulare maintenance tasks for a single connection. This +/* Perform regular maintenance tasks for a single connection. This * function gets run once per second per connection by run_housekeeping. */ static void run_connection_housekeeping(int i, time_t now) { @@ -333,7 +334,7 @@ static void run_scheduled_events(time_t now) { time_to_fetch_directory = now + options.DirFetchPostPeriod; } - /* 2. Every NewCircuitPeriod seconds, we expire old ciruits and make a + /* 2. Every NewCircuitPeriod seconds, we expire old circuits and make a * new one as needed. */ if(options.APPort && time_to_new_circuit < now) { @@ -607,7 +608,7 @@ static int do_main_loop(void) { /* fetch a new directory */ if(options.DirPort) { if(router_get_list_from_file(options.RouterFile) < 0) { - log(LOG_WARNING,"Error reloading router list. Continuing with old list."); + log(LOG_WARN,"Error reloading router list. Continuing with old list."); } } else { directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_FETCH); @@ -677,7 +678,7 @@ static void catch(int the_signal) { please_reap_children = 1; break; default: - log(LOG_WARNING,"Caught signal %d that we can't handle??", the_signal); + log(LOG_WARN,"Caught signal %d that we can't handle??", the_signal); } #endif /* signal stuff */ } @@ -757,7 +758,7 @@ void write_pidfile(char *filename) { FILE *pidfile; if ((pidfile = fopen(filename, "w")) == NULL) { - log_fn(LOG_WARNING, "unable to open %s for writing: %s", filename, + log_fn(LOG_WARN, "unable to open %s for writing: %s", filename, strerror(errno)); } else { fprintf(pidfile, "%d", getpid()); diff --git a/src/or/onion.c b/src/or/onion.c index ef6afd28f6..f0bf9aacc1 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -51,7 +51,7 @@ int onion_pending_add(circuit_t *circ) { assert(!ol_tail->next); if(ol_length >= options.MaxOnionsPending) { - log_fn(LOG_WARNING,"Already have %d onions queued. Closing.", ol_length); + log_fn(LOG_WARN,"Already have %d onions queued. Closing.", ol_length); free(tmp); return -1; } @@ -141,13 +141,13 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key if (!(circ->n_crypto = crypto_create_init_cipher(CIRCUIT_CIPHER,keys,iv,0))) { - log_fn(LOG_WARNING,"Cipher initialization failed (n)."); + log_fn(LOG_WARN,"Cipher initialization failed (n)."); return -1; } if (!(circ->p_crypto = crypto_create_init_cipher(CIRCUIT_CIPHER,keys+16,iv,1))) { - log_fn(LOG_WARNING,"Cipher initialization failed (p)."); + log_fn(LOG_WARN,"Cipher initialization failed (p)."); return -1; } @@ -193,7 +193,7 @@ static unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, *routelen = chooselen(cw); if (*routelen == -1) { - log_fn(LOG_WARNING,"Choosing route length failed."); + log_fn(LOG_WARN,"Choosing route length failed."); return NULL; } log_fn(LOG_DEBUG,"Chosen route length %d (%d routers available).",*routelen, rarray_len); @@ -211,7 +211,7 @@ static unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, } if(*routelen < 1) { - log_fn(LOG_WARNING,"Didn't find any acceptable routers. Failing."); + log_fn(LOG_WARN,"Didn't find any acceptable routers. Failing."); return NULL; } diff --git a/src/or/routers.c b/src/or/routers.c index e04d9c4adc..292e045b77 100644 --- a/src/or/routers.c +++ b/src/or/routers.c @@ -78,7 +78,7 @@ void router_upload_desc_to_dirservers(void) { return; if (!router_get_my_descriptor()) { - log_fn(LOG_WARNING, "No descriptor; skipping upload"); + log_fn(LOG_WARN, "No descriptor; skipping upload"); return; } @@ -192,12 +192,12 @@ int router_get_list_from_file(char *routerfile) string = read_file_to_str(routerfile); if(!string) { - log_fn(LOG_WARNING,"Failed to load routerfile %s.",routerfile); + log_fn(LOG_WARN,"Failed to load routerfile %s.",routerfile); return -1; } if(router_get_list_from_string(string) < 0) { - log_fn(LOG_WARNING,"The routerfile itself was corrupt."); + log_fn(LOG_WARN,"The routerfile itself was corrupt."); free(string); return -1; } @@ -458,11 +458,11 @@ static char *find_whitespace(char *s) { int router_get_list_from_string(char *s) { if (router_get_list_from_string_impl(&s, &directory, -1, NULL)) { - log(LOG_WARNING, "Error parsing router file"); + log(LOG_WARN, "Error parsing router file"); return -1; } if (router_resolve_directory(directory)) { - log(LOG_WARNING, "Error resolving directory"); + log(LOG_WARN, "Error resolving directory"); return -1; } return 0; @@ -474,23 +474,23 @@ static int router_get_hash_impl(char *s, char *digest, const char *start_str, char *start, *end; start = strstr(s, start_str); if (!start) { - log_fn(LOG_WARNING,"couldn't find \"%s\"",start_str); + log_fn(LOG_WARN,"couldn't find \"%s\"",start_str); return -1; } end = strstr(start+strlen(start_str), end_str); if (!end) { - log_fn(LOG_WARNING,"couldn't find \"%s\"",end_str); + log_fn(LOG_WARN,"couldn't find \"%s\"",end_str); return -1; } end = strchr(end, '\n'); if (!end) { - log_fn(LOG_WARNING,"couldn't find EOL"); + log_fn(LOG_WARN,"couldn't find EOL"); return -1; } ++end; if (crypto_SHA_digest(start, end-start, digest)) { - log_fn(LOG_WARNING,"couldn't compute digest"); + log_fn(LOG_WARN,"couldn't compute digest"); return -1; } @@ -530,17 +530,17 @@ int compare_recommended_versions(char *myversion, char *start) { int router_get_dir_from_string(char *s, crypto_pk_env_t *pkey) { if (router_get_dir_from_string_impl(s, &directory, pkey)) { - log_fn(LOG_WARNING, "Couldn't parse directory."); + log_fn(LOG_WARN, "Couldn't parse directory."); return -1; } if (router_resolve_directory(directory)) { - log_fn(LOG_WARNING, "Error resolving directory"); + log_fn(LOG_WARN, "Error resolving directory"); return -1; } if (compare_recommended_versions(VERSION, directory->software_versions) < 0) { - log(LOG_WARNING, "You are running tor version %s, which is no longer supported.\nPlease upgrade to one of %s.", VERSION, directory->software_versions); + log(LOG_WARN, "You are running tor version %s, which is no longer supported.\nPlease upgrade to one of %s.", VERSION, directory->software_versions); if(options.IgnoreVersion) { - log(LOG_WARNING, "IgnoreVersion is set. If it breaks, we told you so."); + log(LOG_WARN, "IgnoreVersion is set. If it breaks, we told you so."); } else { log(LOG_ERR,"Set IgnoreVersion config variable if you want to proceed."); fflush(0); @@ -567,19 +567,19 @@ int router_get_dir_from_string_impl(char *s, directory_t **dest, #define NEXT_TOK() \ do { \ if (router_get_next_token(&s, &tok)) { \ - log_fn(LOG_WARNING, "Error reading directory: %s", tok.val.error);\ + log_fn(LOG_WARN, "Error reading directory: %s", tok.val.error);\ return -1; \ } } while (0) #define TOK_IS(type,name) \ do { \ if (tok.tp != type) { \ router_release_token(&tok); \ - log_fn(LOG_WARNING, "Error reading directory: expected %s", name);\ + log_fn(LOG_WARN, "Error reading directory: expected %s", name);\ return -1; \ } } while(0) if (router_get_dir_hash(s, digest)) { - log_fn(LOG_WARNING, "Unable to compute digest of directory"); + log_fn(LOG_WARN, "Unable to compute digest of directory"); goto err; } log(LOG_DEBUG,"Received directory hashes to %02x:%02x:%02x:%02x", @@ -592,19 +592,19 @@ int router_get_dir_from_string_impl(char *s, directory_t **dest, NEXT_TOK(); TOK_IS(K_PUBLISHED, "published"); if (tok.val.cmd.n_args != 2) { - log_fn(LOG_WARNING, "Invalid published line"); + log_fn(LOG_WARN, "Invalid published line"); goto err; } tok.val.cmd.args[1][-1] = ' '; if (!strptime(tok.val.cmd.args[0], "%Y-%m-%d %H:%M:%S", &published)) { - log_fn(LOG_WARNING, "Published time was unparseable"); goto err; + log_fn(LOG_WARN, "Published time was unparseable"); goto err; } published_on = timegm(&published); NEXT_TOK(); TOK_IS(K_RECOMMENDED_SOFTWARE, "recommended-software"); if (tok.val.cmd.n_args != 1) { - log_fn(LOG_WARNING, "Invalid recommended-software line"); + log_fn(LOG_WARN, "Invalid recommended-software line"); goto err; } versions = tor_strdup(tok.val.cmd.args[0]); @@ -616,7 +616,7 @@ int router_get_dir_from_string_impl(char *s, directory_t **dest, if (router_get_list_from_string_impl(&s, &new_dir, n_good_nicknames, good_nickname_lst)) { - log_fn(LOG_WARNING, "Error reading routers from directory"); + log_fn(LOG_WARN, "Error reading routers from directory"); goto err; } new_dir->software_versions = versions; @@ -629,7 +629,7 @@ int router_get_dir_from_string_impl(char *s, directory_t **dest, if (pkey) { if (crypto_pk_public_checksig(pkey, tok.val.signature, 128, signed_digest) != 20) { - log_fn(LOG_WARNING, "Error reading directory: invalid signature."); + log_fn(LOG_WARN, "Error reading directory: invalid signature."); free(tok.val.signature); goto err; } @@ -637,7 +637,7 @@ int router_get_dir_from_string_impl(char *s, directory_t **dest, ((int)signed_digest[0])&0xff,((int)signed_digest[1])&0xff, ((int)signed_digest[2])&0xff,((int)signed_digest[3])&0xff); if (memcmp(digest, signed_digest, 20)) { - log_fn(LOG_WARNING, "Error reading directory: signature does not match."); + log_fn(LOG_WARN, "Error reading directory: signature does not match."); free(tok.val.signature); goto err; } @@ -680,11 +680,11 @@ int router_get_list_from_string_impl(char **s, directory_t **dest, break; router = router_get_entry_from_string(s); if (!router) { - log_fn(LOG_WARNING, "Error reading router"); + log_fn(LOG_WARN, "Error reading router"); return -1; } if (rarray_len >= MAX_ROUTERS_IN_DIR) { - log_fn(LOG_WARNING, "too many routers"); + log_fn(LOG_WARN, "too many routers"); routerinfo_free(router); continue; } @@ -719,7 +719,7 @@ router_resolve(routerinfo_t *router) rent = (struct hostent *)gethostbyname(router->address); if (!rent) { - log_fn(LOG_WARNING,"Could not get address for router %s.",router->address); + log_fn(LOG_WARN,"Could not get address for router %s.",router->address); return -1; } assert(rent->h_length == 4); @@ -740,7 +740,7 @@ router_resolve_directory(directory_t *dir) for (i = 0; i < max; ++i) { remove = 0; if (router_resolve(dir->routers[i])) { - log_fn(LOG_WARNING, "Couldn't resolve router %s; removing", + log_fn(LOG_WARN, "Couldn't resolve router %s; removing", dir->routers[i]->address); remove = 1; routerinfo_free(dir->routers[i]); @@ -773,14 +773,14 @@ routerinfo_t *router_get_entry_from_string(char**s) { #define NEXT_TOKEN() \ do { if (router_get_next_token(s, tok)) { \ - log_fn(LOG_WARNING, "Error reading directory: %s", tok->val.error);\ + log_fn(LOG_WARN, "Error reading directory: %s", tok->val.error);\ goto err; \ } } while(0) #define ARGS tok->val.cmd.args if (router_get_router_hash(*s, digest) < 0) { - log_fn(LOG_WARNING, "Couldn't compute router hash."); + log_fn(LOG_WARN, "Couldn't compute router hash."); return NULL; } @@ -788,7 +788,7 @@ routerinfo_t *router_get_entry_from_string(char**s) { if (tok->tp != K_ROUTER) { router_release_token(tok); - log_fn(LOG_WARNING,"Entry does not start with \"router\""); + log_fn(LOG_WARN,"Entry does not start with \"router\""); return NULL; } @@ -799,17 +799,17 @@ routerinfo_t *router_get_entry_from_string(char**s) { router->onion_pkey = router->identity_pkey = router->link_pkey = NULL; if (tok->val.cmd.n_args != 6) { - log_fn(LOG_WARNING,"Wrong # of arguments to \"router\""); + log_fn(LOG_WARN,"Wrong # of arguments to \"router\""); goto err; } router->nickname = tor_strdup(ARGS[0]); if (strlen(router->nickname) > MAX_NICKNAME_LEN) { - log_fn(LOG_WARNING,"Router nickname too long."); + log_fn(LOG_WARN,"Router nickname too long."); goto err; } if (strspn(router->nickname, LEGAL_NICKNAME_CHARACTERS) != strlen(router->nickname)) { - log_fn(LOG_WARNING, "Router nickname contains illegal characters."); + log_fn(LOG_WARN, "Router nickname contains illegal characters."); goto err; } @@ -820,7 +820,7 @@ routerinfo_t *router_get_entry_from_string(char**s) { /* Read router->or_port */ router->or_port = atoi(ARGS[2]); if(!router->or_port) { - log_fn(LOG_WARNING,"or_port unreadable or 0. Failing."); + log_fn(LOG_WARN,"or_port unreadable or 0. Failing."); goto err; } @@ -833,7 +833,7 @@ routerinfo_t *router_get_entry_from_string(char**s) { /* Router->bandwidth */ router->bandwidth = atoi(ARGS[5]); if (!router->bandwidth) { - log_fn(LOG_WARNING,"bandwidth unreadable or 0. Failing."); + log_fn(LOG_WARN,"bandwidth unreadable or 0. Failing."); goto err; } @@ -847,44 +847,44 @@ routerinfo_t *router_get_entry_from_string(char**s) { } if (tok->tp != K_PUBLISHED) { - log_fn(LOG_WARNING, "Missing published time"); goto err; + log_fn(LOG_WARN, "Missing published time"); goto err; } if (tok->val.cmd.n_args != 2) { - log_fn(LOG_WARNING, "Wrong number of arguments to published"); goto err; + log_fn(LOG_WARN, "Wrong number of arguments to published"); goto err; } ARGS[1][-1] = ' '; /* Re-insert space. */ if (!strptime(ARGS[0], "%Y-%m-%d %H:%M:%S", &published)) { - log_fn(LOG_WARNING, "Published time was unparseable"); goto err; + log_fn(LOG_WARN, "Published time was unparseable"); goto err; } router->published_on = timegm(&published); NEXT_TOKEN(); if (tok->tp != K_ONION_KEY) { - log_fn(LOG_WARNING, "Missing onion-key"); goto err; + log_fn(LOG_WARN, "Missing onion-key"); goto err; } NEXT_TOKEN(); if (tok->tp != _PUBLIC_KEY) { - log_fn(LOG_WARNING, "Missing onion key"); goto err; + log_fn(LOG_WARN, "Missing onion key"); goto err; } /* XXX Check key length */ router->onion_pkey = tok->val.public_key; NEXT_TOKEN(); if (tok->tp != K_LINK_KEY) { - log_fn(LOG_WARNING, "Missing link-key"); goto err; + log_fn(LOG_WARN, "Missing link-key"); goto err; } NEXT_TOKEN(); if (tok->tp != _PUBLIC_KEY) { - log_fn(LOG_WARNING, "Missing link key"); goto err; + log_fn(LOG_WARN, "Missing link key"); goto err; } /* XXX Check key length */ router->link_pkey = tok->val.public_key; NEXT_TOKEN(); if (tok->tp != K_SIGNING_KEY) { - log_fn(LOG_WARNING, "Missing signing-key"); goto err; + log_fn(LOG_WARN, "Missing signing-key"); goto err; } NEXT_TOKEN(); if (tok->tp != _PUBLIC_KEY) { - log_fn(LOG_WARNING, "Missing signing key"); goto err; + log_fn(LOG_WARN, "Missing signing key"); goto err; } router->identity_pkey = tok->val.public_key; @@ -895,23 +895,23 @@ routerinfo_t *router_get_entry_from_string(char**s) { } if (tok->tp != K_ROUTER_SIGNATURE) { - log_fn(LOG_WARNING,"Missing router signature"); + log_fn(LOG_WARN,"Missing router signature"); goto err; } NEXT_TOKEN(); if (tok->tp != _SIGNATURE) { - log_fn(LOG_WARNING,"Missing router signature"); + log_fn(LOG_WARN,"Missing router signature"); goto err; } assert (router->identity_pkey); if ((t=crypto_pk_public_checksig(router->identity_pkey, tok->val.signature, 128, signed_digest)) != 20) { - log_fn(LOG_WARNING, "Invalid signature %d",t); + log_fn(LOG_WARN, "Invalid signature %d",t); goto err; } if (memcmp(digest, signed_digest, 20)) { - log_fn(LOG_WARNING, "Mismatched signature"); + log_fn(LOG_WARN, "Mismatched signature"); goto err; } @@ -972,7 +972,7 @@ void router_add_exit_policy_from_config(routerinfo_t *router) { } log_fn(LOG_DEBUG,"Adding new entry '%s'",line); if(router_add_exit_policy_from_string(router,line) < 0) - log_fn(LOG_WARNING,"Malformed exit policy %s; skipping.", line); + log_fn(LOG_WARN,"Malformed exit policy %s; skipping.", line); if(last) return; s = e+1; @@ -996,12 +996,12 @@ router_add_exit_policy_from_string(routerinfo_t *router, tmp[len]='\n'; tmp[len+1]='\0'; if (router_get_next_token(&cp, &tok)) { - log_fn(LOG_WARNING, "Error reading exit policy: %s", tok.val.error); + log_fn(LOG_WARN, "Error reading exit policy: %s", tok.val.error); free(tmp); return -1; } if (tok.tp != K_ACCEPT && tok.tp != K_REJECT) { - log_fn(LOG_WARNING, "Expected 'accept' or 'reject'."); + log_fn(LOG_WARN, "Expected 'accept' or 'reject'."); free(tmp); return -1; } @@ -1058,7 +1058,7 @@ static int router_add_exit_policy(routerinfo_t *router, policy_read_failed: assert(newe->string); - log_fn(LOG_WARNING,"Couldn't parse line '%s'. Dropping", newe->string); + log_fn(LOG_WARN,"Couldn't parse line '%s'. Dropping", newe->string); if(newe->string) free(newe->string); if(newe->address) @@ -1085,7 +1085,7 @@ int router_compare_to_exit_policy(connection_t *conn) { log_fn(LOG_DEBUG,"Considering exit policy %s:%s",tmpe->address, tmpe->port); if(strcmp(tmpe->address,"*") && inet_aton(tmpe->address,&in) == 0) { /* malformed IP. reject. */ - log_fn(LOG_WARNING,"Malformed IP %s in exit policy. Rejecting.",tmpe->address); + log_fn(LOG_WARN,"Malformed IP %s in exit policy. Rejecting.",tmpe->address); return -1; } if((!strcmp(tmpe->address,"*") || conn->addr == ntohl(in.s_addr)) && @@ -1126,7 +1126,7 @@ int router_rebuild_descriptor(void) { if(!address) { /* if not specified in config, we find a default */ if(gethostname(localhostname,sizeof(localhostname)) < 0) { - log_fn(LOG_WARNING,"Error obtaining local hostname"); + log_fn(LOG_WARN,"Error obtaining local hostname"); return -1; } address = localhostname; @@ -1149,7 +1149,7 @@ int router_rebuild_descriptor(void) { routerinfo_free(desc_routerinfo); desc_routerinfo = ri; if (router_dump_router_to_string(descriptor, 8192, ri, get_identity_key())<0) { - log_fn(LOG_WARNING, "Couldn't dump router to string."); + log_fn(LOG_WARN, "Couldn't dump router to string."); return -1; } return 0; @@ -1184,25 +1184,25 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, get_platform_str(platform, sizeof(platform)); if (crypto_pk_cmp_keys(ident_key, router->identity_pkey)) { - log_fn(LOG_WARNING,"Tried to sign a router with a private key that didn't match router's public key!"); + log_fn(LOG_WARN,"Tried to sign a router with a private key that didn't match router's public key!"); return -1; } if(crypto_pk_write_public_key_to_string(router->onion_pkey, &onion_pkey,&onion_pkeylen)<0) { - log_fn(LOG_WARNING,"write onion_pkey to string failed!"); + log_fn(LOG_WARN,"write onion_pkey to string failed!"); return -1; } if(crypto_pk_write_public_key_to_string(router->identity_pkey, &identity_pkey,&identity_pkeylen)<0) { - log_fn(LOG_WARNING,"write identity_pkey to string failed!"); + log_fn(LOG_WARN,"write identity_pkey to string failed!"); return -1; } if(crypto_pk_write_public_key_to_string(router->link_pkey, &link_pkey,&link_pkeylen)<0) { - log_fn(LOG_WARNING,"write link_pkey to string failed!"); + log_fn(LOG_WARN,"write link_pkey to string failed!"); return -1; } strftime(published, 32, "%Y-%m-%d %H:%M:%S", gmtime(&router->published_on)); @@ -1254,13 +1254,13 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, return -1; if (crypto_pk_private_sign(ident_key, digest, 20, signature) < 0) { - log_fn(LOG_WARNING, "Error signing digest"); + log_fn(LOG_WARN, "Error signing digest"); return -1; } strcat(s+written, "-----BEGIN SIGNATURE-----\n"); written += strlen(s+written); if (base64_encode(s+written, maxlen-written, signature, 128) < 0) { - log_fn(LOG_WARNING, "Couldn't base64-encode signature"); + log_fn(LOG_WARN, "Couldn't base64-encode signature"); return -1; } written += strlen(s+written); diff --git a/src/or/test.c b/src/or/test.c index 1f733f4271..27b30d19a8 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -554,7 +554,7 @@ test_dir_format() &pk3_str_len)); memset(buf, 0, 2048); - log_set_severity(LOG_WARNING); + log_set_severity(LOG_WARN); test_assert(router_dump_router_to_string(buf, 2048, &r1, pk2)>0); strcpy(buf2, "router Magri testaddr1.foo.bar 9000 9002 9003 1000\n" |