From d409018c1da52d051bf2e95cd97a73e72cb5accd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jul 2018 19:38:06 +0200 Subject: move gnunet-timeout to src/util/, fix issues related to #5375 --- src/gns/gns_api.c | 7 +- src/gns/gnunet-gns.c | 10 +- src/gns/nss/nss_gns.c | 269 +++++++++++++++++++------------------ src/gns/nss/nss_gns_query.c | 25 +++- src/gns/nss/nss_gns_query.h | 30 +++-- src/identity/identity_api_lookup.c | 8 +- src/util/Makefile.am | 16 ++- src/util/client.c | 13 +- src/util/gnunet-timeout-w32.c | 191 ++++++++++++++++++++++++++ src/util/gnunet-timeout.c | 128 ++++++++++++++++++ 10 files changed, 532 insertions(+), 165 deletions(-) create mode 100644 src/util/gnunet-timeout-w32.c create mode 100644 src/util/gnunet-timeout.c (limited to 'src') diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 0ec9209da..3b658da92 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -232,7 +232,6 @@ reconnect (struct GNUNET_GNS_Handle *handle) handle), GNUNET_MQ_handler_end () }; - struct GNUNET_GNS_LookupRequest *lh; GNUNET_assert (NULL == handle->mq); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -244,7 +243,9 @@ reconnect (struct GNUNET_GNS_Handle *handle) handle); if (NULL == handle->mq) return; - for (lh = handle->lookup_head; NULL != lh; lh = lh->next) + for (struct GNUNET_GNS_LookupRequest *lh = handle->lookup_head; + NULL != lh; + lh = lh->next) GNUNET_MQ_send_copy (handle->mq, lh->env); } diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 149c8a7bb..463348ed3 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -65,8 +65,9 @@ static struct GNUNET_GNS_LookupWithTldRequest *lr; /** * Global return value. * 0 on success (default), - * 1 on internal failures, 2 on launch failure, - * 3 if the name is not a GNS-supported TLD, + * 1 on internal failures + * 2 on launch failure, + * 4 if the name is not a GNS-supported TLD, */ static int global_ret; @@ -114,7 +115,7 @@ process_lookup_result (void *cls, lr = NULL; if (GNUNET_NO == was_gns) { - global_ret = 3; + global_ret = 4; /* not for GNS */ GNUNET_SCHEDULER_shutdown (); return; } @@ -183,7 +184,6 @@ run (void *cls, global_ret = 2; return; } - GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c index 9c9233d35..58aab47fd 100644 --- a/src/gns/nss/nss_gns.c +++ b/src/gns/nss/nss_gns.c @@ -54,121 +54,126 @@ * @return a nss_status code */ enum nss_status -_nss_gns_gethostbyname2_r( - const char *name, - int af, - struct hostent * result, - char *buffer, - size_t buflen, - int *errnop, - int *h_errnop) { - - struct userdata u; - enum nss_status status = NSS_STATUS_UNAVAIL; - int i; - size_t address_length, l, idx, astart; - - if (af == AF_UNSPEC) +_nss_gns_gethostbyname2_r(const char *name, + int af, + struct hostent *result, + char *buffer, + size_t buflen, + int *errnop, + int *h_errnop) +{ + struct userdata u; + enum nss_status status = NSS_STATUS_UNAVAIL; + int i; + size_t address_length; + size_t l; + size_t idx; + size_t astart; + + if (af == AF_UNSPEC) #ifdef NSS_IPV6_ONLY - af = AF_INET6; + af = AF_INET6; #else - af = AF_INET; + af = AF_INET; #endif #ifdef NSS_IPV4_ONLY - if (af != AF_INET) + if (af != AF_INET) #elif NSS_IPV6_ONLY - if (af != AF_INET6) + if (af != AF_INET6) #else - if (af != AF_INET && af != AF_INET6) + if ( (af != AF_INET) && + (af != AF_INET6) ) #endif - { - *errnop = EINVAL; - *h_errnop = NO_RECOVERY; - - goto finish; - } - - address_length = af == AF_INET ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); - if (buflen < - sizeof(char*)+ /* alias names */ - strlen(name)+1) { /* official name */ - - *errnop = ERANGE; - *h_errnop = NO_RECOVERY; - status = NSS_STATUS_TRYAGAIN; - - goto finish; - } - - u.count = 0; - u.data_len = 0; - - i = gns_resolve_name(af, name, &u); - if (-3 == i) - { - status = NSS_STATUS_NOTFOUND; - goto finish; - } - if (-2 == i) - { - status = NSS_STATUS_UNAVAIL; - goto finish; - } - if ( (-1 == i) || - (u.count == 0) ) - { - *errnop = ETIMEDOUT; - *h_errnop = HOST_NOT_FOUND; - status = NSS_STATUS_NOTFOUND; - goto finish; - } - - - /* Alias names */ - *((char**) buffer) = NULL; - result->h_aliases = (char**) buffer; - idx = sizeof(char*); - - /* Official name */ - strcpy(buffer+idx, name); - result->h_name = buffer+idx; - idx += strlen(name)+1; - - ALIGN(idx); - - result->h_addrtype = af; - result->h_length = address_length; - - /* Check if there's enough space for the addresses */ - if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { - *errnop = ERANGE; - *h_errnop = NO_RECOVERY; - status = NSS_STATUS_TRYAGAIN; - goto finish; - } + { + *errnop = EINVAL; + *h_errnop = NO_RECOVERY; + + goto finish; + } + address_length = (af == AF_INET) ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); + if (buflen < + sizeof(char*)+ /* alias names */ + strlen(name)+1) + { /* official name */ + *errnop = ERANGE; + *h_errnop = NO_RECOVERY; + status = NSS_STATUS_TRYAGAIN; + + goto finish; + } + u.count = 0; + u.data_len = 0; + i = gns_resolve_name (af, + name, + &u); + if (-3 == i) + { + status = NSS_STATUS_NOTFOUND; + goto finish; + } + if (-2 == i) + { + status = NSS_STATUS_UNAVAIL; + goto finish; + } + if ( (-1 == i) || + (u.count == 0) ) + { + *errnop = ETIMEDOUT; + *h_errnop = HOST_NOT_FOUND; + status = NSS_STATUS_NOTFOUND; + goto finish; + } + /* Alias names */ + *((char**) buffer) = NULL; + result->h_aliases = (char**) buffer; + idx = sizeof(char*); + + /* Official name */ + strcpy (buffer+idx, + name); + result->h_name = buffer+idx; + idx += strlen (name)+1; + + ALIGN(idx); + + result->h_addrtype = af; + result->h_length = address_length; + + /* Check if there's enough space for the addresses */ + if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) + { + *errnop = ERANGE; + *h_errnop = NO_RECOVERY; + status = NSS_STATUS_TRYAGAIN; + goto finish; + } /* Addresses */ - astart = idx; - l = u.count*address_length; - if (0 != l) - memcpy(buffer+astart, &u.data, l); - /* address_length is a multiple of 32bits, so idx is still aligned - * correctly */ - idx += l; - - /* Address array address_length is always a multiple of 32bits */ - for (i = 0; i < u.count; i++) - ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; - ((char**) (buffer+idx))[i] = NULL; - result->h_addr_list = (char**) (buffer+idx); - - status = NSS_STATUS_SUCCESS; + astart = idx; + l = u.count*address_length; + if (0 != l) + memcpy (buffer+astart, + &u.data, + l); + /* address_length is a multiple of 32bits, so idx is still aligned + * correctly */ + idx += l; + + /* Address array address_length is always a multiple of 32bits */ + for (i = 0; i < u.count; i++) + ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; + ((char**) (buffer+idx))[i] = NULL; + result->h_addr_list = (char**) (buffer+idx); + + status = NSS_STATUS_SUCCESS; finish: - return status; + return status; } + /** * The gethostbyname hook executed by nsswitch * @@ -176,29 +181,28 @@ finish: * @param result the result hostent * @param buffer the result buffer * @param buflen length of the buffer - * @param errnop idk + * @param errnop[out] the low-level error code to return to the application * @param h_errnop idk * @return a nss_status code */ enum nss_status -_nss_gns_gethostbyname_r ( - const char *name, - struct hostent *result, - char *buffer, - size_t buflen, - int *errnop, - int *h_errnop) { - - return _nss_gns_gethostbyname2_r( - name, - AF_UNSPEC, - result, - buffer, - buflen, - errnop, - h_errnop); +_nss_gns_gethostbyname_r (const char *name, + struct hostent *result, + char *buffer, + size_t buflen, + int *errnop, + int *h_errnop) +{ + return _nss_gns_gethostbyname2_r (name, + AF_UNSPEC, + result, + buffer, + buflen, + errnop, + h_errnop); } + /** * The gethostbyaddr hook executed by nsswitch * We can't do this so we always return NSS_STATUS_UNAVAIL @@ -209,23 +213,22 @@ _nss_gns_gethostbyname_r ( * @param result the result hostent * @param buffer the result buffer * @param buflen length of the buffer - * @param errnop idk + * @param errnop[out] the low-level error code to return to the application * @param h_errnop idk * @return NSS_STATUS_UNAVAIL */ enum nss_status -_nss_gns_gethostbyaddr_r( - const void* addr, - int len, - int af, - struct hostent *result, - char *buffer, - size_t buflen, - int *errnop, - int *h_errnop) { - - *errnop = EINVAL; - *h_errnop = NO_RECOVERY; - //NOTE we allow to leak this into DNS so no NOTFOUND - return NSS_STATUS_UNAVAIL; +_nss_gns_gethostbyaddr_r (const void* addr, + int len, + int af, + struct hostent *result, + char *buffer, + size_t buflen, + int *errnop, + int *h_errnop) +{ + *errnop = EINVAL; + *h_errnop = NO_RECOVERY; + //NOTE we allow to leak this into DNS so no NOTFOUND + return NSS_STATUS_UNAVAIL; } diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 094e25ed5..867ead624 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -48,14 +48,16 @@ gns_resolve_name (int af, { if (-1 == asprintf (&cmd, "%s -t AAAA -u %s\n", - "gnunet-gns -r", name)) + "gnunet-gns -r", + name)) return -1; } else { if (-1 == asprintf (&cmd, "%s %s\n", - "gnunet-gns -r -u", name)) + "gnunet-gns -r -u", + name)) return -1; } if (NULL == (p = popen (cmd, "r"))) @@ -63,7 +65,9 @@ gns_resolve_name (int af, free (cmd); return -1; } - while (NULL != fgets (line, sizeof(line), p)) + while (NULL != fgets (line, + sizeof(line), + p)) { if (u->count >= MAX_ENTRIES) break; @@ -72,7 +76,9 @@ gns_resolve_name (int af, line[strlen(line)-1] = '\0'; if (AF_INET == af) { - if (inet_pton(af, line, &(u->data.ipv4[u->count]))) + if (inet_pton(af, + line, + &u->data.ipv4[u->count])) { u->count++; u->data_len += sizeof(ipv4_address_t); @@ -86,7 +92,9 @@ gns_resolve_name (int af, } else if (AF_INET6 == af) { - if (inet_pton(af, line, &(u->data.ipv6[u->count]))) + if (inet_pton(af, + line, + &u->data.ipv6[u->count])) { u->count++; u->data_len += sizeof(ipv6_address_t); @@ -105,7 +113,10 @@ gns_resolve_name (int af, if (4 == ret) return -2; /* not for GNS */ if (3 == ret) - return -3; /* timeout */ + return -3; /* timeout -> not found */ + if ( (2 == ret) || (1 == ret) ) + return -2; /* launch failure -> service unavailable */ return 0; } + /* end of nss_gns_query.c */ diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h index bb04f9004..48cab4b22 100644 --- a/src/gns/nss/nss_gns_query.h +++ b/src/gns/nss/nss_gns_query.h @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -26,25 +26,30 @@ /* Maximum number of entries to return */ #define MAX_ENTRIES 16 -typedef struct { - uint32_t address; +typedef struct +{ + uint32_t address; } ipv4_address_t; -typedef struct { - uint8_t address[16]; + +typedef struct +{ + uint8_t address[16]; } ipv6_address_t; -struct userdata { +struct userdata +{ int count; int data_len; /* only valid when doing reverse lookup */ union { - ipv4_address_t ipv4[MAX_ENTRIES]; - ipv6_address_t ipv6[MAX_ENTRIES]; - char *name[MAX_ENTRIES]; + ipv4_address_t ipv4[MAX_ENTRIES]; + ipv6_address_t ipv6[MAX_ENTRIES]; + char *name[MAX_ENTRIES]; } data; }; + /** * Wrapper function that uses gnunet-gns cli tool to resolve * an IPv4/6 address. @@ -54,8 +59,9 @@ struct userdata { * @param u the userdata (result struct) * @return -1 on error else 0 */ -int gns_resolve_name(int af, - const char *name, - struct userdata *userdata); +int +gns_resolve_name(int af, + const char *name, + struct userdata *userdata); #endif diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c index 593a5dbb0..25aec8ede 100644 --- a/src/identity/identity_api_lookup.c +++ b/src/identity/identity_api_lookup.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -131,6 +131,12 @@ GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, el->identity = GNUNET_IDENTITY_connect (cfg, &identity_cb, el); + if (NULL == el->identity) + { + GNUNET_free (el->name); + GNUNET_free (el); + return NULL; + } return el; } diff --git a/src/util/Makefile.am b/src/util/Makefile.am index ec7bcb016..4ae073c2c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -166,6 +166,7 @@ lib_LTLIBRARIES = libgnunetutil.la libexec_PROGRAMS = \ gnunet-service-resolver \ + gnunet-timeout \ $(W32CONSOLEHELPER) bin_SCRIPTS =\ @@ -192,6 +193,15 @@ endif endif +if !MINGW +gnunet_timeout_SOURCES = \ + gnunet-timeout.c +else +gnunet_timeout_SOURCES = \ + gnunet-timeout-w32.c +endif + + do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' gnunet-qr: gnunet-qr.py.in Makefile @@ -334,12 +344,12 @@ test_hexcoder_LDADD = \ test_tun_SOURCES = \ test_tun.c test_tun_LDADD = \ - libgnunetutil.la + libgnunetutil.la test_regex_SOURCES = \ test_regex.c test_regex_LDADD = \ - libgnunetutil.la + libgnunetutil.la test_os_start_process_SOURCES = \ test_os_start_process.c @@ -622,4 +632,4 @@ EXTRA_DIST = \ test_resolver_api_data.conf \ test_service_data.conf \ test_speedup_data.conf \ - gnunet-qr.py.in + gnunet-qr.py.in diff --git a/src/util/client.c b/src/util/client.c index 44e326eab..1f569255a 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -721,6 +721,17 @@ test_service_configuration (const char *service_name, &unixpath)) && (0 < strlen (unixpath))) ret = GNUNET_OK; + else if ((GNUNET_OK == + GNUNET_CONFIGURATION_have_value (cfg, + service_name, + "UNIXPATH"))) + { + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, + service_name, + "UNIXPATH", + _("not a valid filename")); + return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */ + } GNUNET_free_non_null (unixpath); #endif diff --git a/src/util/gnunet-timeout-w32.c b/src/util/gnunet-timeout-w32.c new file mode 100644 index 000000000..78b268fe2 --- /dev/null +++ b/src/util/gnunet-timeout-w32.c @@ -0,0 +1,191 @@ +/* + This file is part of GNUnet + Copyright (C) 2010 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +/** + * @file src/util/gnunet-timeout-w32.c + * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period + * @author LRN + */ + +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + int i; + DWORD wait_result; + wchar_t *commandline; + wchar_t **wargv; + wchar_t *arg; + unsigned int cmdlen; + STARTUPINFOW start; + PROCESS_INFORMATION proc; + + wchar_t wpath[MAX_PATH + 1]; + + wchar_t *pathbuf; + DWORD pathbuf_len, alloc_len; + wchar_t *ptr; + wchar_t *non_const_filename; + wchar_t *wcmd; + int wargc; + int timeout = 0; + ssize_t wrote; + + HANDLE job; + + if (argc < 3) + { + printf + ("arg 1: timeout in sec., arg 2: executable, arg arguments\n"); + exit (1); + } + + timeout = atoi (argv[1]); + + if (timeout == 0) + timeout = 600; + + commandline = GetCommandLineW (); + if (commandline == NULL) + { + printf ("Failed to get commandline: %lu\n", GetLastError ()); + exit (2); + } + + wargv = CommandLineToArgvW (commandline, &wargc); + if (wargv == NULL || wargc <= 1) + { + printf ("Failed to get parse commandline: %lu\n", GetLastError ()); + exit (3); + } + + job = CreateJobObject (NULL, NULL); + if (job == NULL) + { + printf ("Failed to create a job: %lu\n", GetLastError ()); + exit (4); + } + + pathbuf_len = GetEnvironmentVariableW (L"PATH", (wchar_t *) &pathbuf, 0); + + alloc_len = pathbuf_len + 1; + + pathbuf = malloc (alloc_len * sizeof (wchar_t)); + + ptr = pathbuf; + + alloc_len = GetEnvironmentVariableW (L"PATH", ptr, pathbuf_len); + + cmdlen = wcslen (wargv[2]); + if (cmdlen < 5 || wcscmp (&wargv[2][cmdlen - 4], L".exe") != 0) + { + non_const_filename = malloc (sizeof (wchar_t) * (cmdlen + 5)); + swprintf (non_const_filename, cmdlen + 5, L"%S.exe", wargv[2]); + } + else + { + non_const_filename = wcsdup (wargv[2]); + } + + /* Check that this is the full path. If it isn't, search. */ + if (non_const_filename[1] == L':') + swprintf (wpath, sizeof (wpath) / sizeof (wchar_t), L"%S", non_const_filename); + else if (!SearchPathW + (pathbuf, non_const_filename, NULL, sizeof (wpath) / sizeof (wchar_t), + wpath, NULL)) + { + printf ("Failed to get find executable: %lu\n", GetLastError ()); + exit (5); + } + free (pathbuf); + free (non_const_filename); + + cmdlen = wcslen (wpath) + 4; + i = 3; + while (NULL != (arg = wargv[i++])) + cmdlen += wcslen (arg) + 4; + + wcmd = malloc (sizeof (wchar_t) * (cmdlen + 1)); + wrote = 0; + i = 2; + while (NULL != (arg = wargv[i++])) + { + /* This is to escape trailing slash */ + wchar_t arg_lastchar = arg[wcslen (arg) - 1]; + if (wrote == 0) + { + wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"\"%S%S\" ", wpath, + arg_lastchar == L'\\' ? L"\\" : L""); + } + else + { + if (wcschr (arg, L' ') != NULL) + wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"\"%S%S\"%S", arg, + arg_lastchar == L'\\' ? L"\\" : L"", i == wargc ? L"" : L" "); + else + wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"%S%S%S", arg, + arg_lastchar == L'\\' ? L"\\" : L"", i == wargc ? L"" : L" "); + } + } + + LocalFree (wargv); + + memset (&start, 0, sizeof (start)); + start.cb = sizeof (start); + + if (!CreateProcessW (wpath, wcmd, NULL, NULL, TRUE, CREATE_SUSPENDED, + NULL, NULL, &start, &proc)) + { + wprintf (L"Failed to get spawn process `%S' with arguments `%S': %lu\n", wpath, wcmd, GetLastError ()); + exit (6); + } + + AssignProcessToJobObject (job, proc.hProcess); + + ResumeThread (proc.hThread); + CloseHandle (proc.hThread); + + free (wcmd); + + wait_result = WaitForSingleObject (proc.hProcess, timeout * 1000); + if (wait_result == WAIT_OBJECT_0) + { + DWORD status; + wait_result = GetExitCodeProcess (proc.hProcess, &status); + CloseHandle (proc.hProcess); + if (wait_result != 0) + { + printf ("Test process exited with result %lu\n", status); + TerminateJobObject (job, status); + exit (status); + } + printf ("Test process exited (failed to obtain exit status)\n"); + TerminateJobObject (job, 0); + exit (0); + } + printf ("Child processes were killed after timeout of %u seconds\n", + timeout); + TerminateJobObject (job, 1); + CloseHandle (proc.hProcess); + exit (1); +} + +/* end of timeout_watchdog_w32.c */ diff --git a/src/util/gnunet-timeout.c b/src/util/gnunet-timeout.c new file mode 100644 index 000000000..8dfb6ad17 --- /dev/null +++ b/src/util/gnunet-timeout.c @@ -0,0 +1,128 @@ +/* + This file is part of GNUnet + Copyright (C) 2010 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +/** + * @file src/util/gnunet-timeout.c + * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period + * @author Matthias Wachs + */ + +#include +#include +#include +#include +#include +#include + +static pid_t child; + + +static void +sigchld_handler (int val) +{ + int status = 0; + int ret = 0; + + (void) val; + waitpid (child, + &status, + 0); + if (WIFEXITED (status) != 0) + { + ret = WEXITSTATUS (status); + fprintf (stderr, + "Process exited with result %u\n", + ret); + exit (ret); /* return same status code */ + } + if (WIFSIGNALED (status) != 0) + { + ret = WTERMSIG (status); + fprintf (stderr, + "Process received signal %u\n", + ret); + kill (getpid (), + ret); /* kill self with the same signal */ + } + exit (-1); +} + + +static void +sigint_handler (int val) +{ + kill (0, + val); + exit (val); +} + + +int +main (int argc, + char *argv[]) +{ + int timeout = 0; + pid_t gpid = 0; + + if (argc < 3) + { + fprintf (stderr, + "arg 1: timeout in sec., arg 2: executable, arg arguments\n"); + exit (-1); + } + + timeout = atoi (argv[1]); + + if (timeout == 0) + timeout = 600; + + /* with getpgid() it does not compile, but getpgrp is the BSD version and working */ + gpid = getpgrp (); + + signal (SIGCHLD, sigchld_handler); + signal (SIGABRT, sigint_handler); + signal (SIGFPE, sigint_handler); + signal (SIGILL, sigint_handler); + signal (SIGINT, sigint_handler); + signal (SIGSEGV, sigint_handler); + signal (SIGTERM, sigint_handler); + + child = fork (); + if (child == 0) + { + /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */ + //setpgrp (0, pid_t gpid); + if (-1 != gpid) + setpgid (0, gpid); + execvp (argv[2], + &argv[2]); + exit (-1); + } + if (child > 0) + { + sleep (timeout); + printf ("Child processes were killed after timeout of %u seconds\n", + timeout); + kill (0, + SIGTERM); + exit (3); + } + exit (-1); +} + +/* end of timeout_watchdog.c */ -- cgit v1.2.3 From f726b73c4bdcbfb00b5728dbfaa738f5d6969345 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jul 2018 19:40:19 +0200 Subject: update gitignore --- src/util/.gitignore | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/util/.gitignore b/src/util/.gitignore index 8e7093568..40a3dbc5c 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore @@ -70,3 +70,5 @@ perf_crypto_symmetric perf_crypto_rsa perf_crypto_ecc_dlog test_hexcoder test_regex test_tun +gnunet-timeout +test_hexcoder test_regex test_tun -- cgit v1.2.3 From a62a0839916306a4007d3f2b076878b7a29022ec Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jul 2018 19:40:48 +0200 Subject: update gitignore --- src/util/.gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/.gitignore b/src/util/.gitignore index 40a3dbc5c..7b190ca76 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore @@ -69,6 +69,7 @@ perf_crypto_hash perf_crypto_symmetric perf_crypto_rsa perf_crypto_ecc_dlog -test_hexcoder test_regex test_tun +test_hexcoder +test_regex +test_tun gnunet-timeout -test_hexcoder test_regex test_tun -- cgit v1.2.3 From 4e5b0abe868d344b1b415719db34b1f5f3aa94d0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jul 2018 19:54:13 +0200 Subject: clarify error message of #5375 --- src/util/dnsparser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/util/dnsparser.c b/src/util/dnsparser.c index 57d0a014c..6fb6d657f 100644 --- a/src/util/dnsparser.c +++ b/src/util/dnsparser.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -956,8 +956,11 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, len = dot - idna_name; if ( (len >= 64) || (0 == len) ) { - GNUNET_break (0); - goto fail; /* segment too long or empty */ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Invalid DNS name `%s': label with %u characters encountered\n", + name, + len); + goto fail; /* label too long or empty */ } dst[pos++] = (char) (uint8_t) len; GNUNET_memcpy (&dst[pos], -- cgit v1.2.3 From 76cba102f24b8d6e356b36e63474cd6896a082aa Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jul 2018 20:05:30 +0200 Subject: address #3706 --- src/set/gnunet-service-set_intersection.c | 19 ++++++++++++++++++- src/set/gnunet-service-set_union.c | 19 ++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index 254763b45..1083384f5 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -23,6 +23,7 @@ */ #include "platform.h" #include "gnunet_util_lib.h" +#include "gnunet_statistics_service.h" #include "gnunet-service-set.h" #include "gnunet_block_lib.h" #include "gnunet-service-set_protocol.h" @@ -215,6 +216,10 @@ send_client_removed_element (struct Operation *op, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending removed element (size %u) to client\n", element->size); + GNUNET_STATISTICS_update (_GSS_statistics, + "# Element removed messages sent", + 1, + GNUNET_NO); GNUNET_assert (0 != op->client_request_id); ev = GNUNET_MQ_msg_extra (rm, element->size, @@ -406,6 +411,10 @@ fail_intersection_operation (struct Operation *op) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Intersection operation failed\n"); + GNUNET_STATISTICS_update (_GSS_statistics, + "# Intersection operations failed", + 1, + GNUNET_NO); if (NULL != op->state->my_elements) { GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); @@ -466,6 +475,10 @@ send_bloomfilter (struct Operation *op) op); /* send our Bloom filter */ + GNUNET_STATISTICS_update (_GSS_statistics, + "# Intersection Bloom filters sent", + 1, + GNUNET_NO); chunk_size = 60 * 1024 - sizeof (struct BFMessage); if (bf_size <= chunk_size) { @@ -534,6 +547,10 @@ send_client_done_and_destroy (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Intersection succeeded, sending DONE to local client\n"); + GNUNET_STATISTICS_update (_GSS_statistics, + "# Intersection operations succeeded", + 1, + GNUNET_NO); ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); rm->request_id = htonl (op->client_request_id); diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index c3c14f1ba..c1268948a 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -758,8 +758,8 @@ get_order_from_difference (unsigned int diff) */ static int send_full_element_iterator (void *cls, - const struct GNUNET_HashCode *key, - void *value) + const struct GNUNET_HashCode *key, + void *value) { struct Operation *op = cls; struct GNUNET_SET_ElementMessage *emsg; @@ -1371,7 +1371,8 @@ send_client_element (struct Operation *op, * * @param op operation */ -void destroy_channel (struct Operation *op) +static void +destroy_channel (struct Operation *op) { struct GNUNET_CADET_Channel *channel; @@ -1404,7 +1405,11 @@ send_client_done (void *cls) if (PHASE_DONE != op->state->phase) { LOG (GNUNET_ERROR_TYPE_WARNING, - "union operation failed\n"); + "Union operation failed\n"); + GNUNET_STATISTICS_update (_GSS_statistics, + "# Union operations failed", + 1, + GNUNET_NO); ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); rm->request_id = htonl (op->client_request_id); @@ -1416,6 +1421,10 @@ send_client_done (void *cls) op->state->client_done_sent = GNUNET_YES; + GNUNET_STATISTICS_update (_GSS_statistics, + "# Union operations succeeded", + 1, + GNUNET_NO); LOG (GNUNET_ERROR_TYPE_INFO, "Signalling client that union operation is done\n"); ev = GNUNET_MQ_msg (rm, -- cgit v1.2.3 From bb3371542e3c1fff2c4abb4d2ba3decf925b4352 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Mon, 2 Jul 2018 12:48:05 +0200 Subject: rps service: set delete flags on channel properly --- po/POTFILES.in | 1 + src/rps/gnunet-service-rps.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index 38fa52508..8a95064a6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -325,6 +325,7 @@ src/rps/gnunet-service-rps_sampler.c src/rps/gnunet-service-rps_sampler_elem.c src/rps/gnunet-service-rps_view.c src/rps/rps_api.c +src/rps/rps_test_lib.c src/rps/rps-test_util.c src/scalarproduct/gnunet-scalarproduct.c src/scalarproduct/gnunet-service-scalarproduct_alice.c diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 84fb33be2..5a75ac55a 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -1666,10 +1666,11 @@ Peers_cleanup_destroyed_channel (void *cls, { struct GNUNET_PeerIdentity *peer = cls; struct PeerContext *peer_ctx; + uint32_t *channel_flag; if (GNUNET_NO == Peers_check_peer_known (peer)) {/* We don't want to implicitly create a context that we're about to kill */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + LOG (GNUNET_ERROR_TYPE_WARNING, "channel (%s) without associated context was destroyed\n", GNUNET_i2s (peer)); return; @@ -1697,12 +1698,16 @@ Peers_cleanup_destroyed_channel (void *cls, if (NULL != peer_ctx->send_channel) { GNUNET_CADET_channel_destroy (peer_ctx->send_channel); + channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_SENDING); + Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); peer_ctx->send_channel = NULL; peer_ctx->mq = NULL; } if (NULL != peer_ctx->recv_channel) { GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); + channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_RECEIVING); + Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); peer_ctx->recv_channel = NULL; } /* Set the #Peers_ONLINE flag accordingly */ -- cgit v1.2.3 From 04bc4d622a4ebdc903fa6feb35192a4efddcc2ca Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 3 Jul 2018 10:30:30 +0200 Subject: rps profiler: correct condition for writing bytes --- src/rps/rps-test_util.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c index d47e4952f..08fe96097 100644 --- a/src/rps/rps-test_util.c +++ b/src/rps/rps-test_util.c @@ -31,6 +31,17 @@ #define LOG(kind, ...) GNUNET_log_from(kind,"rps-test_util",__VA_ARGS__) +#define B2B_PAT "%c%c%c%c%c%c%c%c" +#define B2B(byte) \ + (byte & 0x80 ? '1' : '0'), \ + (byte & 0x40 ? '1' : '0'), \ + (byte & 0x20 ? '1' : '0'), \ + (byte & 0x10 ? '1' : '0'), \ + (byte & 0x08 ? '1' : '0'), \ + (byte & 0x04 ? '1' : '0'), \ + (byte & 0x02 ? '1' : '0'), \ + (byte & 0x01 ? '1' : '0') + #ifndef TO_FILE #define TO_FILE #endif /* TO_FILE */ @@ -155,6 +166,9 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf) return; } + LOG (GNUNET_ERROR_TYPE_WARNING, + "Wrote %u bytes raw.\n", + size_written); if (GNUNET_YES != GNUNET_DISK_file_close (f)) LOG (GNUNET_ERROR_TYPE_WARNING, "Unable to close file\n"); @@ -180,6 +194,8 @@ to_file_raw_unaligned (const char *file_name, // num_bits_buf_unaligned = bits_needed % 8; // return; //} + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Was asked to write %u bits\n", bits_needed); char buf_write[size_buf + 1]; const unsigned bytes_iter = (0 != bits_needed % 8? @@ -187,6 +203,14 @@ to_file_raw_unaligned (const char *file_name, bits_needed/8); // TODO what if no iteration happens? unsigned size_buf_write = 0; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "num_bits_buf_unaligned: %u\n", + num_bits_buf_unaligned); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "ua args: size_buf: %u, bits_needed: %u -> iter: %u\n", + size_buf, + bits_needed, + bytes_iter); buf_write[0] = buf_unaligned; /* Iterate over input bytes */ for (unsigned i = 0; i < bytes_iter; i++) @@ -227,17 +251,57 @@ to_file_raw_unaligned (const char *file_name, { num_bits_needed_iter = 8; } + LOG (GNUNET_ERROR_TYPE_DEBUG, + "number of bits needed in this iteration: %u\n", + num_bits_needed_iter); mask_bits_needed_iter = ((char) 1 << num_bits_needed_iter) - 1; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "mask needed bits (current iter): "B2B_PAT"\n", + B2B(mask_bits_needed_iter)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Unaligned byte: "B2B_PAT" (%u bits)\n", + B2B(buf_unaligned), + num_bits_buf_unaligned); byte_input = buf[i]; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "next whole input byte: "B2B_PAT"\n", + B2B(byte_input)); byte_input &= mask_bits_needed_iter; num_bits_to_align = 8 - num_bits_buf_unaligned; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "input byte, needed bits: "B2B_PAT"\n", + B2B(byte_input)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "number of bits needed to align unaligned bit: %u\n", + num_bits_to_align); num_bits_to_move = min (num_bits_to_align, num_bits_needed_iter); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "number of bits of new byte to move: %u\n", + num_bits_to_move); mask_input_to_move = ((char) 1 << num_bits_to_move) - 1; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "mask of bits of new byte to take for moving: "B2B_PAT"\n", + B2B(mask_input_to_move)); bits_to_move = byte_input & mask_input_to_move; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "masked bits of new byte to take for moving: "B2B_PAT"\n", + B2B(bits_to_move)); distance_shift_bits = num_bits_buf_unaligned; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "distance needed to shift bits to their correct spot: %u\n", + distance_shift_bits); bits_moving = bits_to_move << distance_shift_bits; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "shifted, masked bits of new byte being moved: "B2B_PAT"\n", + B2B(bits_moving)); byte_to_fill = buf_unaligned | bits_moving; - if (num_bits_buf_unaligned + num_bits_needed_iter > 8) + LOG (GNUNET_ERROR_TYPE_DEBUG, + "byte being filled: "B2B_PAT"\n", + B2B(byte_to_fill)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "pending bytes: %u\n", + num_bits_buf_unaligned + num_bits_needed_iter); + if (num_bits_buf_unaligned + num_bits_needed_iter >= 8) { /* buf_unaligned was aligned by filling * -> can be written to storage */ @@ -246,10 +310,22 @@ to_file_raw_unaligned (const char *file_name, /* store the leftover, unaligned bits in buffer */ mask_input_leftover = mask_bits_needed_iter & (~ mask_input_to_move); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "mask of leftover bits of new byte: "B2B_PAT"\n", + B2B(mask_input_leftover)); byte_input_leftover = byte_input & mask_input_leftover; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "masked, leftover bits of new byte: "B2B_PAT"\n", + B2B(byte_input_leftover)); num_bits_leftover = num_bits_needed_iter - num_bits_to_move; - num_bits_discard = 8 - num_bits_needed_iter; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "number of unaligned bits left: %u\n", + num_bits_leftover); + //num_bits_discard = 8 - num_bits_needed_iter; byte_unaligned_new = byte_input_leftover >> num_bits_to_move; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "new unaligned byte: "B2B_PAT"\n", + B2B(byte_unaligned_new)); buf_unaligned = byte_unaligned_new; num_bits_buf_unaligned = num_bits_leftover % 8; } -- cgit v1.2.3 From ca09329c05855671f08611dc4cfafd19494842b0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 3 Jul 2018 17:36:55 +0200 Subject: assert no MQ error after MQ destroy --- src/cadet/cadet_api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 319279110..92dd39b97 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -841,6 +841,7 @@ handle_mq_error (void *cls, h); GNUNET_MQ_destroy (h->mq); h->mq = NULL; + GNUNET_assert (NULL == h->reconnect_task); h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h); -- cgit v1.2.3 From 54a27e268ac6d754232f0d5098fe7c95bc90901f Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Tue, 3 Jul 2018 17:56:15 +0200 Subject: reduce relogin time --- src/identity-provider/plugin_rest_openid_connect.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/identity-provider/plugin_rest_openid_connect.c b/src/identity-provider/plugin_rest_openid_connect.c index d87a345cf..19aac224f 100644 --- a/src/identity-provider/plugin_rest_openid_connect.c +++ b/src/identity-provider/plugin_rest_openid_connect.c @@ -1014,10 +1014,11 @@ login_check (void *cls) return; } } - handle->emsg = GNUNET_strdup("invalid_cookie"); - handle->edesc = GNUNET_strdup( - "The cookie of the login identity is not valid"); - GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); + //handle->emsg = GNUNET_strdup("invalid_cookie"); + //handle->edesc = GNUNET_strdup( + // "The cookie of the login identity is not valid"); + //GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); + GNUNET_SCHEDULER_add_now (&login_redirection,handle); return; } } @@ -1359,8 +1360,8 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle, current_time = GNUNET_new(struct GNUNET_TIME_Absolute); *current_time = GNUNET_TIME_relative_to_absolute ( - GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_minute_ (), - 30)); + GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (), + 5)); last_time = GNUNET_CONTAINER_multihashmap_get(OIDC_identity_login_time, &cache_key); if (NULL != last_time) { -- cgit v1.2.3 From 7653605896fe4485804bdff609a351b6c742f5f6 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Tue, 3 Jul 2018 18:14:24 +0200 Subject: update --- po/POTFILES.in | 127 +++++++++++---------- src/identity-provider/plugin_rest_openid_connect.c | 2 + 2 files changed, 66 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index 8a95064a6..83c3c7bdd 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,13 +4,21 @@ src/arm/arm_monitor_api.c src/arm/gnunet-arm.c src/arm/gnunet-service-arm.c src/arm/mockup-service.c +src/ats-tests/ats-testing-experiment.c +src/ats-tests/ats-testing-log.c +src/ats-tests/ats-testing-preferences.c +src/ats-tests/ats-testing-traffic.c +src/ats-tests/ats-testing.c +src/ats-tests/gnunet-ats-sim.c +src/ats-tests/gnunet-solver-eval.c +src/ats-tool/gnunet-ats.c src/ats/ats_api_connectivity.c src/ats/ats_api_performance.c src/ats/ats_api_scanner.c src/ats/ats_api_scheduling.c src/ats/gnunet-ats-solver-eval.c -src/ats/gnunet-service-ats_addresses.c src/ats/gnunet-service-ats.c +src/ats/gnunet-service-ats_addresses.c src/ats/gnunet-service-ats_connectivity.c src/ats/gnunet-service-ats_normalization.c src/ats/gnunet-service-ats_performance.c @@ -21,14 +29,6 @@ src/ats/gnunet-service-ats_scheduling.c src/ats/plugin_ats_mlp.c src/ats/plugin_ats_proportional.c src/ats/plugin_ats_ril.c -src/ats-tests/ats-testing.c -src/ats-tests/ats-testing-experiment.c -src/ats-tests/ats-testing-log.c -src/ats-tests/ats-testing-preferences.c -src/ats-tests/ats-testing-traffic.c -src/ats-tests/gnunet-ats-sim.c -src/ats-tests/gnunet-solver-eval.c -src/ats-tool/gnunet-ats.c src/auction/gnunet-auction-create.c src/auction/gnunet-auction-info.c src/auction/gnunet-auction-join.c @@ -40,8 +40,8 @@ src/block/plugin_block_test.c src/cadet/cadet_api.c src/cadet/cadet_test_lib.c src/cadet/desirability_table.c -src/cadet/gnunet-cadet.c src/cadet/gnunet-cadet-profiler.c +src/cadet/gnunet-cadet.c src/cadet/gnunet-service-cadet.c src/cadet/gnunet-service-cadet_channel.c src/cadet/gnunet-service-cadet_connection.c @@ -57,15 +57,15 @@ src/consensus/gnunet-service-consensus.c src/consensus/plugin_block_consensus.c src/conversation/conversation_api.c src/conversation/conversation_api_call.c -src/conversation/gnunet-conversation.c src/conversation/gnunet-conversation-test.c -src/conversation/gnunet_gst.c -src/conversation/gnunet_gst_test.c -src/conversation/gnunet-helper-audio-playback.c +src/conversation/gnunet-conversation.c src/conversation/gnunet-helper-audio-playback-gst.c -src/conversation/gnunet-helper-audio-record.c +src/conversation/gnunet-helper-audio-playback.c src/conversation/gnunet-helper-audio-record-gst.c +src/conversation/gnunet-helper-audio-record.c src/conversation/gnunet-service-conversation.c +src/conversation/gnunet_gst.c +src/conversation/gnunet_gst_test.c src/conversation/microphone.c src/conversation/plugin_gnsrecord_conversation.c src/conversation/speaker.c @@ -102,7 +102,6 @@ src/dht/dht_api.c src/dht/dht_test_lib.c src/dht/gnunet-dht-get.c src/dht/gnunet-dht-monitor.c -src/dht/gnunet_dht_profiler.c src/dht/gnunet-dht-put.c src/dht/gnunet-service-dht.c src/dht/gnunet-service-dht_clients.c @@ -111,6 +110,7 @@ src/dht/gnunet-service-dht_hello.c src/dht/gnunet-service-dht_neighbours.c src/dht/gnunet-service-dht_nse.c src/dht/gnunet-service-dht_routing.c +src/dht/gnunet_dht_profiler.c src/dht/plugin_block_dht.c src/dns/dns_api.c src/dns/gnunet-dns-monitor.c @@ -124,8 +124,8 @@ src/dv/gnunet-dv.c src/dv/gnunet-service-dv.c src/dv/plugin_transport_dv.c src/exit/gnunet-daemon-exit.c -src/exit/gnunet-helper-exit.c src/exit/gnunet-helper-exit-windows.c +src/exit/gnunet-helper-exit.c src/fragmentation/defragmentation.c src/fragmentation/fragmentation.c src/fs/fs_api.c @@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c src/fs/gnunet-daemon-fsprofiler.c src/fs/gnunet-directory.c src/fs/gnunet-download.c -src/fs/gnunet-fs.c src/fs/gnunet-fs-profiler.c +src/fs/gnunet-fs.c src/fs/gnunet-helper-fs-publish.c src/fs/gnunet-publish.c src/fs/gnunet-search.c @@ -171,10 +171,10 @@ src/gns/gns_tld_api.c src/gns/gnunet-bcd.c src/gns/gnunet-dns2gns.c src/gns/gnunet-gns-benchmark.c -src/gns/gnunet-gns.c src/gns/gnunet-gns-helper-service-w32.c src/gns/gnunet-gns-import.c src/gns/gnunet-gns-proxy.c +src/gns/gnunet-gns.c src/gns/gnunet-service-gns.c src/gns/gnunet-service-gns_interceptor.c src/gns/gnunet-service-gns_resolver.c @@ -183,15 +183,15 @@ src/gns/nss/nss_gns_query.c src/gns/plugin_block_gns.c src/gns/plugin_gnsrecord_gns.c src/gns/plugin_rest_gns.c +src/gns/w32nsp-install.c +src/gns/w32nsp-resolve.c +src/gns/w32nsp-uninstall.c +src/gns/w32nsp.c src/gnsrecord/gnsrecord.c src/gnsrecord/gnsrecord_crypto.c src/gnsrecord/gnsrecord_misc.c src/gnsrecord/gnsrecord_serialization.c src/gnsrecord/plugin_gnsrecord_dns.c -src/gns/w32nsp.c -src/gns/w32nsp-install.c -src/gns/w32nsp-resolve.c -src/gns/w32nsp-uninstall.c src/hello/address.c src/hello/gnunet-hello.c src/hello/hello.c @@ -200,11 +200,6 @@ src/hostlist/gnunet-daemon-hostlist_client.c src/hostlist/gnunet-daemon-hostlist_server.c src/identity-attribute/identity_attribute.c src/identity-attribute/plugin_identity_attribute_gnuid.c -src/identity/gnunet-identity.c -src/identity/gnunet-service-identity.c -src/identity/identity_api.c -src/identity/identity_api_lookup.c -src/identity/plugin_rest_identity.c src/identity-provider/gnunet-idp.c src/identity-provider/gnunet-service-identity-provider.c src/identity-provider/identity_provider_api.c @@ -213,15 +208,20 @@ src/identity-provider/plugin_gnsrecord_identity_provider.c src/identity-provider/plugin_identity_provider_sqlite.c src/identity-provider/plugin_rest_identity_provider.c src/identity-provider/plugin_rest_openid_connect.c +src/identity/gnunet-identity.c +src/identity/gnunet-service-identity.c +src/identity/identity_api.c +src/identity/identity_api_lookup.c +src/identity/plugin_rest_identity.c +src/json/json.c +src/json/json_generator.c +src/json/json_helper.c +src/json/json_mhd.c src/jsonapi/jsonapi.c src/jsonapi/jsonapi_document.c src/jsonapi/jsonapi_error.c src/jsonapi/jsonapi_relationship.c src/jsonapi/jsonapi_resource.c -src/json/json.c -src/json/json_generator.c -src/json/json_helper.c -src/json/json_mhd.c src/multicast/gnunet-multicast.c src/multicast/gnunet-service-multicast.c src/multicast/multicast_api.c @@ -235,8 +235,8 @@ src/namecache/namecache_api.c src/namecache/plugin_namecache_flat.c src/namecache/plugin_namecache_postgres.c src/namecache/plugin_namecache_sqlite.c -src/namestore/gnunet-namestore.c src/namestore/gnunet-namestore-fcfsd.c +src/namestore/gnunet-namestore.c src/namestore/gnunet-service-namestore.c src/namestore/gnunet-zoneimport.c src/namestore/namestore_api.c @@ -252,10 +252,10 @@ src/nat-auto/gnunet-service-nat-auto.c src/nat-auto/gnunet-service-nat-auto_legacy.c src/nat-auto/nat_auto_api.c src/nat-auto/nat_auto_api_test.c -src/nat/gnunet-helper-nat-client.c src/nat/gnunet-helper-nat-client-windows.c -src/nat/gnunet-helper-nat-server.c +src/nat/gnunet-helper-nat-client.c src/nat/gnunet-helper-nat-server-windows.c +src/nat/gnunet-helper-nat-server.c src/nat/gnunet-nat.c src/nat/gnunet-service-nat.c src/nat/gnunet-service-nat_externalip.c @@ -264,15 +264,15 @@ src/nat/gnunet-service-nat_mini.c src/nat/gnunet-service-nat_stun.c src/nat/nat_api.c src/nat/nat_api_stun.c -src/nse/gnunet-nse.c src/nse/gnunet-nse-profiler.c +src/nse/gnunet-nse.c src/nse/gnunet-service-nse.c src/nse/nse_api.c +src/peerinfo-tool/gnunet-peerinfo.c +src/peerinfo-tool/gnunet-peerinfo_plugins.c src/peerinfo/gnunet-service-peerinfo.c src/peerinfo/peerinfo_api.c src/peerinfo/peerinfo_api_notify.c -src/peerinfo-tool/gnunet-peerinfo.c -src/peerinfo-tool/gnunet-peerinfo_plugins.c src/peerstore/gnunet-peerstore.c src/peerstore/gnunet-service-peerstore.c src/peerstore/peerstore_api.c @@ -317,21 +317,20 @@ src/revocation/gnunet-revocation.c src/revocation/gnunet-service-revocation.c src/revocation/plugin_block_revocation.c src/revocation/revocation_api.c -src/rps/gnunet-rps.c src/rps/gnunet-rps-profiler.c +src/rps/gnunet-rps.c src/rps/gnunet-service-rps.c src/rps/gnunet-service-rps_custommap.c src/rps/gnunet-service-rps_sampler.c src/rps/gnunet-service-rps_sampler_elem.c src/rps/gnunet-service-rps_view.c -src/rps/rps_api.c -src/rps/rps_test_lib.c src/rps/rps-test_util.c +src/rps/rps_api.c src/scalarproduct/gnunet-scalarproduct.c -src/scalarproduct/gnunet-service-scalarproduct_alice.c -src/scalarproduct/gnunet-service-scalarproduct_bob.c src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c +src/scalarproduct/gnunet-service-scalarproduct_alice.c +src/scalarproduct/gnunet-service-scalarproduct_bob.c src/scalarproduct/scalarproduct_api.c src/secretsharing/gnunet-secretsharing-profiler.c src/secretsharing/gnunet-service-secretsharing.c @@ -360,15 +359,16 @@ src/statistics/gnunet-statistics.c src/statistics/statistics_api.c src/template/gnunet-service-template.c src/template/gnunet-template.c +src/testbed-logger/gnunet-service-testbed-logger.c +src/testbed-logger/testbed_logger_api.c src/testbed/generate-underlay-topology.c src/testbed/gnunet-daemon-latency-logger.c src/testbed/gnunet-daemon-testbed-blacklist.c src/testbed/gnunet-daemon-testbed-underlay.c src/testbed/gnunet-helper-testbed.c -src/testbed/gnunet_mpi_test.c src/testbed/gnunet-service-test-barriers.c -src/testbed/gnunet-service-testbed_barriers.c src/testbed/gnunet-service-testbed.c +src/testbed/gnunet-service-testbed_barriers.c src/testbed/gnunet-service-testbed_cache.c src/testbed/gnunet-service-testbed_connectionpool.c src/testbed/gnunet-service-testbed_cpustatus.c @@ -376,20 +376,19 @@ src/testbed/gnunet-service-testbed_links.c src/testbed/gnunet-service-testbed_meminfo.c src/testbed/gnunet-service-testbed_oc.c src/testbed/gnunet-service-testbed_peers.c -src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/gnunet-testbed-profiler.c -src/testbed-logger/gnunet-service-testbed-logger.c -src/testbed-logger/testbed_logger_api.c -src/testbed/testbed_api_barriers.c +src/testbed/gnunet_mpi_test.c +src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/testbed_api.c +src/testbed/testbed_api_barriers.c src/testbed/testbed_api_hosts.c src/testbed/testbed_api_operations.c src/testbed/testbed_api_peers.c src/testbed/testbed_api_sd.c src/testbed/testbed_api_services.c src/testbed/testbed_api_statistics.c -src/testbed/testbed_api_testbed.c src/testbed/testbed_api_test.c +src/testbed/testbed_api_testbed.c src/testbed/testbed_api_topology.c src/testbed/testbed_api_underlay.c src/testing/gnunet-testing.c @@ -398,28 +397,28 @@ src/testing/testing.c src/topology/friends.c src/topology/gnunet-daemon-topology.c src/transport/gnunet-helper-transport-bluetooth.c -src/transport/gnunet-helper-transport-wlan.c src/transport/gnunet-helper-transport-wlan-dummy.c -src/transport/gnunet-service-transport_ats.c +src/transport/gnunet-helper-transport-wlan.c src/transport/gnunet-service-transport.c +src/transport/gnunet-service-transport_ats.c src/transport/gnunet-service-transport_hello.c src/transport/gnunet-service-transport_manipulation.c src/transport/gnunet-service-transport_neighbours.c src/transport/gnunet-service-transport_plugins.c src/transport/gnunet-service-transport_validation.c -src/transport/gnunet-transport.c src/transport/gnunet-transport-certificate-creation.c src/transport/gnunet-transport-profiler.c src/transport/gnunet-transport-wlan-receiver.c src/transport/gnunet-transport-wlan-sender.c +src/transport/gnunet-transport.c src/transport/plugin_transport_http_client.c src/transport/plugin_transport_http_common.c src/transport/plugin_transport_http_server.c src/transport/plugin_transport_smtp.c src/transport/plugin_transport_tcp.c src/transport/plugin_transport_template.c -src/transport/plugin_transport_udp_broadcasting.c src/transport/plugin_transport_udp.c +src/transport/plugin_transport_udp_broadcasting.c src/transport/plugin_transport_unix.c src/transport/plugin_transport_wlan.c src/transport/plugin_transport_xt.c @@ -428,6 +427,11 @@ src/transport/tcp_connection_legacy.c src/transport/tcp_server_legacy.c src/transport/tcp_server_mst_legacy.c src/transport/tcp_service_legacy.c +src/transport/transport-testing-filenames.c +src/transport/transport-testing-loggers.c +src/transport/transport-testing-main.c +src/transport/transport-testing-send.c +src/transport/transport-testing.c src/transport/transport_api_address_to_string.c src/transport/transport_api_blacklist.c src/transport/transport_api_core.c @@ -436,11 +440,6 @@ src/transport/transport_api_manipulation.c src/transport/transport_api_monitor_peers.c src/transport/transport_api_monitor_plugins.c src/transport/transport_api_offer_hello.c -src/transport/transport-testing.c -src/transport/transport-testing-filenames.c -src/transport/transport-testing-loggers.c -src/transport/transport-testing-main.c -src/transport/transport-testing-send.c src/util/bandwidth.c src/util/bio.c src/util/client.c @@ -452,8 +451,8 @@ src/util/configuration_loader.c src/util/container_bloomfilter.c src/util/container_heap.c src/util/container_meta_data.c -src/util/container_multihashmap32.c src/util/container_multihashmap.c +src/util/container_multihashmap32.c src/util/container_multipeermap.c src/util/container_multishortmap.c src/util/crypto_abe.c @@ -475,13 +474,15 @@ src/util/dnsparser.c src/util/dnsstub.c src/util/getopt.c src/util/getopt_helpers.c -src/util/gnunet-config.c src/util/gnunet-config-diff.c +src/util/gnunet-config.c src/util/gnunet-ecc.c src/util/gnunet-helper-w32-console.c src/util/gnunet-resolver.c src/util/gnunet-scrypt.c src/util/gnunet-service-resolver.c +src/util/gnunet-timeout-w32.c +src/util/gnunet-timeout.c src/util/gnunet-uri.c src/util/helper.c src/util/load.c @@ -509,13 +510,13 @@ src/util/tun.c src/util/w32cat.c src/util/win.c src/util/winproc.c -src/vpn/gnunet-helper-vpn.c src/vpn/gnunet-helper-vpn-windows.c +src/vpn/gnunet-helper-vpn.c src/vpn/gnunet-service-vpn.c src/vpn/gnunet-vpn.c src/vpn/vpn_api.c -src/zonemaster/gnunet-service-zonemaster.c src/zonemaster/gnunet-service-zonemaster-monitor.c +src/zonemaster/gnunet-service-zonemaster.c src/fs/fs_api.h src/include/gnunet_common.h src/include/gnunet_mq_lib.h diff --git a/src/identity-provider/plugin_rest_openid_connect.c b/src/identity-provider/plugin_rest_openid_connect.c index 19aac224f..9c2f7fb3d 100644 --- a/src/identity-provider/plugin_rest_openid_connect.c +++ b/src/identity-provider/plugin_rest_openid_connect.c @@ -732,6 +732,8 @@ cookie_identity_interpretation (struct RequestHandle *handle) { handle->oidc->login_identity = strtok(handle->oidc->login_identity, OIDC_COOKIE_HEADER_INFORMATION_KEY); handle->oidc->login_identity = GNUNET_strdup(handle->oidc->login_identity); + } else { + handle->oidc->login_identity = NULL; } } else -- cgit v1.2.3 From edefc4c42202fd10a48ea9037e3fe04e5ead840d Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 3 Jul 2018 17:27:10 +0200 Subject: fix rps profiler: mark cancelled task as done --- src/rps/gnunet-rps-profiler.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 16f23e86c..54dc7d65e 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c @@ -888,6 +888,7 @@ shutdown_op (void *cls) if (NULL != post_test_task) { GNUNET_SCHEDULER_cancel (post_test_task); + post_test_task = NULL; } if (NULL != churn_task) { -- cgit v1.2.3 From 7940449e54a2716d69aed0fd01953ef6204b0229 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 3 Jul 2018 21:09:47 +0200 Subject: fix rps profiler: mark handle unusable after closing it --- src/rps/gnunet-rps-profiler.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 54dc7d65e..f75f9794f 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c @@ -900,6 +900,7 @@ shutdown_op (void *cls) if (NULL != rps_peers[i].rps_handle) { GNUNET_RPS_disconnect (rps_peers[i].rps_handle); + rps_peers[i].rps_handle = NULL; } if (NULL != rps_peers[i].op) { -- cgit v1.2.3 From 37d12e4bcfc456ae488cce7d93853339812035fe Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 3 Jul 2018 21:10:38 +0200 Subject: rps profiler: different time for hard shutdown --- src/rps/gnunet-rps-profiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index f75f9794f..ec73f1803 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c @@ -2572,7 +2572,7 @@ test_run (void *cls, if (NULL != churn_task) GNUNET_SCHEDULER_cancel (churn_task); post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); - timeout = GNUNET_TIME_relative_multiply (timeout, 1 + (0.1 * num_peers)); + timeout = GNUNET_TIME_relative_multiply (timeout, 1.2 + (0.01 * num_peers)); shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); -- cgit v1.2.3 From 00fc4513ebdb851c79b8f7c2591dffb6bd70c5bd Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 3 Jul 2018 21:11:40 +0200 Subject: rps service: stop ignoring own peer id --- src/rps/gnunet-service-rps.c | 60 ++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 5a75ac55a..db09c68d2 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -1045,12 +1045,10 @@ restore_valid_peers () */ void Peers_initialise (char* fn_valid_peers, - struct GNUNET_CADET_Handle *cadet_h, - const struct GNUNET_PeerIdentity *own_id) + struct GNUNET_CADET_Handle *cadet_h) { filename_valid_peers = GNUNET_strdup (fn_valid_peers); cadet_handle = cadet_h; - own_identity = *own_id; peer_map = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); valid_peers = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); restore_valid_peers (); @@ -1136,14 +1134,12 @@ Peers_get_valid_peers (PeersIterator iterator, * @param peer the new #GNUNET_PeerIdentity * * @return #GNUNET_YES if peer was inserted - * #GNUNET_NO otherwise (if peer was already known or - * peer was #own_identity) + * #GNUNET_NO otherwise */ int Peers_insert_peer (const struct GNUNET_PeerIdentity *peer) { - if ( (GNUNET_YES == Peers_check_peer_known (peer)) || - (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity)) ) + if (GNUNET_YES == Peers_check_peer_known (peer)) { return GNUNET_NO; /* We already know this peer - nothing to do */ } @@ -1161,8 +1157,7 @@ Peers_check_peer_flag (const struct GNUNET_PeerIdentity *peer, enum Peers_PeerFl * * @param peer the peer whose liveliness is to be checked * @return #GNUNET_YES if peer had to be inserted - * #GNUNET_NO otherwise (if peer was already known or - * peer was #own_identity) + * #GNUNET_NO otherwise */ int Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer) @@ -1170,10 +1165,6 @@ Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer) struct PeerContext *peer_ctx; int ret; - if (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity)) - { - return GNUNET_NO; - } ret = Peers_insert_peer (peer); peer_ctx = get_peer_ctx (peer); if (GNUNET_NO == Peers_check_peer_flag (peer, Peers_ONLINE)) @@ -1791,10 +1782,6 @@ Peers_schedule_operation (const struct GNUNET_PeerIdentity *peer, struct PeerPendingOp pending_op; struct PeerContext *peer_ctx; - if (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity)) - { - return GNUNET_NO; - } GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer)); //TODO if LIVE/ONLINE execute immediately @@ -3373,9 +3360,7 @@ handle_peer_pull_reply (void *cls, if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set, &peers[i]) && GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mal_peer_set, - &peers[i]) - && 0 != GNUNET_CRYPTO_cmp_peer_identity (&peers[i], - &own_identity)) + &peers[i])) { tmp_att_peer = GNUNET_new (struct AttackedPeer); tmp_att_peer->peer_id = peers[i]; @@ -3387,21 +3372,17 @@ handle_peer_pull_reply (void *cls, continue; } #endif /* ENABLE_MALICIOUS */ - if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, - &peers[i])) - { - /* Make sure we 'know' about this peer */ - (void) Peers_insert_peer (&peers[i]); + /* Make sure we 'know' about this peer */ + (void) Peers_insert_peer (&peers[i]); - if (GNUNET_YES == Peers_check_peer_valid (&peers[i])) - { - CustomPeerMap_put (pull_map, &peers[i]); - } - else - { - Peers_schedule_operation (&peers[i], insert_in_pull_map); - (void) Peers_issue_peer_liveliness_check (&peers[i]); - } + if (GNUNET_YES == Peers_check_peer_valid (&peers[i])) + { + CustomPeerMap_put (pull_map, &peers[i]); + } + else + { + Peers_schedule_operation (&peers[i], insert_in_pull_map); + (void) Peers_issue_peer_liveliness_check (&peers[i]); } } @@ -3836,10 +3817,8 @@ do_round (void *cls) for (i = 0; i < a_peers; i++) { peer = view_array[permut[i]]; - if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer)) // TODO - { // FIXME if this fails schedule/loop this for later - send_push (&peer); - } + // FIXME if this fails schedule/loop this for later + send_push (&peer); } /* Send PULL requests */ @@ -3857,8 +3836,7 @@ do_round (void *cls) for (i = first_border; i < second_border; i++) { peer = view_array[permut[i]]; - if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer) && - GNUNET_NO == Peers_check_peer_flag (&peer, Peers_PULL_REPLY_PENDING)) // TODO + if ( GNUNET_NO == Peers_check_peer_flag (&peer, Peers_PULL_REPLY_PENDING)) { // FIXME if this fails schedule/loop this for later send_pull_request (&peer); } @@ -4372,7 +4350,7 @@ run (void *cls, peerinfo_handle = GNUNET_PEERINFO_connect (cfg); - Peers_initialise (fn_valid_peers, cadet_handle, &own_identity); + Peers_initialise (fn_valid_peers, cadet_handle); GNUNET_free (fn_valid_peers); /* Initialise sampler */ -- cgit v1.2.3