From 33e87eb7680148006b7c9fc8f89040ad104597ea Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 19 Jun 2019 21:20:39 +0200 Subject: fix socket cmp, fix compiler warnings about unused args --- src/nse/gnunet-nse.c | 38 ++++--- src/nse/nse_api.c | 43 +++---- src/util/crypto_random.c | 84 ++++++-------- src/util/gnunet-scrypt.c | 213 +++++++++++++++++------------------ src/util/gnunet-uri.c | 84 ++++++++------ src/util/test_common_logging_dummy.c | 59 ++++++---- src/util/tun.c | 163 ++++++++++++++------------- 7 files changed, 343 insertions(+), 341 deletions(-) diff --git a/src/nse/gnunet-nse.c b/src/nse/gnunet-nse.c index bf2fe11c3..c8ffa152e 100644 --- a/src/nse/gnunet-nse.c +++ b/src/nse/gnunet-nse.c @@ -46,6 +46,7 @@ static int status; static void do_shutdown (void *cls) { + (void) cls; if (NULL != nse) { GNUNET_NSE_disconnect (nse); @@ -65,12 +66,14 @@ do_shutdown (void *cls) */ static void handle_estimate (void *cls, - struct GNUNET_TIME_Absolute timestamp, + struct GNUNET_TIME_Absolute timestamp, double estimate, - double std_dev) + double std_dev) { + (void) cls; status = 0; - FPRINTF (stdout, "%llu %f %f %f\n", + FPRINTF (stdout, + "%llu %f %f %f\n", (unsigned long long) timestamp.abs_value_us, GNUNET_NSE_log_estimate_to_n (estimate), estimate, @@ -92,11 +95,11 @@ run (void *cls, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - nse = GNUNET_NSE_connect (cfg, - &handle_estimate, - NULL); - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, - NULL); + (void) cls; + (void) args; + (void) cfgfile; + nse = GNUNET_NSE_connect (cfg, &handle_estimate, NULL); + GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); } @@ -106,22 +109,21 @@ run (void *cls, * @return 0 on success */ int -main (int argc, - char *const *argv) +main (int argc, char *const *argv) { static struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_END - }; + GNUNET_GETOPT_OPTION_END}; status = 1; if (GNUNET_OK != GNUNET_PROGRAM_run (argc, - argv, - "gnunet-nse", - gettext_noop - ("Show network size estimates from NSE service."), - options, - &run, NULL)) + argv, + "gnunet-nse", + gettext_noop ( + "Show network size estimates from NSE service."), + options, + &run, + NULL)) return 2; return status; } diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index e9eaada93..259be75ed 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c @@ -32,7 +32,7 @@ #include "gnunet_nse_service.h" #include "nse.h" -#define LOG(kind,...) GNUNET_log_from (kind, "nse-api",__VA_ARGS__) +#define LOG(kind, ...) GNUNET_log_from (kind, "nse-api", __VA_ARGS__) /** * Handle for talking with the NSE service. @@ -68,7 +68,6 @@ struct GNUNET_NSE_Handle * Closure to pass to @e recv_cb callback. */ void *recv_cb_cls; - }; @@ -91,17 +90,15 @@ reconnect (void *cls); * @param error error code */ static void -mq_error_handler (void *cls, - enum GNUNET_MQ_Error error) +mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_NSE_Handle *h = cls; + (void) error; GNUNET_MQ_destroy (h->mq); h->mq = NULL; - h->reconnect_task - = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, - &reconnect, - h); + h->reconnect_task = + GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); } @@ -114,8 +111,7 @@ mq_error_handler (void *cls, * @param client_msg message received */ static void -handle_estimate (void *cls, - const struct GNUNET_NSE_ClientMessage *client_msg) +handle_estimate (void *cls, const struct GNUNET_NSE_ClientMessage *client_msg) { struct GNUNET_NSE_Handle *h = cls; @@ -123,7 +119,7 @@ handle_estimate (void *cls, h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp), GNUNET_ntoh_double (client_msg->size_estimate), - GNUNET_ntoh_double (client_msg->std_deviation)); + GNUNET_ntoh_double (client_msg->std_deviation)); } @@ -136,13 +132,12 @@ static void reconnect (void *cls) { struct GNUNET_NSE_Handle *h = cls; - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (estimate, - GNUNET_MESSAGE_TYPE_NSE_ESTIMATE, - struct GNUNET_NSE_ClientMessage, - h), - GNUNET_MQ_handler_end () - }; + struct GNUNET_MQ_MessageHandler handlers[] = + {GNUNET_MQ_hd_fixed_size (estimate, + GNUNET_MESSAGE_TYPE_NSE_ESTIMATE, + struct GNUNET_NSE_ClientMessage, + h), + GNUNET_MQ_handler_end ()}; struct GNUNET_MessageHeader *msg; struct GNUNET_MQ_Envelope *env; @@ -150,17 +145,11 @@ reconnect (void *cls) LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to network size estimation service.\n"); GNUNET_assert (NULL == h->mq); - h->mq = GNUNET_CLIENT_connect (h->cfg, - "nse", - handlers, - &mq_error_handler, - h); + h->mq = GNUNET_CLIENT_connect (h->cfg, "nse", handlers, &mq_error_handler, h); if (NULL == h->mq) return; - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_NSE_START); - GNUNET_MQ_send (h->mq, - env); + env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_NSE_START); + GNUNET_MQ_send (h->mq, env); } diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 8bb5f0587..71eaab87a 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c @@ -28,22 +28,23 @@ #include "gnunet_crypto_lib.h" #include -#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-random", __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-crypto-random", syscall) +#define LOG_STRERROR(kind, syscall) \ + GNUNET_log_from_strerror (kind, "util-crypto-random", syscall) /* TODO: ndurner, move this to plibc? */ /* The code is derived from glibc, obviously */ -#if !HAVE_RANDOM || !HAVE_SRANDOM +#if ! HAVE_RANDOM || ! HAVE_SRANDOM #ifdef RANDOM #undef RANDOM #endif #ifdef SRANDOM #undef SRANDOM #endif -#define RANDOM() glibc_weak_rand32() -#define SRANDOM(s) glibc_weak_srand32(s) +#define RANDOM() glibc_weak_rand32 () +#define SRANDOM(s) glibc_weak_srand32 (s) #if defined(RAND_MAX) #undef RAND_MAX #endif @@ -105,17 +106,12 @@ GNUNET_CRYPTO_seed_weak_random (int32_t seed) * @param length buffer length */ void -GNUNET_CRYPTO_zero_keys (void *buffer, - size_t length) +GNUNET_CRYPTO_zero_keys (void *buffer, size_t length) { #if HAVE_MEMSET_S - memset_s (buffer, - length, - 0, - length); + memset_s (buffer, length, 0, length); #elif HAVE_EXPLICIT_BZERO - explicit_bzero (buffer, - length); + explicit_bzero (buffer, length); #else volatile unsigned char *p = buffer; while (length--) @@ -175,8 +171,7 @@ GNUNET_CRYPTO_random_block (enum GNUNET_CRYPTO_Quality mode, * @return a random value in the interval [0,i[. */ uint32_t -GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, - uint32_t i) +GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i) { #ifdef gcry_fast_random_poll static unsigned int invokeCount; @@ -197,18 +192,17 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, ul = UINT32_MAX - (UINT32_MAX % i); do { - gcry_randomize ((unsigned char *) &ret, sizeof (uint32_t), + gcry_randomize ((unsigned char *) &ret, + sizeof (uint32_t), GCRY_STRONG_RANDOM); - } - while (ret >= ul); + } while (ret >= ul); return ret % i; case GNUNET_CRYPTO_QUALITY_NONCE: ul = UINT32_MAX - (UINT32_MAX % i); do { gcry_create_nonce (&ret, sizeof (ret)); - } - while (ret >= ul); + } while (ret >= ul); return ret % i; case GNUNET_CRYPTO_QUALITY_WEAK: ret = i * get_weak_random (); @@ -231,8 +225,7 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, * @return the permutation array (allocated from heap) */ unsigned int * -GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, - unsigned int n) +GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n) { unsigned int *ret; unsigned int i; @@ -262,8 +255,7 @@ GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, * @return random 64-bit number */ uint64_t -GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, - uint64_t max) +GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max) { uint64_t ret; uint64_t ul; @@ -275,18 +267,17 @@ GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, ul = UINT64_MAX - (UINT64_MAX % max); do { - gcry_randomize ((unsigned char *) &ret, sizeof (uint64_t), + gcry_randomize ((unsigned char *) &ret, + sizeof (uint64_t), GCRY_STRONG_RANDOM); - } - while (ret >= ul); + } while (ret >= ul); return ret % max; case GNUNET_CRYPTO_QUALITY_NONCE: ul = UINT64_MAX - (UINT64_MAX % max); do { gcry_create_nonce (&ret, sizeof (ret)); - } - while (ret >= ul); + } while (ret >= ul); return ret % max; case GNUNET_CRYPTO_QUALITY_WEAK: @@ -319,6 +310,7 @@ w_malloc (size_t n) static int w_check (const void *p) { + (void) p; return 0; /* not secure memory */ } @@ -326,50 +318,45 @@ w_check (const void *p) /** * Initialize libgcrypt. */ -void __attribute__ ((constructor)) -GNUNET_CRYPTO_random_init () +void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init () { gcry_error_t rc; if (! gcry_check_version (NEED_LIBGCRYPT_VERSION)) { - FPRINTF (stderr, - _("libgcrypt has not the expected version (version %s is required).\n"), - NEED_LIBGCRYPT_VERSION); + FPRINTF ( + stderr, + _ ("libgcrypt has not the expected version (version %s is required).\n"), + NEED_LIBGCRYPT_VERSION); GNUNET_assert (0); } /* set custom allocators */ - gcry_set_allocation_handler (&w_malloc, - &w_malloc, - &w_check, - &realloc, - &free); + gcry_set_allocation_handler (&w_malloc, &w_malloc, &w_check, &realloc, &free); /* Disable use of secure memory */ if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0))) FPRINTF (stderr, "Failed to set libgcrypt option %s: %s\n", "DISABLE_SECMEM", - gcry_strerror (rc)); + gcry_strerror (rc)); /* Otherwise gnunet-ecc takes forever to complete, besides we are fine with "just" using GCRY_STRONG_RANDOM */ if ((rc = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0))) FPRINTF (stderr, - "Failed to set libgcrypt option %s: %s\n", - "ENABLE_QUICK_RANDOM", - gcry_strerror (rc)); + "Failed to set libgcrypt option %s: %s\n", + "ENABLE_QUICK_RANDOM", + gcry_strerror (rc)); gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); gcry_fast_random_poll (); - GNUNET_CRYPTO_seed_weak_random (time (NULL) ^ - GNUNET_CRYPTO_random_u32 - (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX)); + GNUNET_CRYPTO_seed_weak_random ( + time (NULL) ^ + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX)); } /** * Nicely shut down libgcrypt. */ -void __attribute__ ((destructor)) -GNUNET_CRYPTO_random_fini () +void __attribute__ ((destructor)) GNUNET_CRYPTO_random_fini () { gcry_set_progress_handler (NULL, NULL); #ifdef GCRYCTL_CLOSE_RANDOM_DEVICE @@ -378,5 +365,4 @@ GNUNET_CRYPTO_random_fini () } - /* end of crypto_random.c */ diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 5e15eb16a..f4149a398 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c @@ -57,15 +57,13 @@ static char *pwfn; static void shutdown_task (void *cls) { - if (sizeof (proof) != - GNUNET_DISK_fn_write (pwfn, - &proof, - sizeof (proof), - GNUNET_DISK_PERM_USER_READ | - GNUNET_DISK_PERM_USER_WRITE)) - GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, - "write", - pwfn); + (void) cls; + if (sizeof (proof) != GNUNET_DISK_fn_write (pwfn, + &proof, + sizeof (proof), + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", pwfn); } @@ -77,17 +75,18 @@ shutdown_task (void *cls) * @param result where to write the resulting hash */ static void -pow_hash (const void *buf, - size_t buf_len, - struct GNUNET_HashCode *result) +pow_hash (const void *buf, size_t buf_len, struct GNUNET_HashCode *result) { - GNUNET_break (0 == - gcry_kdf_derive (buf, buf_len, - GCRY_KDF_SCRYPT, - 1 /* subalgo */, - "gnunet-proof-of-work", strlen ("gnunet-proof-of-work"), - 2 /* iterations; keep cost of individual op small */, - sizeof (struct GNUNET_HashCode), result)); + GNUNET_break ( + 0 == gcry_kdf_derive (buf, + buf_len, + GCRY_KDF_SCRYPT, + 1 /* subalgo */, + "gnunet-proof-of-work", + strlen ("gnunet-proof-of-work"), + 2 /* iterations; keep cost of individual op small */, + sizeof (struct GNUNET_HashCode), + result)); } @@ -118,7 +117,7 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) static void find_proof (void *cls) { - #define ROUND_SIZE 10 +#define ROUND_SIZE 10 uint64_t counter; char buf[sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + sizeof (uint64_t)] GNUNET_ALIGN; @@ -127,12 +126,14 @@ find_proof (void *cls) struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Relative elapsed; + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Got Proof of Work %llu\n", - (unsigned long long) proof); + "Got Proof of Work %llu\n", + (unsigned long long) proof); proof_task = NULL; - GNUNET_memcpy (&buf[sizeof (uint64_t)], &pub, - sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); + GNUNET_memcpy (&buf[sizeof (uint64_t)], + &pub, + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); i = 0; counter = proof; timestamp = GNUNET_TIME_absolute_get (); @@ -143,7 +144,8 @@ find_proof (void *cls) if (nse_work_required <= count_leading_zeroes (&result)) { proof = counter; - FPRINTF (stdout, "Proof of work found: %llu!\n", + FPRINTF (stdout, + "Proof of work found: %llu!\n", (unsigned long long) proof); GNUNET_SCHEDULER_shutdown (); return; @@ -159,7 +161,8 @@ find_proof (void *cls) GNUNET_STRINGS_relative_time_to_string (elapsed, 0)); if (proof / (100 * ROUND_SIZE) < counter / (100 * ROUND_SIZE)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing proofs currently at %llu\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Testing proofs currently at %llu\n", (unsigned long long) counter); /* remember progress every 100 rounds */ proof = counter; @@ -171,8 +174,9 @@ find_proof (void *cls) } proof_task = GNUNET_SCHEDULER_add_delayed_with_priority (proof_find_delay, - GNUNET_SCHEDULER_PRIORITY_IDLE, - &find_proof, NULL); + GNUNET_SCHEDULER_PRIORITY_IDLE, + &find_proof, + NULL); } @@ -193,54 +197,46 @@ run (void *cls, struct GNUNET_CRYPTO_EddsaPrivateKey *pk; char *pids; + (void) cls; + (void) args; + (void) cfgfile; cfg = config; /* load proof of work */ if (NULL == pwfn) { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (cfg, - "NSE", - "PROOFFILE", - &pwfn)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, + "NSE", + "PROOFFILE", + &pwfn)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "NSE", - "PROOFFILE"); + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "NSE", "PROOFFILE"); GNUNET_SCHEDULER_shutdown (); return; } } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Proof of Work file: %s\n", - pwfn); - if ( (GNUNET_YES != GNUNET_DISK_file_test (pwfn)) || - (sizeof (proof) != - GNUNET_DISK_fn_read (pwfn, &proof, sizeof (proof)))) + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Proof of Work file: %s\n", pwfn); + if ((GNUNET_YES != GNUNET_DISK_file_test (pwfn)) || + (sizeof (proof) != GNUNET_DISK_fn_read (pwfn, &proof, sizeof (proof)))) proof = 0; /* load private key */ if (NULL == pkfn) { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (cfg, - "PEER", - "PRIVATE_KEY", - &pkfn)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, + "PEER", + "PRIVATE_KEY", + &pkfn)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "PEER", - "PRIVATE_KEY"); + "PRIVATE_KEY"); return; } } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Private Key file: %s\n", - pkfn); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Private Key file: %s\n", pkfn); if (NULL == (pk = GNUNET_CRYPTO_eddsa_key_create_from_file (pkfn))) { - FPRINTF (stderr, - _("Loading hostkey from `%s' failed.\n"), - pkfn); + FPRINTF (stderr, _ ("Loading hostkey from `%s' failed.\n"), pkfn); GNUNET_free (pkfn); return; } @@ -248,32 +244,27 @@ run (void *cls, GNUNET_CRYPTO_eddsa_key_get_public (pk, &pub); GNUNET_free (pk); pids = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Peer ID: %s\n", - pids); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer ID: %s\n", pids); GNUNET_free (pids); /* get target bit amount */ if (0 == nse_work_required) { - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, - "NSE", - "WORKBITS", - &nse_work_required)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, + "NSE", + "WORKBITS", + &nse_work_required)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "NSE", - "WORKBITS"); + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "NSE", "WORKBITS"); GNUNET_SCHEDULER_shutdown (); return; } if (nse_work_required >= sizeof (struct GNUNET_HashCode) * 8) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, - "NSE", - "WORKBITS", - _("Value is too large.\n")); + "NSE", + "WORKBITS", + _ ("Value is too large.\n")); GNUNET_SCHEDULER_shutdown (); return; } @@ -283,19 +274,16 @@ run (void *cls, return; } } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Bits: %llu\n", - nse_work_required); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Bits: %llu\n", nse_work_required); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Delay between tries: %s\n", GNUNET_STRINGS_relative_time_to_string (proof_find_delay, 1)); proof_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, - &find_proof, - NULL); - GNUNET_SCHEDULER_add_shutdown (&shutdown_task, - NULL); + &find_proof, + NULL); + GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); } @@ -307,46 +295,51 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, - char *const *argv) +main (int argc, char *const *argv) { - struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_ulong ('b', - "bits", - "BITS", - gettext_noop ("number of bits to require for the proof of work"), - &nse_work_required), - GNUNET_GETOPT_option_filename ('k', - "keyfile", - "FILE", - gettext_noop ("file with private key, otherwise default is used"), - &pkfn), - GNUNET_GETOPT_option_filename ('o', - "outfile", - "FILE", - gettext_noop ("file with proof of work, otherwise default is used"), - &pwfn), - GNUNET_GETOPT_option_relative_time ('t', - "timeout", - "TIME", - gettext_noop ("time to wait between calculations"), - &proof_find_delay), - GNUNET_GETOPT_OPTION_END - }; + struct GNUNET_GETOPT_CommandLineOption options[] = + {GNUNET_GETOPT_option_ulong ( + 'b', + "bits", + "BITS", + gettext_noop ("number of bits to require for the proof of work"), + &nse_work_required), + GNUNET_GETOPT_option_filename ( + 'k', + "keyfile", + "FILE", + gettext_noop ("file with private key, otherwise default is used"), + &pkfn), + GNUNET_GETOPT_option_filename ( + 'o', + "outfile", + "FILE", + gettext_noop ("file with proof of work, otherwise default is used"), + &pwfn), + GNUNET_GETOPT_option_relative_time ('t', + "timeout", + "TIME", + gettext_noop ( + "time to wait between calculations"), + &proof_find_delay), + GNUNET_GETOPT_OPTION_END}; int ret; - if (GNUNET_OK != - GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) + if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - ret = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, - "gnunet-scrypt [OPTIONS] prooffile", - gettext_noop ("Manipulate GNUnet proof of work files"), - options, - &run, - NULL)) ? 0 : 1; - GNUNET_free ((void*) argv); + ret = + (GNUNET_OK == + GNUNET_PROGRAM_run (argc, + argv, + "gnunet-scrypt [OPTIONS] prooffile", + gettext_noop ("Manipulate GNUnet proof of work files"), + options, + &run, + NULL)) + ? 0 + : 1; + GNUNET_free ((void *) argv); GNUNET_free_non_null (pwfn); return ret; } diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 58f9e331c..33ff7b1e6 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c @@ -53,9 +53,9 @@ maint_child_death (void *cls) { enum GNUNET_OS_ProcessStatusType type; - if ( (GNUNET_OK != - GNUNET_OS_process_status (p, &type, &exit_code)) || - (type != GNUNET_OS_PROCESS_EXITED) ) + (void) cls; + if ((GNUNET_OK != GNUNET_OS_process_status (p, &type, &exit_code)) || + (type != GNUNET_OS_PROCESS_EXITED)) GNUNET_break (0 == GNUNET_OS_process_kill (p, GNUNET_TERM_SIG)); GNUNET_OS_process_destroy (p); } @@ -70,56 +70,60 @@ maint_child_death (void *cls) * @param cfg configuration */ static void -run (void *cls, char *const *args, const char *cfgfile, +run (void *cls, + char *const *args, + const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { const char *uri; const char *slash; char *subsystem; char *program; - struct GNUNET_SCHEDULER_Task * rt; + struct GNUNET_SCHEDULER_Task *rt; + (void) cls; + (void) cfgfile; if (NULL == (uri = args[0])) { - fprintf (stderr, - _("No URI specified on command line\n")); + fprintf (stderr, _ ("No URI specified on command line\n")); return; } if (0 != strncasecmp ("gnunet://", uri, strlen ("gnunet://"))) { fprintf (stderr, - _("Invalid URI: does not start with `%s'\n"), - "gnunet://"); + _ ("Invalid URI: does not start with `%s'\n"), + "gnunet://"); return; } uri += strlen ("gnunet://"); if (NULL == (slash = strchr (uri, '/'))) { - fprintf (stderr, _("Invalid URI: fails to specify subsystem\n")); + fprintf (stderr, _ ("Invalid URI: fails to specify subsystem\n")); return; } subsystem = GNUNET_strndup (uri, slash - uri); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "uri", - subsystem, - &program)) + GNUNET_CONFIGURATION_get_value_string (cfg, "uri", subsystem, &program)) { - fprintf (stderr, _("No handler known for subsystem `%s'\n"), subsystem); + fprintf (stderr, _ ("No handler known for subsystem `%s'\n"), subsystem); GNUNET_free (subsystem); return; } GNUNET_free (subsystem); - rt = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_DISK_pipe_handle (sigpipe, - GNUNET_DISK_PIPE_END_READ), - &maint_child_death, NULL); - p = GNUNET_OS_start_process (GNUNET_NO, 0, - NULL, NULL, NULL, - program, - program, - args[0], - NULL); + rt = GNUNET_SCHEDULER_add_read_file ( + GNUNET_TIME_UNIT_FOREVER_REL, + GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ), + &maint_child_death, + NULL); + p = GNUNET_OS_start_process (GNUNET_NO, + 0, + NULL, + NULL, + NULL, + program, + program, + args[0], + NULL); GNUNET_free (program); if (NULL == p) GNUNET_SCHEDULER_cancel (rt); @@ -134,13 +138,15 @@ static void sighandler_child_death () { static char c; - int old_errno = errno; /* back-up errno */ - - GNUNET_break (1 == - GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle - (sigpipe, GNUNET_DISK_PIPE_END_WRITE), - &c, sizeof (c))); - errno = old_errno; /* restore errno */ + int old_errno = errno; /* back-up errno */ + + GNUNET_break ( + 1 == + GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe, + GNUNET_DISK_PIPE_END_WRITE), + &c, + sizeof (c))); + errno = old_errno; /* restore errno */ } @@ -155,8 +161,7 @@ int main (int argc, char *const *argv) { static const struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_END - }; + GNUNET_GETOPT_OPTION_END}; struct GNUNET_SIGNAL_Context *shc_chld; int ret; @@ -166,9 +171,14 @@ main (int argc, char *const *argv) GNUNET_assert (sigpipe != NULL); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); - ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI", - gettext_noop ("Perform default-actions for GNUnet URIs"), - options, &run, NULL); + ret = GNUNET_PROGRAM_run (argc, + argv, + "gnunet-uri URI", + gettext_noop ( + "Perform default-actions for GNUnet URIs"), + options, + &run, + NULL); GNUNET_SIGNAL_handler_uninstall (shc_chld); shc_chld = NULL; GNUNET_DISK_pipe_close (sigpipe); diff --git a/src/util/test_common_logging_dummy.c b/src/util/test_common_logging_dummy.c index b8f2bef91..5c3709206 100644 --- a/src/util/test_common_logging_dummy.c +++ b/src/util/test_common_logging_dummy.c @@ -35,12 +35,20 @@ * This must be long enough for us to not to mistake skipped log call * on a slow machine for a non-skipped one. */ -#define OUTPUT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 1000) +#define OUTPUT_DELAY \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 1000) static void -my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component, - const char *date, const char *msg) +my_log (void *ctx, + enum GNUNET_ErrorType kind, + const char *component, + const char *date, + const char *msg) { + (void) ctx; + (void) kind; + (void) component; + (void) date; if (strncmp ("test-common-logging-dummy", component, 25) != 0) return; FPRINTF (stdout, "%s", msg); @@ -48,7 +56,7 @@ my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component, } -#if !defined(GNUNET_CULL_LOGGING) +#if ! defined(GNUNET_CULL_LOGGING) static int expensive_func () { @@ -57,27 +65,36 @@ expensive_func () #endif -#define pr(kind,lvl) {\ - struct GNUNET_TIME_Absolute t1, t2;\ - t1 = GNUNET_TIME_absolute_get ();\ - GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ - t2 = GNUNET_TIME_absolute_get ();\ - printf ("1%s %llu\n", lvl,\ - (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value_us); \ -} +#define pr(kind, lvl) \ + { \ + struct GNUNET_TIME_Absolute t1, t2; \ + t1 = GNUNET_TIME_absolute_get (); \ + GNUNET_log (kind, "L%s %d\n", lvl, expensive_func ()); \ + t2 = GNUNET_TIME_absolute_get (); \ + printf ("1%s %llu\n", \ + lvl, \ + (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2) \ + .rel_value_us); \ + } + +#define pr2(kind, lvl) \ + { \ + struct GNUNET_TIME_Absolute t1, t2; \ + t1 = GNUNET_TIME_absolute_get (); \ + GNUNET_log (kind, "L%s %d\n", lvl, expensive_func ()); \ + t2 = GNUNET_TIME_absolute_get (); \ + printf ("2%s %llu\n", \ + lvl, \ + (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2) \ + .rel_value_us); \ + } -#define pr2(kind,lvl) {\ - struct GNUNET_TIME_Absolute t1, t2;\ - t1 = GNUNET_TIME_absolute_get ();\ - GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ - t2 = GNUNET_TIME_absolute_get ();\ - printf ("2%s %llu\n", lvl,\ - (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value_us); \ -} int main (int argc, char *argv[]) { + (void) argc; + (void) argv; /* We set up logging with NULL level - will be overrided by * GNUNET_LOG or GNUNET_FORCE_LOG at runtime. */ @@ -97,6 +114,6 @@ main (int argc, char *argv[]) pr2 (GNUNET_ERROR_TYPE_INFO, "INFO"); pr2 (GNUNET_ERROR_TYPE_DEBUG, "DEBUG"); return 0; -} /* end of main */ +} /* end of main */ /* end of test_common_logging_dummy.c */ diff --git a/src/util/tun.c b/src/util/tun.c index 97fbaa83b..e3643d0c6 100644 --- a/src/util/tun.c +++ b/src/util/tun.c @@ -44,24 +44,27 @@ */ void GNUNET_TUN_initialize_ipv4_header (struct GNUNET_TUN_IPv4Header *ip, - uint8_t protocol, - uint16_t payload_length, - const struct in_addr *src, - const struct in_addr *dst) + uint8_t protocol, + uint16_t payload_length, + const struct in_addr *src, + const struct in_addr *dst) { GNUNET_assert (20 == sizeof (struct GNUNET_TUN_IPv4Header)); - GNUNET_assert (payload_length <= UINT16_MAX - sizeof (struct GNUNET_TUN_IPv4Header)); + GNUNET_assert (payload_length <= + UINT16_MAX - sizeof (struct GNUNET_TUN_IPv4Header)); memset (ip, 0, sizeof (struct GNUNET_TUN_IPv4Header)); - ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4; + ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4; ip->version = 4; - ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length); - ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, - 65536); + ip->total_length = + htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length); + ip->identification = + (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 65536); ip->ttl = FRESH_TTL; ip->protocol = protocol; ip->source_address = *src; ip->destination_address = *dst; - ip->checksum = GNUNET_CRYPTO_crc16_n (ip, sizeof (struct GNUNET_TUN_IPv4Header)); + ip->checksum = + GNUNET_CRYPTO_crc16_n (ip, sizeof (struct GNUNET_TUN_IPv4Header)); } @@ -76,13 +79,14 @@ GNUNET_TUN_initialize_ipv4_header (struct GNUNET_TUN_IPv4Header *ip, */ void GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip, - uint8_t protocol, - uint16_t payload_length, - const struct in6_addr *src, - const struct in6_addr *dst) + uint8_t protocol, + uint16_t payload_length, + const struct in6_addr *src, + const struct in6_addr *dst) { GNUNET_assert (40 == sizeof (struct GNUNET_TUN_IPv6Header)); - GNUNET_assert (payload_length <= UINT16_MAX - sizeof (struct GNUNET_TUN_IPv6Header)); + GNUNET_assert (payload_length <= + UINT16_MAX - sizeof (struct GNUNET_TUN_IPv6Header)); memset (ip, 0, sizeof (struct GNUNET_TUN_IPv6Header)); ip->version = 6; ip->next_header = protocol; @@ -103,27 +107,29 @@ GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip, */ void GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, - struct GNUNET_TUN_TcpHeader *tcp, - const void *payload, - uint16_t payload_length) + struct GNUNET_TUN_TcpHeader *tcp, + const void *payload, + uint16_t payload_length) { uint32_t sum; uint16_t tmp; GNUNET_assert (20 == sizeof (struct GNUNET_TUN_TcpHeader)); - GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv4Header) + sizeof (struct GNUNET_TUN_TcpHeader) == - ntohs (ip->total_length)); + GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv4Header) + + sizeof (struct GNUNET_TUN_TcpHeader) == + ntohs (ip->total_length)); GNUNET_assert (IPPROTO_TCP == ip->protocol); tcp->crc = 0; sum = GNUNET_CRYPTO_crc16_step (0, - &ip->source_address, - sizeof (struct in_addr) * 2); + &ip->source_address, + sizeof (struct in_addr) * 2); tmp = htons (IPPROTO_TCP); sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint16_t)); tmp = htons (payload_length + sizeof (struct GNUNET_TUN_TcpHeader)); sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint16_t)); - sum = GNUNET_CRYPTO_crc16_step (sum, tcp, sizeof (struct GNUNET_TUN_TcpHeader)); + sum = + GNUNET_CRYPTO_crc16_step (sum, tcp, sizeof (struct GNUNET_TUN_TcpHeader)); sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); tcp->crc = GNUNET_CRYPTO_crc16_finish (sum); } @@ -139,25 +145,27 @@ GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, */ void GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, - struct GNUNET_TUN_TcpHeader *tcp, - const void *payload, - uint16_t payload_length) + struct GNUNET_TUN_TcpHeader *tcp, + const void *payload, + uint16_t payload_length) { uint32_t sum; uint32_t tmp; GNUNET_assert (20 == sizeof (struct GNUNET_TUN_TcpHeader)); GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_TcpHeader) == - ntohs (ip->payload_length)); + ntohs (ip->payload_length)); GNUNET_assert (IPPROTO_TCP == ip->next_header); tcp->crc = 0; - sum = GNUNET_CRYPTO_crc16_step (0, &ip->source_address, 2 * sizeof (struct in6_addr)); + sum = GNUNET_CRYPTO_crc16_step (0, + &ip->source_address, + 2 * sizeof (struct in6_addr)); tmp = htonl (sizeof (struct GNUNET_TUN_TcpHeader) + payload_length); sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); tmp = htonl (IPPROTO_TCP); sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); - sum = GNUNET_CRYPTO_crc16_step (sum, tcp, - sizeof (struct GNUNET_TUN_TcpHeader)); + sum = + GNUNET_CRYPTO_crc16_step (sum, tcp, sizeof (struct GNUNET_TUN_TcpHeader)); sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); tcp->crc = GNUNET_CRYPTO_crc16_finish (sum); } @@ -173,36 +181,31 @@ GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, */ void GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, - struct GNUNET_TUN_UdpHeader *udp, - const void *payload, - uint16_t payload_length) + struct GNUNET_TUN_UdpHeader *udp, + const void *payload, + uint16_t payload_length) { uint32_t sum; uint16_t tmp; GNUNET_assert (8 == sizeof (struct GNUNET_TUN_UdpHeader)); - GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv4Header) + sizeof (struct GNUNET_TUN_UdpHeader) == - ntohs (ip->total_length)); + GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv4Header) + + sizeof (struct GNUNET_TUN_UdpHeader) == + ntohs (ip->total_length)); GNUNET_assert (IPPROTO_UDP == ip->protocol); - udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */ + udp->crc = + 0; /* technically optional, but we calculate it anyway, just to be sure */ sum = GNUNET_CRYPTO_crc16_step (0, - &ip->source_address, - sizeof (struct in_addr) * 2); + &ip->source_address, + sizeof (struct in_addr) * 2); tmp = htons (IPPROTO_UDP); - sum = GNUNET_CRYPTO_crc16_step (sum, - &tmp, - sizeof (uint16_t)); + sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint16_t)); tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length); - sum = GNUNET_CRYPTO_crc16_step (sum, - &tmp, - sizeof (uint16_t)); - sum = GNUNET_CRYPTO_crc16_step (sum, - udp, - sizeof (struct GNUNET_TUN_UdpHeader)); - sum = GNUNET_CRYPTO_crc16_step (sum, - payload, - payload_length); + sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint16_t)); + sum = + GNUNET_CRYPTO_crc16_step (sum, udp, sizeof (struct GNUNET_TUN_UdpHeader)); + sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); udp->crc = GNUNET_CRYPTO_crc16_finish (sum); } @@ -217,28 +220,30 @@ GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, */ void GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, - struct GNUNET_TUN_UdpHeader *udp, - const void *payload, - uint16_t payload_length) + struct GNUNET_TUN_UdpHeader *udp, + const void *payload, + uint16_t payload_length) { uint32_t sum; uint32_t tmp; GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) == - ntohs (ip->payload_length)); + ntohs (ip->payload_length)); GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) == - ntohs (udp->len)); + ntohs (udp->len)); GNUNET_assert (IPPROTO_UDP == ip->next_header); udp->crc = 0; sum = GNUNET_CRYPTO_crc16_step (0, - &ip->source_address, - sizeof (struct in6_addr) * 2); - tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length); /* aka udp->len */ + &ip->source_address, + sizeof (struct in6_addr) * 2); + tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + + payload_length); /* aka udp->len */ sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); tmp = htons (ip->next_header); sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); - sum = GNUNET_CRYPTO_crc16_step (sum, udp, sizeof (struct GNUNET_TUN_UdpHeader)); + sum = + GNUNET_CRYPTO_crc16_step (sum, udp, sizeof (struct GNUNET_TUN_UdpHeader)); sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); udp->crc = GNUNET_CRYPTO_crc16_finish (sum); } @@ -253,16 +258,15 @@ GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, */ void GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, - const void *payload, - uint16_t payload_length) + const void *payload, + uint16_t payload_length) { uint32_t sum; GNUNET_assert (8 == sizeof (struct GNUNET_TUN_IcmpHeader)); icmp->crc = 0; - sum = GNUNET_CRYPTO_crc16_step (0, - icmp, - sizeof (struct GNUNET_TUN_IcmpHeader)); + sum = + GNUNET_CRYPTO_crc16_step (0, icmp, sizeof (struct GNUNET_TUN_IcmpHeader)); sum = GNUNET_CRYPTO_crc16_step (sum, payload, payload_length); icmp->crc = GNUNET_CRYPTO_crc16_finish (sum); } @@ -286,21 +290,22 @@ GNUNET_TUN_sockaddr_cmp (const struct sockaddr *sa, switch (sa->sa_family) { - case AF_INET: - { - const struct sockaddr_in *sa4 = (const struct sockaddr_in *) sa; - const struct sockaddr_in *sb4 = (const struct sockaddr_in *) sb; - return (sa4->sin_addr.s_addr == sb4->sin_addr.s_addr); - } - case AF_INET6: - { - const struct sockaddr_in6 *sa6 = (const struct sockaddr_in6 *) sa; - const struct sockaddr_in6 *sb6 = (const struct sockaddr_in6 *) sb; - - return (0 == memcmp(&sa6->sin6_addr, - &sb6->sin6_addr, - sizeof (struct in6_addr))); - } + case AF_INET: { + const struct sockaddr_in *sa4 = (const struct sockaddr_in *) sa; + const struct sockaddr_in *sb4 = (const struct sockaddr_in *) sb; + if ((include_port) && (sa4->sin_port != sb4->sin_port)) + return GNUNET_NO; + return (sa4->sin_addr.s_addr == sb4->sin_addr.s_addr); + } + case AF_INET6: { + const struct sockaddr_in6 *sa6 = (const struct sockaddr_in6 *) sa; + const struct sockaddr_in6 *sb6 = (const struct sockaddr_in6 *) sb; + + if ((include_port) && (sa6->sin6_port != sb6->sin6_port)) + return GNUNET_NO; + return ( + 0 == memcmp (&sa6->sin6_addr, &sb6->sin6_addr, sizeof (struct in6_addr))); + } default: GNUNET_break (0); return GNUNET_SYSERR; -- cgit v1.2.3 From 9baf882d7642f8aeac734ffd16c8e94bd409a41b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 19 Jun 2019 21:22:43 +0200 Subject: fix socket cmp, fix compiler warnings about unused args --- src/arm/arm_api.c | 287 +++++++++++++++++----------------------------- src/arm/arm_monitor_api.c | 55 ++++----- src/arm/mockup-service.c | 49 ++++---- 3 files changed, 154 insertions(+), 237 deletions(-) diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index c8103c877..bf0acbcb9 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -30,7 +30,7 @@ #include "gnunet_protocols.h" #include "arm.h" -#define LOG(kind,...) GNUNET_log_from (kind, "arm-api",__VA_ARGS__) +#define LOG(kind, ...) GNUNET_log_from (kind, "arm-api", __VA_ARGS__) /** @@ -156,7 +156,6 @@ struct GNUNET_ARM_Handle * Have we detected that ARM is up? */ int currently_up; - }; @@ -204,27 +203,19 @@ reconnect_arm_later (struct GNUNET_ARM_Handle *h) h->currently_up = GNUNET_NO; GNUNET_assert (NULL == h->reconnect_task); h->reconnect_task = - GNUNET_SCHEDULER_add_delayed (h->retry_backoff, - &reconnect_arm_task, - h); + GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h); while (NULL != (op = h->operation_pending_head)) { if (NULL != op->result_cont) - op->result_cont (op->cont_cls, - GNUNET_ARM_REQUEST_DISCONNECTED, - 0); + op->result_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0); if (NULL != op->list_cont) - op->list_cont (op->cont_cls, - GNUNET_ARM_REQUEST_DISCONNECTED, - 0, - NULL); + op->list_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0, NULL); GNUNET_ARM_operation_cancel (op); } GNUNET_assert (NULL == h->operation_pending_head); h->retry_backoff = GNUNET_TIME_STD_BACKOFF (h->retry_backoff); if (NULL != h->conn_status) - h->conn_status (h->conn_status_cls, - GNUNET_NO); + h->conn_status (h->conn_status_cls, GNUNET_NO); } @@ -236,12 +227,12 @@ reconnect_arm_later (struct GNUNET_ARM_Handle *h) * @return NULL if not found */ static struct GNUNET_ARM_Operation * -find_op_by_id (struct GNUNET_ARM_Handle *h, - uint64_t id) +find_op_by_id (struct GNUNET_ARM_Handle *h, uint64_t id) { struct GNUNET_ARM_Operation *result; - for (result = h->operation_pending_head; NULL != result; result = result->next) + for (result = h->operation_pending_head; NULL != result; + result = result->next) if (id == result->id) return result; return NULL; @@ -255,8 +246,7 @@ find_op_by_id (struct GNUNET_ARM_Handle *h, * @param res the message received from the arm service */ static void -handle_arm_result (void *cls, - const struct GNUNET_ARM_ResultMessage *res) +handle_arm_result (void *cls, const struct GNUNET_ARM_ResultMessage *res) { struct GNUNET_ARM_Handle *h = cls; struct GNUNET_ARM_Operation *op; @@ -266,8 +256,7 @@ handle_arm_result (void *cls, void *result_cont_cls; id = GNUNET_ntohll (res->arm_msg.request_id); - op = find_op_by_id (h, - id); + op = find_op_by_id (h, id); if (NULL == op) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -277,8 +266,7 @@ handle_arm_result (void *cls, } result = (enum GNUNET_ARM_Result) ntohl (res->result); - if ( (GNUNET_YES == op->is_arm_stop) && - (GNUNET_ARM_RESULT_STOPPING == result) ) + if ((GNUNET_YES == op->is_arm_stop) && (GNUNET_ARM_RESULT_STOPPING == result)) { /* special case: if we are stopping 'gnunet-service-arm', we do not just wait for the result message, but also wait for the service to close @@ -289,8 +277,8 @@ handle_arm_result (void *cls, { GNUNET_break (0); op->result_cont (h->thm->cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, - GNUNET_ARM_RESULT_IS_NOT_KNOWN); + GNUNET_ARM_REQUEST_SENT_OK, + GNUNET_ARM_RESULT_IS_NOT_KNOWN); GNUNET_free (h->thm); } GNUNET_CONTAINER_DLL_remove (h->operation_pending_head, @@ -303,9 +291,7 @@ handle_arm_result (void *cls, result_cont_cls = op->cont_cls; GNUNET_ARM_operation_cancel (op); if (NULL != result_cont) - result_cont (result_cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, - result); + result_cont (result_cont_cls, GNUNET_ARM_REQUEST_SENT_OK, result); } @@ -325,6 +311,7 @@ check_arm_list_result (void *cls, uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof (*lres); uint16_t size_check; + (void) cls; size_check = 0; for (unsigned int i = 0; i < rcount; i++) { @@ -361,8 +348,7 @@ handle_arm_list_result (void *cls, uint64_t id; id = GNUNET_ntohll (lres->arm_msg.request_id); - op = find_op_by_id (h, - id); + op = find_op_by_id (h, id); if (NULL == op) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -373,9 +359,7 @@ handle_arm_list_result (void *cls, size_check = 0; for (unsigned int i = 0; i < rcount; i++) { - const char *end = memchr (pos, - 0, - msize - size_check); + const char *end = memchr (pos, 0, msize - size_check); /* Assert, as this was already checked in #check_arm_list_result() */ GNUNET_assert (NULL != end); @@ -384,10 +368,7 @@ handle_arm_list_result (void *cls, pos = end + 1; } if (NULL != op->list_cont) - op->list_cont (op->cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, - rcount, - list); + op->list_cont (op->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, rcount, list); GNUNET_ARM_operation_cancel (op); } @@ -399,19 +380,17 @@ handle_arm_list_result (void *cls, * @param msg message received */ static void -handle_confirm (void *cls, - const struct GNUNET_MessageHeader *msg) +handle_confirm (void *cls, const struct GNUNET_MessageHeader *msg) { struct GNUNET_ARM_Handle *h = cls; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Got confirmation from ARM that we are up!\n"); + (void) msg; + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got confirmation from ARM that we are up!\n"); if (GNUNET_NO == h->currently_up) { h->currently_up = GNUNET_YES; if (NULL != h->conn_status) - h->conn_status (h->conn_status_cls, - GNUNET_YES); + h->conn_status (h->conn_status_cls, GNUNET_YES); } } @@ -425,19 +404,19 @@ handle_confirm (void *cls, * @param error error code */ static void -mq_error_handler (void *cls, - enum GNUNET_MQ_Error error) +mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_ARM_Handle *h = cls; struct GNUNET_ARM_Operation *op; + (void) error; h->currently_up = GNUNET_NO; if (NULL != (op = h->thm)) { h->thm = NULL; op->result_cont (op->cont_cls, - GNUNET_ARM_REQUEST_SENT_OK, - GNUNET_ARM_RESULT_STOPPED); + GNUNET_ARM_REQUEST_SENT_OK, + GNUNET_ARM_RESULT_STOPPED); GNUNET_free (op); } reconnect_arm_later (h); @@ -453,47 +432,37 @@ mq_error_handler (void *cls, static int reconnect_arm (struct GNUNET_ARM_Handle *h) { - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (arm_result, - GNUNET_MESSAGE_TYPE_ARM_RESULT, - struct GNUNET_ARM_ResultMessage, - h), - GNUNET_MQ_hd_var_size (arm_list_result, - GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT, - struct GNUNET_ARM_ListResultMessage, - h), - GNUNET_MQ_hd_fixed_size (confirm, - GNUNET_MESSAGE_TYPE_ARM_TEST, - struct GNUNET_MessageHeader, - h), - GNUNET_MQ_handler_end () - }; + struct GNUNET_MQ_MessageHandler handlers[] = + {GNUNET_MQ_hd_fixed_size (arm_result, + GNUNET_MESSAGE_TYPE_ARM_RESULT, + struct GNUNET_ARM_ResultMessage, + h), + GNUNET_MQ_hd_var_size (arm_list_result, + GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT, + struct GNUNET_ARM_ListResultMessage, + h), + GNUNET_MQ_hd_fixed_size (confirm, + GNUNET_MESSAGE_TYPE_ARM_TEST, + struct GNUNET_MessageHeader, + h), + GNUNET_MQ_handler_end ()}; struct GNUNET_MessageHeader *test; struct GNUNET_MQ_Envelope *env; if (NULL != h->mq) return GNUNET_OK; GNUNET_assert (GNUNET_NO == h->currently_up); - h->mq = GNUNET_CLIENT_connect (h->cfg, - "arm", - handlers, - &mq_error_handler, - h); + h->mq = GNUNET_CLIENT_connect (h->cfg, "arm", handlers, &mq_error_handler, h); if (NULL == h->mq) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "GNUNET_CLIENT_connect returned NULL\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CLIENT_connect returned NULL\n"); if (NULL != h->conn_status) - h->conn_status (h->conn_status_cls, - GNUNET_SYSERR); + h->conn_status (h->conn_status_cls, GNUNET_SYSERR); return GNUNET_SYSERR; } - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending TEST message to ARM\n"); - env = GNUNET_MQ_msg (test, - GNUNET_MESSAGE_TYPE_ARM_TEST); - GNUNET_MQ_send (h->mq, - env); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending TEST message to ARM\n"); + env = GNUNET_MQ_msg (test, GNUNET_MESSAGE_TYPE_ARM_TEST); + GNUNET_MQ_send (h->mq, env); return GNUNET_OK; } @@ -512,7 +481,7 @@ reconnect_arm (struct GNUNET_ARM_Handle *h) struct GNUNET_ARM_Handle * GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ARM_ConnectionStatusCallback conn_status, - void *conn_status_cls) + void *conn_status_cls) { struct GNUNET_ARM_Handle *h; @@ -539,22 +508,16 @@ GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h) { struct GNUNET_ARM_Operation *op; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Disconnecting from ARM service\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n"); while (NULL != (op = h->operation_pending_head)) { GNUNET_CONTAINER_DLL_remove (h->operation_pending_head, h->operation_pending_tail, op); if (NULL != op->result_cont) - op->result_cont (op->cont_cls, - GNUNET_ARM_REQUEST_DISCONNECTED, - 0); + op->result_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0); if (NULL != op->list_cont) - op->list_cont (op->cont_cls, - GNUNET_ARM_REQUEST_DISCONNECTED, - 0, - NULL); + op->list_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0, NULL); if (NULL != op->async) { GNUNET_SCHEDULER_cancel (op->async); @@ -596,60 +559,43 @@ start_arm_service (struct GNUNET_ARM_Handle *h, char *loprefix; char *lopostfix; - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (h->cfg, - "arm", - "PREFIX", - &loprefix)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, + "arm", + "PREFIX", + &loprefix)) loprefix = GNUNET_strdup (""); else - loprefix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, - loprefix); - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (h->cfg, - "arm", - "OPTIONS", - &lopostfix)) + loprefix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, loprefix); + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, + "arm", + "OPTIONS", + &lopostfix)) lopostfix = GNUNET_strdup (""); else - lopostfix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, - lopostfix); + lopostfix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, lopostfix); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (h->cfg, - "arm", - "BINARY", - &cbinary)) + GNUNET_CONFIGURATION_get_value_string (h->cfg, "arm", "BINARY", &cbinary)) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, - "arm", - "BINARY"); + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY"); GNUNET_free (loprefix); GNUNET_free (lopostfix); return GNUNET_ARM_RESULT_IS_NOT_KNOWN; } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (h->cfg, - "arm", - "CONFIG", - &config)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (h->cfg, + "arm", + "CONFIG", + &config)) config = NULL; binary = GNUNET_OS_get_libexec_binary_path (cbinary); - GNUNET_asprintf ("edbinary, - "\"%s\"", - binary); + GNUNET_asprintf ("edbinary, "\"%s\"", binary); GNUNET_free (cbinary); - if ( (GNUNET_YES == - GNUNET_CONFIGURATION_have_value (h->cfg, - "TESTING", - "WEAKRANDOM")) && - (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (h->cfg, - "TESTING", - "WEAKRANDOM")) && - (GNUNET_NO == - GNUNET_CONFIGURATION_have_value (h->cfg, - "TESTING", - "HOSTFILE"))) + if ((GNUNET_YES == + GNUNET_CONFIGURATION_have_value (h->cfg, "TESTING", "WEAKRANDOM")) && + (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (h->cfg, + "TESTING", + "WEAKRANDOM")) && + (GNUNET_NO == + GNUNET_CONFIGURATION_have_value (h->cfg, "TESTING", "HOSTFILE"))) { /* Means we are ONLY running locally */ /* we're clearly running a test, don't daemonize */ @@ -668,7 +614,8 @@ start_arm_service (struct GNUNET_ARM_Handle *h, NULL, loprefix, quotedbinary, - "-c", config, + "-c", + config, /* no daemonization! */ lopostfix, NULL); @@ -683,14 +630,15 @@ start_arm_service (struct GNUNET_ARM_Handle *h, quotedbinary, "-d", /* do daemonize */ lopostfix, - NULL); + NULL); else proc = GNUNET_OS_start_process_s (GNUNET_NO, std_inheritance, NULL, loprefix, quotedbinary, - "-c", config, + "-c", + config, "-d", /* do daemonize */ lopostfix, NULL); @@ -744,7 +692,7 @@ static struct GNUNET_ARM_Operation * change_service (struct GNUNET_ARM_Handle *h, const char *service_name, GNUNET_ARM_ResultCallback cb, - void *cb_cls, + void *cb_cls, uint16_t type) { struct GNUNET_ARM_Operation *op; @@ -753,8 +701,7 @@ change_service (struct GNUNET_ARM_Handle *h, struct GNUNET_ARM_Message *msg; slen = strlen (service_name) + 1; - if (slen + sizeof (struct GNUNET_ARM_Message) >= - GNUNET_MAX_MESSAGE_SIZE) + if (slen + sizeof (struct GNUNET_ARM_Message) >= GNUNET_MAX_MESSAGE_SIZE) { GNUNET_break (0); return NULL; @@ -769,16 +716,11 @@ change_service (struct GNUNET_ARM_Handle *h, GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head, h->operation_pending_tail, op); - env = GNUNET_MQ_msg_extra (msg, - slen, - type); + env = GNUNET_MQ_msg_extra (msg, slen, type); msg->reserved = htonl (0); msg->request_id = GNUNET_htonll (op->id); - GNUNET_memcpy (&msg[1], - service_name, - slen); - GNUNET_MQ_send (h->mq, - env); + GNUNET_memcpy (&msg[1], service_name, slen); + GNUNET_MQ_send (h->mq, env); return op; } @@ -802,10 +744,8 @@ notify_running (void *cls) op->result_cont (op->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, GNUNET_ARM_RESULT_IS_STARTED_ALREADY); - if ( (GNUNET_YES == h->currently_up) && - (NULL != h->conn_status) ) - h->conn_status (h->conn_status_cls, - GNUNET_YES); + if ((GNUNET_YES == h->currently_up) && (NULL != h->conn_status)) + h->conn_status (h->conn_status_cls, GNUNET_YES); GNUNET_free (op); } @@ -846,20 +786,18 @@ notify_starting (void *cls) * @return handle for the operation, NULL on error */ struct GNUNET_ARM_Operation * -GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, - const char *service_name, - enum GNUNET_OS_InheritStdioFlags std_inheritance, - GNUNET_ARM_ResultCallback cont, - void *cont_cls) +GNUNET_ARM_request_service_start ( + struct GNUNET_ARM_Handle *h, + const char *service_name, + enum GNUNET_OS_InheritStdioFlags std_inheritance, + GNUNET_ARM_ResultCallback cont, + void *cont_cls) { struct GNUNET_ARM_Operation *op; enum GNUNET_ARM_Result ret; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Starting service `%s'\n", - service_name); - if (0 != strcasecmp ("arm", - service_name)) + LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting service `%s'\n", service_name); + if (0 != strcasecmp ("arm", service_name)) return change_service (h, service_name, cont, @@ -874,8 +812,7 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, */ if (GNUNET_YES == h->currently_up) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "ARM is already running\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "ARM is already running\n"); op = GNUNET_new (struct GNUNET_ARM_Operation); op->h = h; op->result_cont = cont; @@ -883,8 +820,7 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head, h->operation_pending_tail, op); - op->async = GNUNET_SCHEDULER_add_now (¬ify_running, - op); + op->async = GNUNET_SCHEDULER_add_now (¬ify_running, op); return op; } /* This is an inherently uncertain choice, as it is of course @@ -893,10 +829,8 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, are unlikely to hammer 'gnunet-arm -s' on a busy system, the above check should catch 99.99% of the cases where ARM is already running. */ - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Starting ARM service\n"); - ret = start_arm_service (h, - std_inheritance); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting ARM service\n"); + ret = start_arm_service (h, std_inheritance); if (GNUNET_ARM_RESULT_STARTING == ret) reconnect_arm (h); op = GNUNET_new (struct GNUNET_ARM_Operation); @@ -907,8 +841,7 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, h->operation_pending_tail, op); op->starting_ret = ret; - op->async = GNUNET_SCHEDULER_add_now (¬ify_starting, - op); + op->async = GNUNET_SCHEDULER_add_now (¬ify_starting, op); return op; } @@ -929,15 +862,13 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, */ struct GNUNET_ARM_Operation * GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, - const char *service_name, - GNUNET_ARM_ResultCallback cont, - void *cont_cls) + const char *service_name, + GNUNET_ARM_ResultCallback cont, + void *cont_cls) { struct GNUNET_ARM_Operation *op; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Stopping service `%s'\n", - service_name); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Stopping service `%s'\n", service_name); op = change_service (h, service_name, cont, @@ -947,8 +878,7 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, return NULL; /* If the service is ARM, set a flag as we will use MQ errors to detect that the process is really gone. */ - if (0 == strcasecmp (service_name, - "arm")) + if (0 == strcasecmp (service_name, "arm")) op->is_arm_stop = GNUNET_YES; return op; } @@ -971,8 +901,7 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, struct GNUNET_MQ_Envelope *env; struct GNUNET_ARM_Message *msg; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Requesting LIST from ARM service\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Requesting LIST from ARM service\n"); if (0 == h->request_id_counter) h->request_id_counter++; op = GNUNET_new (struct GNUNET_ARM_Operation); @@ -983,12 +912,10 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head, h->operation_pending_tail, op); - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_ARM_LIST); + env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_ARM_LIST); msg->reserved = htonl (0); msg->request_id = GNUNET_htonll (op->id); - GNUNET_MQ_send (h->mq, - env); + GNUNET_MQ_send (h->mq, env); return op; } diff --git a/src/arm/arm_monitor_api.c b/src/arm/arm_monitor_api.c index 15f91c036..55b12240f 100644 --- a/src/arm/arm_monitor_api.c +++ b/src/arm/arm_monitor_api.c @@ -32,7 +32,7 @@ #define INIT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) -#define LOG(kind,...) GNUNET_log_from (kind, "arm-monitor-api",__VA_ARGS__) +#define LOG(kind, ...) GNUNET_log_from (kind, "arm-monitor-api", __VA_ARGS__) /** * Handle for interacting with ARM. @@ -69,7 +69,6 @@ struct GNUNET_ARM_MonitorHandle * Closure for @e service_status. */ void *service_status_cls; - }; @@ -115,9 +114,9 @@ reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h) h->mq = NULL; } GNUNET_assert (NULL == h->reconnect_task); - h->reconnect_task - = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, - &reconnect_arm_monitor_task, h); + h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->retry_backoff, + &reconnect_arm_monitor_task, + h); h->retry_backoff = GNUNET_TIME_STD_BACKOFF (h->retry_backoff); } @@ -130,14 +129,14 @@ reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h) * @return #GNUNET_OK if the message is well-formed */ static int -check_monitor_notify (void *cls, - const struct GNUNET_ARM_StatusMessage *msg) +check_monitor_notify (void *cls, const struct GNUNET_ARM_StatusMessage *msg) { - size_t sl = ntohs (msg->header.size) - sizeof (struct GNUNET_ARM_StatusMessage); + size_t sl = + ntohs (msg->header.size) - sizeof (struct GNUNET_ARM_StatusMessage); const char *name = (const char *) &msg[1]; - if ( (0 == sl) || - ('\0' != name[sl-1]) ) + (void) cls; + if ((0 == sl) || ('\0' != name[sl - 1])) { GNUNET_break (0); return GNUNET_SYSERR; @@ -153,8 +152,7 @@ check_monitor_notify (void *cls, * @param res the message received from the arm service */ static void -handle_monitor_notify (void *cls, - const struct GNUNET_ARM_StatusMessage *res) +handle_monitor_notify (void *cls, const struct GNUNET_ARM_StatusMessage *res) { struct GNUNET_ARM_MonitorHandle *h = cls; enum GNUNET_ARM_ServiceStatus status; @@ -165,9 +163,7 @@ handle_monitor_notify (void *cls, (const char *) &res[1], (int) status); if (NULL != h->service_status) - h->service_status (h->service_status_cls, - (const char *) &res[1], - status); + h->service_status (h->service_status_cls, (const char *) &res[1], status); } @@ -180,11 +176,11 @@ handle_monitor_notify (void *cls, * @param error error code */ static void -mq_error_handler (void *cls, - enum GNUNET_MQ_Error error) +mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_ARM_MonitorHandle *h = cls; + (void) error; reconnect_arm_monitor_later (h); } @@ -198,22 +194,17 @@ mq_error_handler (void *cls, static int reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h) { - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_var_size (monitor_notify, - GNUNET_MESSAGE_TYPE_ARM_STATUS, - struct GNUNET_ARM_StatusMessage, - h), - GNUNET_MQ_handler_end () - }; + struct GNUNET_MQ_MessageHandler handlers[] = + {GNUNET_MQ_hd_var_size (monitor_notify, + GNUNET_MESSAGE_TYPE_ARM_STATUS, + struct GNUNET_ARM_StatusMessage, + h), + GNUNET_MQ_handler_end ()}; struct GNUNET_MessageHeader *msg; struct GNUNET_MQ_Envelope *env; GNUNET_assert (NULL == h->mq); - h->mq = GNUNET_CLIENT_connect (h->cfg, - "arm", - handlers, - &mq_error_handler, - h); + h->mq = GNUNET_CLIENT_connect (h->cfg, "arm", handlers, &mq_error_handler, h); if (NULL == h->mq) { if (NULL != h->service_status) @@ -222,10 +213,8 @@ reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h) GNUNET_ARM_SERVICE_STOPPED); return GNUNET_SYSERR; } - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_ARM_MONITOR); - GNUNET_MQ_send (h->mq, - env); + env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_ARM_MONITOR); + GNUNET_MQ_send (h->mq, env); return GNUNET_OK; } diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c index c9f00b5dd..667556314 100644 --- a/src/arm/mockup-service.c +++ b/src/arm/mockup-service.c @@ -33,13 +33,13 @@ static int special_ret = 0; * @param message the actual message */ static void -handle_stop (void *cls, - const struct GNUNET_MessageHeader *message) +handle_stop (void *cls, const struct GNUNET_MessageHeader *message) { struct GNUNET_SERVICE_Client *client = cls; + (void) message; GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Initiating shutdown as requested by client.\n")); + _ ("Initiating shutdown as requested by client.\n")); GNUNET_SERVICE_client_persist (client); GNUNET_SCHEDULER_shutdown (); /* ARM won't exponentially increase restart delay if we @@ -59,9 +59,11 @@ handle_stop (void *cls, */ static void * client_connect_cb (void *cls, - struct GNUNET_SERVICE_Client *c, - struct GNUNET_MQ_Handle *mq) + struct GNUNET_SERVICE_Client *c, + struct GNUNET_MQ_Handle *mq) { + (void) cls; + (void) mq; return c; } @@ -75,9 +77,10 @@ client_connect_cb (void *cls, */ static void client_disconnect_cb (void *cls, - struct GNUNET_SERVICE_Client *c, - void *internal_cls) + struct GNUNET_SERVICE_Client *c, + void *internal_cls) { + (void) cls; GNUNET_assert (c == internal_cls); } @@ -87,6 +90,9 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service) { + (void) cls; + (void) cfg; + (void) service; /* nothing to do */ } @@ -94,25 +100,20 @@ run (void *cls, /** * Define "main" method using service macro. */ -GNUNET_SERVICE_MAIN -("do-nothing", - GNUNET_SERVICE_OPTION_NONE, - &run, - &client_connect_cb, - &client_disconnect_cb, - NULL, - GNUNET_MQ_hd_fixed_size (stop, - GNUNET_MESSAGE_TYPE_ARM_STOP, - struct GNUNET_MessageHeader, - NULL), - GNUNET_MQ_handler_end ()); +GNUNET_SERVICE_MAIN ("do-nothing", + GNUNET_SERVICE_OPTION_NONE, + &run, + &client_connect_cb, + &client_disconnect_cb, + NULL, + GNUNET_MQ_hd_fixed_size (stop, + GNUNET_MESSAGE_TYPE_ARM_STOP, + struct GNUNET_MessageHeader, + NULL), + GNUNET_MQ_handler_end ()); /** * MINIMIZE heap size (way below 128k) since this process doesn't need much. */ -void __attribute__ ((destructor)) -GNUNET_mockup_done () -{ - _exit (special_ret); -} +void __attribute__ ((destructor)) GNUNET_mockup_done () { _exit (special_ret); } -- cgit v1.2.3 From 2111b3716776f2a1e6e6b38888c8dea42907c09d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 19 Jun 2019 21:25:50 +0200 Subject: fix compiler warnings about unused args --- src/core/core_api.c | 5 ++- src/core/core_api_monitor_peers.c | 34 +++++++---------- src/core/gnunet-core.c | 80 ++++++++++++++++++++------------------- src/nse/gnunet-service-nse.c | 21 +++++++++- 4 files changed, 78 insertions(+), 62 deletions(-) diff --git a/src/core/core_api.c b/src/core/core_api.c index 6381d9097..223677a5b 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -341,6 +341,7 @@ core_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) { struct PeerRecord *pr = impl_state; + (void) mq; GNUNET_assert (NULL != pr->env); GNUNET_MQ_discard (pr->env); pr->env = NULL; @@ -359,7 +360,8 @@ static void core_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) { /* struct PeerRecord *pr = cls; */ - + (void) cls; + (void) error; GNUNET_break_op (0); } @@ -530,6 +532,7 @@ check_notify_inbound (void *cls, const struct NotifyTrafficMessage *ntm) uint16_t msize; const struct GNUNET_MessageHeader *em; + (void) cls; msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); if (msize < sizeof (struct GNUNET_MessageHeader)) { diff --git a/src/core/core_api_monitor_peers.c b/src/core/core_api_monitor_peers.c index 0ebb94d7b..165f741d2 100644 --- a/src/core/core_api_monitor_peers.c +++ b/src/core/core_api_monitor_peers.c @@ -54,7 +54,6 @@ struct GNUNET_CORE_MonitorHandle * Closure for @e peer_cb. */ void *peer_cb_cls; - }; @@ -77,11 +76,11 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh); * @param error error code */ static void -handle_mq_error (void *cls, - enum GNUNET_MQ_Error error) +handle_mq_error (void *cls, enum GNUNET_MQ_Error error) { struct GNUNET_CORE_MonitorHandle *mh = cls; + (void) error; reconnect (mh); } @@ -93,8 +92,7 @@ handle_mq_error (void *cls, * @param mon_message monitor message */ static void -handle_receive_info (void *cls, - const struct MonitorNotifyMessage *mon_message) +handle_receive_info (void *cls, const struct MonitorNotifyMessage *mon_message) { struct GNUNET_CORE_MonitorHandle *mh = cls; @@ -114,24 +112,20 @@ handle_receive_info (void *cls, static void reconnect (struct GNUNET_CORE_MonitorHandle *mh) { - struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (receive_info, - GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, - struct MonitorNotifyMessage, - mh), - GNUNET_MQ_handler_end () - }; + struct GNUNET_MQ_MessageHandler handlers[] = + {GNUNET_MQ_hd_fixed_size (receive_info, + GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, + struct MonitorNotifyMessage, + mh), + GNUNET_MQ_handler_end ()}; struct GNUNET_MQ_Envelope *env; struct GNUNET_MessageHeader *msg; if (NULL != mh->mq) GNUNET_MQ_destroy (mh->mq); /* FIXME: use backoff? */ - mh->mq = GNUNET_CLIENT_connect (mh->cfg, - "core", - handlers, - &handle_mq_error, - mh); + mh->mq = + GNUNET_CLIENT_connect (mh->cfg, "core", handlers, &handle_mq_error, mh); if (NULL == mh->mq) return; /* notify callback about reconnect */ @@ -140,10 +134,8 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh) NULL, GNUNET_CORE_KX_CORE_DISCONNECT, GNUNET_TIME_UNIT_FOREVER_ABS); - env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS); - GNUNET_MQ_send (mh->mq, - env); + env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS); + GNUNET_MQ_send (mh->mq, env); } diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index 7180754a9..674da705a 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c @@ -48,6 +48,7 @@ static struct GNUNET_CORE_MonitorHandle *mh; static void shutdown_task (void *cls) { + (void) cls; if (NULL != mh) { GNUNET_CORE_monitor_stop (mh); @@ -71,13 +72,13 @@ monitor_cb (void *cls, enum GNUNET_CORE_KxState state, struct GNUNET_TIME_Absolute timeout) { - struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); + struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); const char *now_str; const char *state_str; - if ( ( (NULL == peer) || - (GNUNET_CORE_KX_ITERATION_FINISHED == state) ) && - (GNUNET_NO == monitor_connections) ) + (void) cls; + if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) && + (GNUNET_NO == monitor_connections)) { GNUNET_SCHEDULER_shutdown (); return; @@ -87,42 +88,43 @@ monitor_cb (void *cls, { case GNUNET_CORE_KX_STATE_DOWN: /* should never happen, as we immediately send the key */ - state_str = _("fresh connection"); + state_str = _ ("fresh connection"); break; case GNUNET_CORE_KX_STATE_KEY_SENT: - state_str = _("key sent"); + state_str = _ ("key sent"); break; case GNUNET_CORE_KX_STATE_KEY_RECEIVED: - state_str = _("key received"); + state_str = _ ("key received"); break; case GNUNET_CORE_KX_STATE_UP: - state_str = _("connection established"); + state_str = _ ("connection established"); break; case GNUNET_CORE_KX_STATE_REKEY_SENT: - state_str = _("rekeying"); + state_str = _ ("rekeying"); break; case GNUNET_CORE_KX_PEER_DISCONNECT: - state_str = _("disconnected"); + state_str = _ ("disconnected"); break; case GNUNET_CORE_KX_ITERATION_FINISHED: return; case GNUNET_CORE_KX_CORE_DISCONNECT: FPRINTF (stderr, "%s\n", - _("Connection to CORE service lost (reconnecting)")); + _ ("Connection to CORE service lost (reconnecting)")); return; default: - state_str = _("unknown state"); + state_str = _ ("unknown state"); break; } now_str = GNUNET_STRINGS_absolute_time_to_string (now); FPRINTF (stdout, - _("%24s: %-30s %4s (timeout in %6s)\n"), + _ ("%24s: %-30s %4s (timeout in %6s)\n"), now_str, state_str, GNUNET_i2s (peer), - GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (timeout), - GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string ( + GNUNET_TIME_absolute_get_remaining (timeout), + GNUNET_YES)); } @@ -135,24 +137,22 @@ monitor_cb (void *cls, * @param cfg configuration */ static void -run (void *cls, char *const *args, const char *cfgfile, +run (void *cls, + char *const *args, + const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { + (void) cls; + (void) cfgfile; if (NULL != args[0]) { - FPRINTF (stderr, - _("Invalid command line argument `%s'\n"), - args[0]); + FPRINTF (stderr, _ ("Invalid command line argument `%s'\n"), args[0]); return; } - mh = GNUNET_CORE_monitor_start (cfg, - &monitor_cb, - NULL); + mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL); if (NULL == mh) { - FPRINTF (stderr, - "%s", - _("Failed to connect to CORE service!\n")); + FPRINTF (stderr, "%s", _ ("Failed to connect to CORE service!\n")); return; } GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); @@ -167,24 +167,28 @@ run (void *cls, char *const *args, const char *cfgfile, * @return 0 ok, 1 on error */ int -main (int argc, - char *const *argv) +main (int argc, char *const *argv) { int res; - struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_flag ('m', - "monitor", - gettext_noop ("provide information about all current connections (continuously)"), - &monitor_connections), - GNUNET_GETOPT_OPTION_END - }; + struct GNUNET_GETOPT_CommandLineOption options[] = + {GNUNET_GETOPT_option_flag ( + 'm', + "monitor", + gettext_noop ( + "provide information about all current connections (continuously)"), + &monitor_connections), + GNUNET_GETOPT_OPTION_END}; if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - res = GNUNET_PROGRAM_run (argc, argv, "gnunet-core", - gettext_noop - ("Print information about connected peers."), - options, &run, NULL); + res = GNUNET_PROGRAM_run (argc, + argv, + "gnunet-core", + gettext_noop ( + "Print information about connected peers."), + options, + &run, + NULL); GNUNET_free ((void *) argv); if (GNUNET_OK == res) diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 09316dbcf..fd83d2b67 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -430,6 +430,7 @@ handle_start (void *cls, const struct GNUNET_MessageHeader *message) struct GNUNET_NSE_ClientMessage em; struct GNUNET_MQ_Envelope *env; + (void) message; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); mq = GNUNET_SERVICE_client_get_mq (client); GNUNET_notification_context_add (nc, mq); @@ -717,6 +718,8 @@ schedule_current_round (void *cls, struct NSEPeerEntry *peer_entry = value; struct GNUNET_TIME_Relative delay; + (void) cls; + (void) key; if (NULL != peer_entry->transmit_task) { GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); @@ -749,8 +752,8 @@ static void update_flood_message (void *cls) { struct GNUNET_TIME_Relative offset; - unsigned int i; + (void) cls; flood_task = NULL; offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); if (0 != offset.rel_value_us) @@ -780,7 +783,7 @@ update_flood_message (void *cls) setup_flood_message (estimate_index, current_timestamp); next_message.matching_bits = htonl (0); /* reset for 'next' round */ hop_count_max = 0; - for (i = 0; i < HISTORY_SIZE; i++) + for (unsigned int i = 0; i < HISTORY_SIZE; i++) hop_count_max = GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max); GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL); @@ -869,6 +872,7 @@ find_proof (void *cls) struct GNUNET_HashCode result; unsigned int i; + (void) cls; proof_task = NULL; GNUNET_memcpy (&buf[sizeof (uint64_t)], &my_identity, @@ -967,6 +971,7 @@ update_flood_times (void *cls, struct NSEPeerEntry *peer_entry = value; struct GNUNET_TIME_Relative delay; + (void) key; if (peer_entry == exclude) return GNUNET_OK; /* trigger of the update */ if (GNUNET_NO == peer_entry->previous_round) @@ -1178,6 +1183,7 @@ handle_core_connect (void *cls, { struct NSEPeerEntry *peer_entry; + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' connected to us\n", GNUNET_i2s (peer)); @@ -1217,6 +1223,7 @@ handle_core_disconnect (void *cls, { struct NSEPeerEntry *pos = internal_cls; + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' disconnected from us\n", GNUNET_i2s (peer)); @@ -1243,6 +1250,8 @@ handle_core_disconnect (void *cls, static void flush_comp_cb (void *cls, size_t size) { + (void) cls; + (void) size; GNUNET_TESTBED_LOGGER_disconnect (lh); lh = NULL; } @@ -1257,6 +1266,7 @@ flush_comp_cb (void *cls, size_t size) static void shutdown_task (void *cls) { + (void) cls; if (NULL != flood_task) { GNUNET_SCHEDULER_cancel (flood_task); @@ -1324,6 +1334,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity) struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute prev_time; + (void) cls; if (NULL == identity) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n"); @@ -1365,6 +1376,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity) static void status_cb (void *cls, int status) { + (void) cls; logger_test = NULL; if (GNUNET_YES != status) { @@ -1402,6 +1414,8 @@ run (void *cls, char *proof; struct GNUNET_CRYPTO_EddsaPrivateKey *pk; + (void) cls; + (void) service; cfg = c; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "NSE", @@ -1524,6 +1538,8 @@ client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *c, struct GNUNET_MQ_Handle *mq) { + (void) cls; + (void) mq; return c; } @@ -1540,6 +1556,7 @@ client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *c, void *internal_cls) { + (void) cls; GNUNET_assert (c == internal_cls); } -- cgit v1.2.3 From 32eec25228bec91318c577d18fe2ce3ff4d45598 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 21 Jun 2019 21:15:58 +0200 Subject: drop sections on planetlab, this is unlikely to even still work anymore, fixes #5628 --- doc/handbook/chapters/developer.texi | 163 ----------------------------------- 1 file changed, 163 deletions(-) diff --git a/doc/handbook/chapters/developer.texi b/doc/handbook/chapters/developer.texi index 228603cda..3225a6359 100644 --- a/doc/handbook/chapters/developer.texi +++ b/doc/handbook/chapters/developer.texi @@ -1876,7 +1876,6 @@ Testbed API can accessed by including the * Hosts file format:: * Topology file format:: * Testbed Barriers:: -* Automatic large-scale deployment in the PlanetLab testbed:: * TESTBED Caveats:: @end menu @@ -2140,168 +2139,6 @@ message from its upward propagation --- the upward propagation is needed for ensuring that the barrier is reached by all the controllers and the downward propagation is for triggering that the barrier is crossed. -@cindex PlanetLab testbed -@node Automatic large-scale deployment in the PlanetLab testbed -@subsection Automatic large-scale deployment in the PlanetLab testbed - -PlanetLab is a testbed for computer networking and distributed systems -research. It was established in 2002 and as of June 2010 was composed of -1090 nodes at 507 sites worldwide. - -To automate the GNUnet we created a set of automation tools to simplify -the large-scale deployment. We provide you a set of scripts you can use -to deploy GNUnet on a set of nodes and manage your installation. - -Please also check @uref{https://old.gnunet.org/installation-fedora8-svn} and -@uref{https://old.gnunet.org/installation-fedora12-svn} to find detailed -instructions how to install GNUnet on a PlanetLab node. - - -@c *********************************************************************** -@menu -* PlanetLab Automation for Fedora8 nodes:: -* Install buildslave on PlanetLab nodes running fedora core 8:: -* Setup a new PlanetLab testbed using GPLMT:: -* Why do i get an ssh error when using the regex profiler?:: -@end menu - -@node PlanetLab Automation for Fedora8 nodes -@subsubsection PlanetLab Automation for Fedora8 nodes - -@c *********************************************************************** -@node Install buildslave on PlanetLab nodes running fedora core 8 -@subsubsection Install buildslave on PlanetLab nodes running fedora core 8 -@c ** Actually this is a subsubsubsection, but must be fixed differently -@c ** as subsubsection is the lowest. - -Since most of the PlanetLab nodes are running the very old Fedora core 8 -image, installing the buildslave software is quite some pain. For our -PlanetLab testbed we figured out how to install the buildslave software -best. - -@c This is a very terrible way to suggest installing software. -@c FIXME: Is there an official, safer way instead of blind-piping a -@c script? -@c FIXME: Use newer pypi URLs below. -Install Distribute for Python: - -@example -curl http://python-distribute.org/distribute_setup.py | sudo python -@end example - -Install Distribute for zope.interface <= 3.8.0 (4.0 and 4.0.1 will not -work): - -@example -export PYPI=@value{PYPI-URL} -wget $PYPI/z/zope.interface/zope.interface-3.8.0.tar.gz -tar xzvf zope.interface-3.8.0.tar.gz -cd zope.interface-3.8.0 -sudo python setup.py install -@end example - -Install the buildslave software (0.8.6 was the latest version): - -@example -export GCODE="http://buildbot.googlecode.com/files" -wget $GCODE/buildbot-slave-0.8.6p1.tar.gz -tar xvfz buildbot-slave-0.8.6p1.tar.gz -cd buildslave-0.8.6p1 -sudo python setup.py install -@end example - -The setup will download the matching twisted package and install it. -It will also try to install the latest version of zope.interface which -will fail to install. Buildslave will work anyway since version 3.8.0 -was installed before! - -@c *********************************************************************** -@node Setup a new PlanetLab testbed using GPLMT -@subsubsection Setup a new PlanetLab testbed using GPLMT - -@itemize @bullet -@item Get a new slice and assign nodes -Ask your PlanetLab PI to give you a new slice and assign the nodes you -need -@item Install a buildmaster -You can stick to the buildbot documentation:@ -@uref{http://buildbot.net/buildbot/docs/current/manual/installation.html} -@item Install the buildslave software on all nodes -To install the buildslave on all nodes assigned to your slice you can use -the tasklist @code{install_buildslave_fc8.xml} provided with GPLMT: - -@example -./gplmt.py -c contrib/tumple_gnunet.conf -t \ -contrib/tasklists/install_buildslave_fc8.xml -a -p -@end example - -@item Create the buildmaster configuration and the slave setup commands - -The master and the and the slaves have need to have credentials and the -master has to have all nodes configured. This can be done with the -@file{create_buildbot_configuration.py} script in the @file{scripts} -directory. - -This scripts takes a list of nodes retrieved directly from PlanetLab or -read from a file and a configuration template and creates: - -@itemize @bullet -@item a tasklist which can be executed with gplmt to setup the slaves -@item a master.cfg file containing a PlanetLab nodes -@end itemize - -A configuration template is included in the , most important is -that the script replaces the following tags in the template: - -%GPLMT_BUILDER_DEFINITION :@ GPLMT_BUILDER_SUMMARY@ GPLMT_SLAVES@ -%GPLMT_SCHEDULER_BUILDERS - -Create configuration for all nodes assigned to a slice: - -@example -./create_buildbot_configuration.py -u \ --p -s -m \ --t