summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-31 05:52:07 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-31 05:52:07 +0200
commit6c656c7394bb972e81cd291b0ab126b2e73ce499 (patch)
treeac64bf647bc3b0a6a07a2c36decab13daf8a791f /src
parentae429e372a412cec84c6f67477bd9d429c485ff7 (diff)
downloadfastd-6c656c7394bb972e81cd291b0ab126b2e73ce499.tar
fastd-6c656c7394bb972e81cd291b0ab126b2e73ce499.zip
Make log levels verbose and info more useful
Diffstat (limited to 'src')
-rw-r--r--src/capabilities.c4
-rw-r--r--src/fastd.c4
-rw-r--r--src/peer.c5
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c10
-rw-r--r--src/receive.c8
5 files changed, 21 insertions, 10 deletions
diff --git a/src/capabilities.c b/src/capabilities.c
index 9da3fd4..29200d8 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -68,7 +68,7 @@ static void try_cap(cap_value_t cap) {
goto end_free;
}
- pr_verbose("Acquired capability %s.", name);
+ pr_verbose("acquired capability %s", name);
end_free:
cap_free(caps);
@@ -95,7 +95,7 @@ void fastd_cap_drop(void) {
pr_debug_errno("cap_set_proc");
}
else {
- pr_verbose("Dropped capabilities.");
+ pr_verbose("dropped capabilities");
}
cap_free(caps);
diff --git a/src/fastd.c b/src/fastd.c
index 8b5e7de..fc98ef5 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -345,7 +345,7 @@ static void set_user(void) {
if (setuid(conf.uid) < 0)
exit_errno("setuid");
- pr_info("Changed to UID %i, GID %i.", conf.uid, conf.gid);
+ pr_info("changed to UID %i, GID %i", (int)conf.uid, (int)conf.gid);
}
}
@@ -673,6 +673,8 @@ static inline void run(void) {
valgrind as easy as possible.
*/
static inline void cleanup(void) {
+ pr_info("terminating fastd");
+
on_down();
delete_peers();
diff --git a/src/peer.c b/src/peer.c
index da15114..fd123f7 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -304,8 +304,10 @@ static bool is_peer_in_group(const fastd_peer_t *peer, const fastd_peer_group_t
After a call to reset_peer a peer must be deleted by delete_peer or re-initialized by setup_peer.
*/
static void reset_peer(fastd_peer_t *peer) {
- if (fastd_peer_is_established(peer))
+ if (fastd_peer_is_established(peer)) {
on_disestablish(peer);
+ pr_info("connection with %P disestablished.", peer);
+ }
free_socket(peer);
@@ -794,7 +796,6 @@ static void send_handshake(fastd_peer_t *peer, fastd_remote_t *next_remote) {
return;
}
- pr_debug("sending handshake to %P[%I]...", peer, &peer->address);
peer->last_handshake_timeout = fastd_in_seconds(MIN_HANDSHAKE_INTERVAL);
peer->last_handshake_address = peer->address;
conf.protocol->handshake_init(peer->sock, &peer->local_address, &peer->address, peer);
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index 7374061..75dd974 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -523,10 +523,14 @@ void fastd_protocol_ec25519_fhmqvc_handshake_init(fastd_socket_t *sock, const fa
fastd_handshake_add(&buffer, RECORD_SENDER_KEY, PUBLICKEYBYTES, &conf.protocol_config->key.public);
- if (peer)
+ if (peer) {
fastd_handshake_add(&buffer, RECORD_RECIPIENT_KEY, PUBLICKEYBYTES, &peer->protocol_config->public_key);
- else
- pr_debug("sending handshake to unknown peer %I", remote_addr);
+
+ pr_verbose("sending handshake to %P[%I]...", peer, remote_addr);
+ }
+ else {
+ pr_verbose("sending handshake to unknown peer %I", remote_addr);
+ }
fastd_handshake_add(&buffer, RECORD_SENDER_HANDSHAKE_KEY, PUBLICKEYBYTES, &ctx.protocol_state->handshake_key.key.public);
diff --git a/src/receive.c b/src/receive.c
index aae4f8f..a232eae 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -131,8 +131,10 @@ static inline void handle_socket_receive_known(fastd_socket_t *sock, const fastd
if (!fastd_peer_is_established(peer) || !fastd_peer_address_equal(&peer->local_address, local_addr)) {
fastd_buffer_free(buffer);
- if (!backoff_unknown(remote_addr))
+ if (!backoff_unknown(remote_addr)) {
+ pr_debug("unexpectedly received payload data from %P[%I]", peer, remote_addr);
conf.protocol->handshake_init(sock, local_addr, remote_addr, NULL);
+ }
return;
}
@@ -158,8 +160,10 @@ static inline void handle_socket_receive_unknown(fastd_socket_t *sock, const fas
case PACKET_DATA:
fastd_buffer_free(buffer);
- if (!backoff_unknown(remote_addr))
+ if (!backoff_unknown(remote_addr)) {
+ pr_debug("unexpectedly received payload data from unknown address %I", remote_addr);
conf.protocol->handshake_init(sock, local_addr, remote_addr, NULL);
+ }
break;
case PACKET_HANDSHAKE: