From e0b6f7dc5c6b9e4bcfc8bfe30b91bc1d859755f3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 20 Jan 2012 17:47:07 +0000 Subject: [PATCH] -fix getting output from sysctl into service-helper interactions --- src/dns/gnunet-helper-dns.c | 4 ++++ src/exit/gnunet-daemon-exit.c | 6 +++++- src/exit/gnunet-helper-exit.c | 4 ++++ src/util/server_mst.c | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c index 73536c252..22c6ef359 100644 --- a/src/dns/gnunet-helper-dns.c +++ b/src/dns/gnunet-helper-dns.c @@ -173,6 +173,10 @@ fork_and_exec (const char *file, if (0 == pid) { /* we are the child process */ + /* close stdin/stdout to not cause interference + with the helper's main protocol! */ + (void) close (0); + (void) close (1); (void) execv (file, cmd); /* can only get here on error */ fprintf (stderr, diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 9bdfba7da..8e29351f8 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -678,7 +678,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, sbuf, sizeof (sbuf)), (unsigned int) ntohs (tcp->spt), inet_ntop (af, - source_ip, + destination_ip, dbuf, sizeof (dbuf)), (unsigned int) ntohs (tcp->dpt)); } @@ -745,6 +745,10 @@ message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, const struct GNUNET_TUN_Layer2PacketHeader *pkt_tun; size_t size; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Got %u-byte message of type %u from gnunet-helper-exit\n", + ntohs (message->size), + ntohs (message->type)); GNUNET_STATISTICS_update (stats, gettext_noop ("# Packets received from TUN"), 1, GNUNET_NO); diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c index 57944cf61..5a9be473c 100644 --- a/src/exit/gnunet-helper-exit.c +++ b/src/exit/gnunet-helper-exit.c @@ -110,6 +110,10 @@ fork_and_exec (const char *file, if (0 == pid) { /* we are the child process */ + /* close stdin/stdout to not cause interference + with the helper's main protocol! */ + (void) close (0); + (void) close (1); (void) execv (file, cmd); /* can only get here on error */ fprintf (stderr, diff --git a/src/util/server_mst.c b/src/util/server_mst.c index dcb8c4810..026601eb9 100644 --- a/src/util/server_mst.c +++ b/src/util/server_mst.c @@ -31,7 +31,7 @@ #include "gnunet_server_lib.h" #include "gnunet_time_lib.h" -#define DEBUG_SERVER_MST GNUNET_EXTRA_LOGGING +#define DEBUG_SERVER_MST GNUNET_EXTRA_LOGGING #if HAVE_UNALIGNED_64_ACCESS #define ALIGN_FACTOR 4 -- 2.25.1