From cb1165ecfc5c89c22aa4a6fffb72e27e0bde43a3 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Fri, 24 Feb 2017 20:10:42 +0100 Subject: [PATCH] util: add component name to LOG macros; util/client: log incoming message type/size/source for gnunet-logread --- contrib/gnunet-logread | 5 ++-- src/util/bio.c | 2 +- src/util/client.c | 7 ++++- src/util/common_allocation.c | 4 +-- src/util/common_endian.c | 2 +- src/util/configuration_loader.c | 2 +- src/util/connection.c | 4 +-- src/util/container_bloomfilter.c | 6 ++--- src/util/container_heap.c | 2 +- src/util/container_meta_data.c | 2 +- src/util/container_multihashmap.c | 2 +- src/util/container_multihashmap32.c | 2 +- src/util/container_multipeermap.c | 2 +- src/util/container_multishortmap.c | 2 +- src/util/crypto_crc.c | 2 +- src/util/crypto_ecc.c | 6 ++--- src/util/crypto_ecc_setup.c | 6 ++--- src/util/crypto_hash.c | 4 +-- src/util/crypto_hash_file.c | 4 +-- src/util/crypto_hkdf.c | 2 +- src/util/crypto_kdf.c | 2 +- src/util/crypto_mpi.c | 2 +- src/util/crypto_random.c | 4 +-- src/util/crypto_rsa.c | 38 +++++++++++++-------------- src/util/crypto_symmetric.c | 2 +- src/util/disk.c | 6 ++--- src/util/getopt.c | 4 +-- src/util/getopt_helpers.c | 2 +- src/util/load.c | 2 +- src/util/mq.c | 40 +++++++++++++++++------------ src/util/mst.c | 2 +- src/util/network.c | 6 ++--- src/util/os_installation.c | 4 +-- src/util/os_network.c | 4 +-- src/util/os_priority.c | 6 ++--- src/util/peer.c | 2 +- src/util/plugin.c | 2 +- src/util/program.c | 4 +-- src/util/resolver_api.c | 8 +++--- src/util/server.c | 6 ++--- src/util/server_mst.c | 2 +- src/util/server_tc.c | 2 +- src/util/service.c | 6 ++--- src/util/service_new.c | 6 ++--- src/util/signal.c | 2 +- src/util/socks.c | 4 +-- src/util/speedup.c | 2 +- src/util/strings.c | 4 +-- src/util/time.c | 2 +- src/util/winproc.c | 2 +- 50 files changed, 129 insertions(+), 117 deletions(-) diff --git a/contrib/gnunet-logread b/contrib/gnunet-logread index 5b125a5a4..e4b6752b8 100755 --- a/contrib/gnunet-logread +++ b/contrib/gnunet-logread @@ -85,7 +85,7 @@ sub perform { if (fileno O) { my ($time, $type, $size, $from, $to, $level, $msg); if (($time, $type, $size, $from, $to) = - /^([A-Z][a-z]{2}\ .[0-9]\ [0-9:]{8}(?:-[0-9]{6})?)\ util-.*\b + /^([A-Z][a-z]{2}\ .[0-9]\ [0-9:]{8}(?:-[0-9]{6})?)\ util-client-.*\b (?: Received | Transmitting )\ message \b.*?\b type \s+ (\d+) \b.*?\b size \s+ (\d+) \b.*?\b @@ -172,7 +172,7 @@ gnunet-logread - a GNUnet log analyzer, colorizer and aggregator =head1 MOTIVATION -GNUnet debug logs are a tedious read, but given a complex system that we +GNUnet debug logs are a tedious read, but given a complex system that we cannot run all parts of in a debugger all the time, some gathering and structuring of events and message passing is useful. @@ -196,4 +196,3 @@ instead, but that is still subject to further consideration. =head1 AUTHORS tg & lynX - diff --git a/src/util/bio.c b/src/util/bio.c index 62f4904f7..08e30dc01 100644 --- a/src/util/bio.c +++ b/src/util/bio.c @@ -25,7 +25,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-bio",__VA_ARGS__) #ifndef PATH_MAX /** diff --git a/src/util/client.c b/src/util/client.c index a5e04d7b2..0f7d0d359 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -33,7 +33,7 @@ #include "gnunet_socks.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-client",__VA_ARGS__) /** @@ -298,6 +298,11 @@ recv_message (void *cls, if (GNUNET_YES == cstate->in_destroy) return GNUNET_SYSERR; + + LOG (GNUNET_ERROR_TYPE_INFO, + "Received message of type %u and size %u from %s\n", + ntohs (msg->type), ntohs (msg->size), cstate->service_name); + GNUNET_MQ_inject_message (cstate->mq, msg); if (GNUNET_YES == cstate->in_destroy) diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 71a2221ee..737584815 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c @@ -32,9 +32,9 @@ #include #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-common-allocation",__VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-common-allocation", syscall) #ifndef INT_MAX #define INT_MAX 0x7FFFFFFF diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 4c8ad7182..f29e42c98 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c @@ -28,7 +28,7 @@ #include "platform.h" #include "gnunet_crypto_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-common-endian",__VA_ARGS__) uint64_t diff --git a/src/util/configuration_loader.c b/src/util/configuration_loader.c index 07eeb98f0..ceaf2a6ea 100644 --- a/src/util/configuration_loader.c +++ b/src/util/configuration_loader.c @@ -27,7 +27,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-configuration", __VA_ARGS__) /** diff --git a/src/util/connection.c b/src/util/connection.c index 02dd9f991..dfa673a86 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -35,9 +35,9 @@ #include "gnunet_resolver_service.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-connection", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-connection", syscall) /** diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 58725dcc5..aedca232d 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c @@ -42,11 +42,11 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-bloomfilter", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-container-bloomfilter", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-container-bloomfilter", syscall, filename) struct GNUNET_CONTAINER_BloomFilter { diff --git a/src/util/container_heap.c b/src/util/container_heap.c index 1ead5ec6d..21bdee834 100644 --- a/src/util/container_heap.c +++ b/src/util/container_heap.c @@ -28,7 +28,7 @@ #include "platform.h" #include "gnunet_container_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-heap", __VA_ARGS__) #define EXTRA_CHECKS 0 diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index b4d231dae..ec527005a 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c @@ -31,7 +31,7 @@ #endif #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-meta-data", __VA_ARGS__) diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index d85562579..ffeb4a71f 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_container_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-multihashmap", __VA_ARGS__) /** * An entry in the hash map with the full key. diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c index 4cc9b7ebd..d33c3c2d9 100644 --- a/src/util/container_multihashmap32.c +++ b/src/util/container_multihashmap32.c @@ -28,7 +28,7 @@ #include "platform.h" #include "gnunet_container_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-multihashmap32", __VA_ARGS__) /** * An entry in the hash map. diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c index 6c62e7403..7830771d8 100644 --- a/src/util/container_multipeermap.c +++ b/src/util/container_multipeermap.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-multipeermap", __VA_ARGS__) /** * An entry in the hash map with the full key. diff --git a/src/util/container_multishortmap.c b/src/util/container_multishortmap.c index 5e8a47b09..cfa82ca20 100644 --- a/src/util/container_multishortmap.c +++ b/src/util/container_multishortmap.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-container-multishortmap", __VA_ARGS__) /** * An entry in the hash map with the full key. diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c index d7f5f7fc8..03b24d9f7 100644 --- a/src/util/crypto_crc.c +++ b/src/util/crypto_crc.c @@ -30,7 +30,7 @@ #include "platform.h" #include "gnunet_crypto_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-crc", __VA_ARGS__) /* Avoid wasting space on 8-byte longs. */ #if UINT_MAX >= 0xffffffff diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 3f9150762..eaa49a991 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c @@ -38,11 +38,11 @@ */ #define CURVE "Ed25519" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-ecc", syscall, filename) /** * Log an error message at log-level 'level' that indicates diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c index 0ce55ddbf..2f2e2f122 100644 --- a/src/util/crypto_ecc_setup.c +++ b/src/util/crypto_ecc_setup.c @@ -27,11 +27,11 @@ #include #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-ecc", syscall, filename) /** * Log an error message at log-level 'level' that indicates diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 31824e72a..49dbacd0b 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c @@ -28,9 +28,9 @@ #include "gnunet_strings_lib.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-hash", syscall, filename) /** * Hash block of given size. diff --git a/src/util/crypto_hash_file.c b/src/util/crypto_hash_file.c index ace5212c9..3e5900200 100644 --- a/src/util/crypto_hash_file.c +++ b/src/util/crypto_hash_file.c @@ -27,9 +27,9 @@ #include "gnunet_util_lib.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash-file", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-hash-file", syscall, filename) /** diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c index c6c43f800..f04d3e675 100644 --- a/src/util/crypto_hkdf.c +++ b/src/util/crypto_hkdf.c @@ -36,7 +36,7 @@ * - Matthias Wachs (08.10.2010) */ -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hkdf", __VA_ARGS__) /** * Set this to 0 if you compile this code outside of GNUnet. diff --git a/src/util/crypto_kdf.c b/src/util/crypto_kdf.c index 78fb1911a..6d7c5a096 100644 --- a/src/util/crypto_kdf.c +++ b/src/util/crypto_kdf.c @@ -30,7 +30,7 @@ #include "platform.h" #include "gnunet_crypto_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-kdf", __VA_ARGS__) /** * @brief Derive key diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c index 668d5e602..ff3e9a8a7 100644 --- a/src/util/crypto_mpi.c +++ b/src/util/crypto_mpi.c @@ -29,7 +29,7 @@ #include "gnunet_crypto_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-mpi", __VA_ARGS__) /** * Log an error message at log-level 'level' that indicates diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 8897ae24f..d5b5eb9ec 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c @@ -28,9 +28,9 @@ #include "gnunet_crypto_lib.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-random", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-random", syscall) /* TODO: ndurner, move this to plibc? */ diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 443d597e4..7a108c21b 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c @@ -25,7 +25,7 @@ #include #include "gnunet_crypto_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-rsa", __VA_ARGS__) /** @@ -430,7 +430,7 @@ rsa_blinding_key_derive (const struct GNUNET_CRYPTO_RsaPublicKey *pkey, char *xts = "Blinding KDF extrator HMAC key"; /* Trusts bks' randomness more */ struct RsaBlindingKey *blind; gcry_mpi_t n; - + blind = GNUNET_new (struct RsaBlindingKey); GNUNET_assert( NULL != blind ); @@ -454,25 +454,25 @@ rsa_blinding_key_derive (const struct GNUNET_CRYPTO_RsaPublicKey *pkey, } -/* +/* We originally added GNUNET_CRYPTO_kdf_mod_mpi for the benifit of the previous routine. -There was previously a call to GNUNET_CRYPTO_kdf in +There was previously a call to GNUNET_CRYPTO_kdf in bkey = rsa_blinding_key_derive (len, bks); -that gives exactly len bits where +that gives exactly len bits where len = GNUNET_CRYPTO_rsa_public_key_len (pkey); Now r = 2^(len-1)/pkey.n is the probability that a set high bit being okay, meaning bkey < pkey.n. It follows that (1-r)/2 of the time bkey > -pkey.n making the effective bkey be +pkey.n making the effective bkey be bkey mod pkey.n = bkey - pkey.n so the effective bkey has its high bit set with probability r/2. We expect r to be close to 1/2 if the exchange is honest, but the exchange can choose r otherwise. -In blind signing, the exchange sees +In blind signing, the exchange sees B = bkey * S mod pkey.n On deposit, the exchange sees S so they can compute bkey' = B/S mod pkey.n for all B they recorded to see if bkey' has it's high bit set. @@ -489,7 +489,7 @@ the wrong and right probabilities 1/3 and 1/4, respectively. I feared this gives the exchange a meaningful fraction of a bit of information per coin involved in the transaction. It sounds damaging if numerous coins were involved. And it could run across transactions in -some scenarios. +some scenarios. We fixed this by using a more uniform deterministic pseudo-random number generator for blinding factors. I do not believe this to be a problem @@ -748,7 +748,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, } data = rsa_full_domain_hash (pkey, hash); - if (NULL == data) + if (NULL == data) goto rsa_gcd_validate_failure; bkey = rsa_blinding_key_derive (pkey, bks); @@ -771,7 +771,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, gcry_mpi_release (ne[0]); gcry_mpi_release (ne[1]); gcry_mpi_release (r_e); - rsa_blinding_key_free (bkey); + rsa_blinding_key_free (bkey); *buf_size = numeric_mpi_alloc_n_print (data_r_e, buf); gcry_mpi_release (data_r_e); @@ -917,7 +917,7 @@ GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, GNUNET_CRYPTO_rsa_public_key_free (pkey); if (NULL == v) /* rsa_gcd_validate failed meaning */ return NULL; /* our *own* RSA key is malicious. */ - + sig = rsa_sign_mpi (key, v); gcry_mpi_release (v); return sig; @@ -1077,11 +1077,11 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, } bkey = rsa_blinding_key_derive (pkey, bks); - if (NULL == bkey) + if (NULL == bkey) { - /* RSA key is malicious since rsa_gcd_validate failed here. + /* RSA key is malicious since rsa_gcd_validate failed here. * It should have failed during GNUNET_CRYPTO_rsa_blind too though, - * so the exchange is being malicious in an unfamilair way, maybe + * so the exchange is being malicious in an unfamilair way, maybe * just trying to crash us. */ GNUNET_break_op (0); gcry_mpi_release (n); @@ -1096,10 +1096,10 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, n)) { /* We cannot find r mod n, so gcd(r,n) != 1, which should get * - * caught above, but we handle it the same here. */ + * caught above, but we handle it the same here. */ GNUNET_break_op (0); gcry_mpi_release (r_inv); - rsa_blinding_key_free (bkey); + rsa_blinding_key_free (bkey); gcry_mpi_release (n); gcry_mpi_release (s); return NULL; @@ -1144,11 +1144,11 @@ GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, r = rsa_full_domain_hash (pkey, hash); if (NULL == r) { GNUNET_break_op (0); - /* RSA key is malicious since rsa_gcd_validate failed here. + /* RSA key is malicious since rsa_gcd_validate failed here. * It should have failed during GNUNET_CRYPTO_rsa_blind too though, - * so the exchange is being malicious in an unfamilair way, maybe + * so the exchange is being malicious in an unfamilair way, maybe * just trying to crash us. Arguably, we've only an internal error - * though because we should've detected this in our previous call + * though because we should've detected this in our previous call * to GNUNET_CRYPTO_rsa_unblind. */ return GNUNET_NO; } diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c index 381a5d2f8..e25e2f1dd 100644 --- a/src/util/crypto_symmetric.c +++ b/src/util/crypto_symmetric.c @@ -29,7 +29,7 @@ #include "gnunet_crypto_lib.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-symmetric", __VA_ARGS__) /** * Create a new SessionKey (for symmetric encryption). diff --git a/src/util/disk.c b/src/util/disk.c index 40043549b..305607594 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -28,11 +28,11 @@ #include "gnunet_strings_lib.h" #include "gnunet_disk_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-disk", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-disk", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-disk", syscall, filename) /** * Block size for IO for copying files. diff --git a/src/util/getopt.c b/src/util/getopt.c index e150496ae..ff62dba9b 100644 --- a/src/util/getopt.c +++ b/src/util/getopt.c @@ -47,9 +47,9 @@ Copyright Copyright (C) 2006 Christian Grothoff #endif #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-getopt", syscall) #if defined (WIN32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index ab0b67412..4d7104503 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) /** diff --git a/src/util/load.c b/src/util/load.c index d374d7a17..d1de6aa36 100644 --- a/src/util/load.c +++ b/src/util/load.c @@ -27,7 +27,7 @@ #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-load", __VA_ARGS__) /** * Values we track for load calculations. diff --git a/src/util/mq.c b/src/util/mq.c index 95bcd71cb..a8216d964 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "mq",__VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-mq",__VA_ARGS__) struct GNUNET_MQ_Envelope @@ -235,24 +235,29 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, { const struct GNUNET_MQ_MessageHandler *handler; int handled = GNUNET_NO; - uint16_t ms = ntohs (mh->size); + uint16_t msize = ntohs (mh->size); + uint16_t mtype = ntohs (mh->type); + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Received message of type %u and size %u\n", + mtype, msize); if (NULL == mq->handlers) goto done; for (handler = mq->handlers; NULL != handler->cb; handler++) { - if (handler->type == ntohs (mh->type)) + if (handler->type == mtype) { handled = GNUNET_YES; - if ( (handler->expected_size > ms) || - ( (handler->expected_size != ms) && + if ( (handler->expected_size > msize) || + ( (handler->expected_size != msize) && (NULL == handler->mv) ) ) { /* Too small, or not an exact size and no 'mv' handler to check rest */ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Received malformed message of type %u\n", - (unsigned int) handler->type); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Received malformed message of type %u\n", + (unsigned int) handler->type); GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_MALFORMED); break; @@ -267,9 +272,9 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, else { /* Message rejected by check routine */ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Received malformed message of type %u\n", - (unsigned int) handler->type); + LOG (GNUNET_ERROR_TYPE_ERROR, + "Received malformed message of type %u\n", + (unsigned int) handler->type); GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_MALFORMED); } @@ -279,9 +284,8 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, done: if (GNUNET_NO == handled) LOG (GNUNET_ERROR_TYPE_INFO, - "No handler for message of type %d and size %d\n", - ntohs (mh->type), - ntohs (mh->size)); + "No handler for message of type %u and size %u\n", + mtype, msize); } @@ -756,9 +760,13 @@ server_client_send_impl (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state) { - struct ServerClientSocketState *state = impl_state; - GNUNET_assert (NULL != mq); + + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Transmitting message of type %u and size %u\n", + ntohs (msg->type), ntohs (msg->size)); + + struct ServerClientSocketState *state = impl_state; state->th = GNUNET_SERVER_notify_transmit_ready (state->client, ntohs (msg->size), GNUNET_TIME_UNIT_FOREVER_REL, diff --git a/src/util/mst.c b/src/util/mst.c index 1422c248e..9f1d30d7a 100644 --- a/src/util/mst.c +++ b/src/util/mst.c @@ -34,7 +34,7 @@ #define ALIGN_FACTOR 8 #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-mst", __VA_ARGS__) /** diff --git a/src/util/network.c b/src/util/network.c index 67f2801c5..c82caafd9 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -28,9 +28,9 @@ #include "gnunet_util_lib.h" #include "disk.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG(kind,...) GNUNET_log_from (kind, "util-network", __VA_ARGS__) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-network", syscall, filename) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-network", syscall) #define DEBUG_NETWORK GNUNET_EXTRA_LOGGING diff --git a/src/util/os_installation.c b/src/util/os_installation.c index ea3ae3e79..caceeea0c 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c @@ -44,9 +44,9 @@ #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-installation", syscall, filename) /** diff --git a/src/util/os_network.c b/src/util/os_network.c index 5e4546d08..2ac1a16d3 100644 --- a/src/util/os_network.c +++ b/src/util/os_network.c @@ -31,8 +31,8 @@ #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG(kind,...) GNUNET_log_from (kind, "util-os-network", __VA_ARGS__) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-network", syscall, filename) #if ! (HAVE_GETIFADDRS && HAVE_FREEIFADDRS) diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 4b1dbd491..6888f9b83 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -29,11 +29,11 @@ #include "disk.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-os-priority", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-os-priority", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-priority", syscall, filename) #define GNUNET_OS_CONTROL_PIPE "GNUNET_OS_CONTROL_PIPE" diff --git a/src/util/peer.c b/src/util/peer.c index 5d54a4301..b637dc229 100644 --- a/src/util/peer.c +++ b/src/util/peer.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_peer_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-peer", __VA_ARGS__) struct PeerEntry diff --git a/src/util/plugin.c b/src/util/plugin.c index c7ac47a7c..fb296f80d 100644 --- a/src/util/plugin.c +++ b/src/util/plugin.c @@ -28,7 +28,7 @@ #include #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__) /** * Linked list of active plugins. diff --git a/src/util/program.c b/src/util/program.c index d0dd49909..e2b356f88 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -31,9 +31,9 @@ #include "speedup.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-program", __VA_ARGS__) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-program", syscall, filename) /** * Context for the command. diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index fdeaed006..f33c31f1c 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -29,9 +29,9 @@ #include "gnunet_resolver_service.h" #include "resolver.h" -#define LOG(kind,...) GNUNET_log_from (kind, "resolver-api", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-resolver-api", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "resolver-api", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-resolver-api", syscall) /** * Maximum supported length for a hostname @@ -250,7 +250,7 @@ void GNUNET_RESOLVER_disconnect () { struct GNUNET_RESOLVER_RequestHandle *rh; - + while (NULL != (rh = req_head)) { GNUNET_assert (GNUNET_SYSERR == rh->was_transmitted); @@ -298,7 +298,7 @@ static void check_disconnect () { struct GNUNET_RESOLVER_RequestHandle *rh; - + for (rh = req_head; NULL != rh; rh = rh->next) if (GNUNET_SYSERR != rh->was_transmitted) return; diff --git a/src/util/server.c b/src/util/server.c index 00e37c9d9..d7da5c6c0 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -28,11 +28,11 @@ #include "gnunet_util_lib.h" #include "gnunet_protocols.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-server", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-server", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-server", syscall, filename) /** diff --git a/src/util/server_mst.c b/src/util/server_mst.c index 8c9bc4b5b..5155b54da 100644 --- a/src/util/server_mst.c +++ b/src/util/server_mst.c @@ -34,7 +34,7 @@ #define ALIGN_FACTOR 8 #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-server-mst", __VA_ARGS__) /** diff --git a/src/util/server_tc.c b/src/util/server_tc.c index 40a8ba015..8ae380a85 100644 --- a/src/util/server_tc.c +++ b/src/util/server_tc.c @@ -29,7 +29,7 @@ #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-server-tc", __VA_ARGS__) /** diff --git a/src/util/service.c b/src/util/service.c index 11128425d..496904fb1 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -36,11 +36,11 @@ #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-service", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-service", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-service", syscall, filename) /* ******************* access control ******************** */ diff --git a/src/util/service_new.c b/src/util/service_new.c index 731be2cfe..a832b070c 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c @@ -37,11 +37,11 @@ #endif -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-service", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-service", syscall) -#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) +#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-service", syscall, filename) /** diff --git a/src/util/signal.c b/src/util/signal.c index 543fcd899..cb917e36a 100644 --- a/src/util/signal.c +++ b/src/util/signal.c @@ -27,7 +27,7 @@ #include "platform.h" #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-signal", __VA_ARGS__) struct GNUNET_SIGNAL_Context diff --git a/src/util/socks.c b/src/util/socks.c index fee79cc80..37e60e3e4 100644 --- a/src/util/socks.c +++ b/src/util/socks.c @@ -29,9 +29,9 @@ #include "gnunet_util_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "socks", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-socks", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "socks", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-socks", syscall) /* SOCKS5 authentication methods */ diff --git a/src/util/speedup.c b/src/util/speedup.c index 97df65c8e..c6a4cf678 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c @@ -27,7 +27,7 @@ #include "gnunet_util_lib.h" #include "speedup.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-speedup", __VA_ARGS__) static struct GNUNET_TIME_Relative interval; diff --git a/src/util/strings.c b/src/util/strings.c index 291255344..d3268f4d9 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -34,9 +34,9 @@ #include #include -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__) -#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) +#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-strings", syscall) /** diff --git a/src/util/time.c b/src/util/time.c index 89b0c2d44..19100ac36 100644 --- a/src/util/time.c +++ b/src/util/time.c @@ -27,7 +27,7 @@ #include "gnunet_crypto_lib.h" #include "gnunet_time_lib.h" -#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-time", __VA_ARGS__) /** * Variable used to simulate clock skew. Used for testing, never in production. diff --git a/src/util/winproc.c b/src/util/winproc.c index 66c225ce5..318b68a88 100644 --- a/src/util/winproc.c +++ b/src/util/winproc.c @@ -69,7 +69,7 @@ TAddAce GNAddAce; TAddAccessAllowedAce GNAddAccessAllowedAce; TSetNamedSecurityInfo GNSetNamedSecurityInfo; -#define LOG(kind,...) GNUNET_log_from (kind, "winproc", __VA_ARGS__) +#define LOG(kind,...) GNUNET_log_from (kind, "util-winproc", __VA_ARGS__) /** * Log (panic) messages from PlibC */ -- 2.25.1