[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12327 - in gnunet: . src/core src/dht src/hostlist src/inc
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12327 - in gnunet: . src/core src/dht src/hostlist src/include src/testing src/topology src/transport |
Date: |
Wed, 21 Jul 2010 22:48:40 +0200 |
Author: grothoff
Date: 2010-07-21 22:48:40 +0200 (Wed, 21 Jul 2010)
New Revision: 12327
Modified:
gnunet/TODO
gnunet/src/core/gnunet-service-core.c
gnunet/src/core/test_core_api.c
gnunet/src/core/test_core_api_reliability.c
gnunet/src/dht/gnunet-service-dht.c
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
gnunet/src/include/gnunet_transport_service.h
gnunet/src/testing/testing.c
gnunet/src/topology/gnunet-daemon-topology.c
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/test_transport_api.c
gnunet/src/transport/test_transport_api_reliability.c
gnunet/src/transport/transport.h
gnunet/src/transport/transport_api.c
Log:
add code to enable checking if transport's idea of our peer identity matches
that of core, etc -- might help diagnose certain bugs
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-07-21 16:56:05 UTC (rev 12326)
+++ gnunet/TODO 2010-07-21 20:48:40 UTC (rev 12327)
@@ -22,15 +22,6 @@
* DHT: [Nate]
- implement DHT service
- implement performance tests
-* FS: [CG]
- - service:
- + trust: do not charge when "idle" / load considerations (migration,
routing)
- + artificial delays
- + active reply route caching design & implementation; gap extension!
- - non-anonymous FS service (needs DHT)
- + DHT integration for search
- + CS-DHT-functions (DHT-put of LOC)
- + P2P-functions (DHT-get)
* GNUNET-GTK: [CG]
- implement publish dialog details:
+ open (import directory structure)
@@ -92,9 +83,18 @@
- datacache
- datastore
* FS: [CG]
- - reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME
in fs_download)
- - add support for pushing "already seen" search results to FS service for
bloomfilter (can wait)
- - use different 'priority' for probe downloads vs. normal downloads
+ - library:
+ + reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME
in fs_download)
+ + add support for pushing "already seen" search results to FS service for
bloomfilter (can wait)
+ + use different 'priority' for probe downloads vs. normal downloads
+ - service:
+ + trust: do not charge when "idle" / load considerations (migration,
routing)
+ + artificial delays
+ + active reply route caching design & implementation; gap extension!
+ - non-anonymous FS service (needs DHT)
+ + DHT integration for search
+ + CS-DHT-functions (DHT-put of LOC)
+ + P2P-functions (DHT-get)
- implement FS performance tests
+ insert
+ download
Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c 2010-07-21 16:56:05 UTC (rev
12326)
+++ gnunet/src/core/gnunet-service-core.c 2010-07-21 20:48:40 UTC (rev
12327)
@@ -3878,6 +3878,7 @@
/* setup transport connection */
transport = GNUNET_TRANSPORT_connect (sched,
cfg,
+ &my_identity,
NULL,
&handle_transport_receive,
&handle_transport_notify_connect,
Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c 2010-07-21 16:56:05 UTC (rev 12326)
+++ gnunet/src/core/test_core_api.c 2010-07-21 20:48:40 UTC (rev 12327)
@@ -297,7 +297,7 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
}
Modified: gnunet/src/core/test_core_api_reliability.c
===================================================================
--- gnunet/src/core/test_core_api_reliability.c 2010-07-21 16:56:05 UTC (rev
12326)
+++ gnunet/src/core/test_core_api_reliability.c 2010-07-21 20:48:40 UTC (rev
12327)
@@ -444,7 +444,7 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
}
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-07-21 16:56:05 UTC (rev 12326)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-07-21 20:48:40 UTC (rev 12327)
@@ -2445,7 +2445,8 @@
if (coreAPI == NULL)
return;
- transport_handle = GNUNET_TRANSPORT_connect(sched, cfg, NULL, NULL, NULL,
NULL);
+ transport_handle = GNUNET_TRANSPORT_connect(sched, cfg,
+ NULL, NULL, NULL, NULL, NULL);
if (transport_handle != NULL)
GNUNET_TRANSPORT_get_hello (transport_handle, &process_hello, NULL);
else
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2010-07-21 16:56:05 UTC (rev
12326)
+++ gnunet/src/hostlist/hostlist-client.c 2010-07-21 20:48:40 UTC (rev
12327)
@@ -1528,7 +1528,7 @@
GNUNET_break (0);
return GNUNET_SYSERR;
}
- transport = GNUNET_TRANSPORT_connect (s, c, NULL, NULL, NULL, NULL);
+ transport = GNUNET_TRANSPORT_connect (s, c, NULL, NULL, NULL, NULL, NULL);
if (NULL == transport)
{
curl_global_cleanup ();
Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist.c 2010-07-21 16:56:05 UTC
(rev 12326)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist.c 2010-07-21 20:48:40 UTC
(rev 12327)
@@ -143,7 +143,7 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL,
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL,
¬ify_connect, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
Modified: gnunet/src/include/gnunet_transport_service.h
===================================================================
--- gnunet/src/include/gnunet_transport_service.h 2010-07-21 16:56:05 UTC
(rev 12326)
+++ gnunet/src/include/gnunet_transport_service.h 2010-07-21 20:48:40 UTC
(rev 12327)
@@ -120,6 +120,8 @@
*
* @param sched scheduler to use
* @param cfg configuration to use
+ * @param self our own identity (API should check that it matches
+ * the identity found by transport), or NULL (no check)
* @param cls closure for the callbacks
* @param rec receive function to call
* @param nc function to call on connect events
@@ -131,7 +133,9 @@
*sched,
const struct
GNUNET_CONFIGURATION_Handle
- *cfg, void *cls,
+ *cfg,
+ const struct
GNUNET_PeerIdentity *self,
+ void *cls,
GNUNET_TRANSPORT_ReceiveCallback
rec,
GNUNET_TRANSPORT_NotifyConnect
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2010-07-21 16:56:05 UTC (rev 12326)
+++ gnunet/src/testing/testing.c 2010-07-21 20:48:40 UTC (rev 12327)
@@ -161,7 +161,9 @@
d->th = GNUNET_TRANSPORT_connect (d->sched,
- d->cfg, d, NULL, NULL, NULL);
+ d->cfg,
+ &d->id,
+ d, NULL, NULL, NULL);
if (d->th == NULL)
{
if (GNUNET_YES == d->dead)
@@ -1402,7 +1404,9 @@
#endif
ctx->d2th = GNUNET_TRANSPORT_connect (d2->sched,
- d2->cfg, d2, NULL, NULL, NULL);
+ d2->cfg,
+ &d2->id,
+ d2, NULL, NULL, NULL);
if (ctx->d2th == NULL)
{
GNUNET_CORE_disconnect(ctx->d1core);
@@ -1455,7 +1459,9 @@
}
ctx->d2th = GNUNET_TRANSPORT_connect (ctx->d2->sched,
- ctx->d2->cfg, ctx->d2, NULL, NULL,
NULL);
+ ctx->d2->cfg,
+ &ctx->d2->id,
+ ctx->d2, NULL, NULL, NULL);
if (ctx->d2th == NULL)
{
GNUNET_CORE_disconnect(ctx->d1core);
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2010-07-21 16:56:05 UTC
(rev 12326)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2010-07-21 20:48:40 UTC
(rev 12327)
@@ -1395,6 +1395,7 @@
NULL,
NULL,
NULL,
+ NULL,
NULL);
handle = GNUNET_CORE_connect (sched,
cfg,
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2010-07-21 16:56:05 UTC
(rev 12326)
+++ gnunet/src/transport/gnunet-service-transport.c 2010-07-21 20:48:40 UTC
(rev 12327)
@@ -4673,10 +4673,12 @@
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ const struct StartMessage *start;
struct TransportClient *c;
struct ConnectInfoMessage cim;
struct NeighbourList *n;
+ start = (const struct StartMessage*) message;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' request from client\n", "START");
@@ -4693,6 +4695,17 @@
}
c = c->next;
}
+ if ( (GNUNET_NO != ntohl (start->do_check)) &&
+ (0 != memcmp (&start->self,
+ &my_identity,
+ sizeof (struct GNUNET_PeerIdentity))) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Rejecting control connection from peer `%s', which is not
me!\n"),
+ GNUNET_i2s (&start->self));
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ return;
+ }
c = GNUNET_malloc (sizeof (struct TransportClient));
c->next = clients;
clients = c;
@@ -5239,7 +5252,7 @@
{
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
{&handle_start, NULL,
- GNUNET_MESSAGE_TYPE_TRANSPORT_START, 0},
+ GNUNET_MESSAGE_TYPE_TRANSPORT_START, sizeof (struct StartMessage)},
{&handle_hello, NULL,
GNUNET_MESSAGE_TYPE_HELLO, 0},
{&handle_send, NULL,
Modified: gnunet/src/transport/test_transport_api.c
===================================================================
--- gnunet/src/transport/test_transport_api.c 2010-07-21 16:56:05 UTC (rev
12326)
+++ gnunet/src/transport/test_transport_api.c 2010-07-21 20:48:40 UTC (rev
12327)
@@ -220,7 +220,7 @@
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th = GNUNET_TRANSPORT_connect (sched, p->cfg,
- p,
+ NULL, p,
¬ify_receive,
¬ify_connect, ¬ify_disconnect);
GNUNET_assert (p->th != NULL);
Modified: gnunet/src/transport/test_transport_api_reliability.c
===================================================================
--- gnunet/src/transport/test_transport_api_reliability.c 2010-07-21
16:56:05 UTC (rev 12326)
+++ gnunet/src/transport/test_transport_api_reliability.c 2010-07-21
20:48:40 UTC (rev 12327)
@@ -366,7 +366,7 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg,
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL,
p,
¬ify_receive,
¬ify_connect,
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2010-07-21 16:56:05 UTC (rev 12326)
+++ gnunet/src/transport/transport.h 2010-07-21 20:48:40 UTC (rev 12327)
@@ -48,6 +48,33 @@
/**
* Message from the transport service to the library
+ * asking to check if both processes agree about this
+ * peers identity.
+ */
+struct StartMessage
+{
+
+ /**
+ * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Should the 'self' field be checked?
+ */
+ uint32_t do_check;
+
+ /**
+ * Identity we think we have. If it does not match, the
+ * receiver should print out an error message and disconnect.
+ */
+ struct GNUNET_PeerIdentity self;
+
+};
+
+
+/**
+ * Message from the transport service to the library
* informing about neighbors.
*/
struct ConnectInfoMessage
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2010-07-21 16:56:05 UTC (rev
12326)
+++ gnunet/src/transport/transport_api.c 2010-07-21 20:48:40 UTC (rev
12327)
@@ -278,7 +278,7 @@
/**
* Closure for the callbacks.
*/
- void *cls;
+ void *cls;
/**
* Function to call for received data.
@@ -342,6 +342,11 @@
struct NeighbourList *neighbours;
/**
+ * Peer identity as assumed by this process, or all zeros.
+ */
+ struct GNUNET_PeerIdentity self;
+
+ /**
* ID of the task trying to reconnect to the service.
*/
GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
@@ -363,6 +368,11 @@
*/
int in_disconnect;
+ /**
+ * Should we check that 'self' matches what the service thinks?
+ * (if GNUNET_NO, then 'self' is all zeros!).
+ */
+ int check_self;
};
@@ -1038,7 +1048,8 @@
static size_t
send_start (void *cls, size_t size, void *buf)
{
- struct GNUNET_MessageHeader *s = buf;
+ struct GNUNET_TRANSPORT_Handle *h = cls;
+ struct StartMessage s;
if (buf == NULL)
{
@@ -1054,10 +1065,13 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting `%s' request.\n", "START");
#endif
- GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
- s->size = htons (sizeof (struct GNUNET_MessageHeader));
- s->type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
- return sizeof (struct GNUNET_MessageHeader);
+ GNUNET_assert (size >= sizeof (struct StartMessage));
+ s.header.size = htons (sizeof (struct StartMessage));
+ s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
+ s.do_check = htonl (h->check_self);
+ s.self = h->self;
+ memcpy (buf, &s, sizeof (struct StartMessage));
+ return sizeof (struct StartMessage);
}
@@ -1192,9 +1206,9 @@
pos = pos->next;
}
schedule_control_transmit (h,
- sizeof (struct GNUNET_MessageHeader),
+ sizeof (struct StartMessage),
GNUNET_YES,
- GNUNET_TIME_UNIT_FOREVER_REL, &send_start, NULL);
+ GNUNET_TIME_UNIT_FOREVER_REL, &send_start, h);
GNUNET_CLIENT_receive (h->client,
&demultiplexer, h, GNUNET_TIME_UNIT_FOREVER_REL);
}
@@ -1274,6 +1288,8 @@
*
* @param sched scheduler to use
* @param cfg configuration to use
+ * @param self our own identity (API should check that it matches
+ * the identity found by transport), or NULL (no check)
* @param cls closure for the callbacks
* @param rec receive function to call
* @param nc function to call on connect events
@@ -1282,6 +1298,7 @@
struct GNUNET_TRANSPORT_Handle *
GNUNET_TRANSPORT_connect (struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity *self,
void *cls,
GNUNET_TRANSPORT_ReceiveCallback rec,
GNUNET_TRANSPORT_NotifyConnect nc,
@@ -1290,6 +1307,11 @@
struct GNUNET_TRANSPORT_Handle *ret;
ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Handle));
+ if (self != NULL)
+ {
+ ret->self = *self;
+ ret->check_self = GNUNET_YES;
+ }
ret->sched = sched;
ret->cfg = cfg;
ret->cls = cls;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12327 - in gnunet: . src/core src/dht src/hostlist src/include src/testing src/topology src/transport,
gnunet <=