[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4938 - in GNUnet: . src/applications/advertising src/appli
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4938 - in GNUnet: . src/applications/advertising src/applications/dht/module src/applications/identity src/applications/session src/applications/transport src/include src/server src/transports |
Date: |
Thu, 7 Jun 2007 23:56:02 -0600 (MDT) |
Author: grothoff
Date: 2007-06-07 23:56:01 -0600 (Thu, 07 Jun 2007)
New Revision: 4938
Modified:
GNUnet/src/applications/advertising/advertising.c
GNUnet/src/applications/dht/module/table.c
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_identity_service.h
GNUnet/src/include/gnunet_transport.h
GNUnet/src/server/gnunet-peer-info.c
GNUnet/src/transports/http.c
GNUnet/src/transports/nat.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/udp.c
GNUnet/src/transports/udp6.c
GNUnet/todo
Log:
HELLO sanity checks in identity module, plus helo to hello renaming
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2007-06-08 05:31:24 UTC
(rev 4937)
+++ GNUnet/src/applications/advertising/advertising.c 2007-06-08 05:56:01 UTC
(rev 4938)
@@ -128,12 +128,12 @@
}
static void callAddHost(void * cls) {
- P2P_hello_MESSAGE * helo = cls;
+ P2P_hello_MESSAGE * hello = cls;
if (stats != NULL)
stats->change(stat_hello_verified, 1);
- identity->addHost(helo);
- FREE(helo);
+ identity->addHost(hello);
+ FREE(hello);
}
/**
@@ -152,7 +152,7 @@
P2P_hello_MESSAGE * msg;
MESSAGE_HEADER * ping;
char * buffer;
- int heloEnd;
+ int helloEnd;
int mtu;
int res;
cron_t now;
@@ -231,9 +231,9 @@
/* Then check if we have seen this hello before, if it is identical
except for the TTL, we trust it and do not play PING-PONG */
- copy = identity->identity2Helo(&foreignId,
- ntohs(msg->protocol),
- NO);
+ copy = identity->identity2Hello(&foreignId,
+ ntohs(msg->protocol),
+ NO);
if (NULL != copy) {
if ( (ntohs(copy->senderAddressSize) ==
ntohs(msg->senderAddressSize)) &&
@@ -360,14 +360,14 @@
}
buffer = MALLOC(mtu);
if (mtu > ntohs(ping->size)) {
- heloEnd = transport->getAdvertisedhellos(mtu - ntohs(ping->size),
+ helloEnd = transport->getAdvertisedhellos(mtu - ntohs(ping->size),
buffer);
GE_ASSERT(ectx,
- mtu - ntohs(ping->size) >= heloEnd);
+ mtu - ntohs(ping->size) >= helloEnd);
} else {
- heloEnd = -2;
+ helloEnd = -2;
}
- if (heloEnd <= 0) {
+ if (helloEnd <= 0) {
GE_LOG(ectx,
GE_WARNING | GE_BULK | GE_USER,
_("Failed to create an advertisement for this peer. Will not send
PING.\n"));
@@ -378,17 +378,17 @@
return SYSERR;
}
res = OK;
- memcpy(&buffer[heloEnd],
+ memcpy(&buffer[helloEnd],
ping,
ntohs(ping->size));
- heloEnd += ntohs(ping->size);
+ helloEnd += ntohs(ping->size);
FREE(ping);
/* ok, finally we can send! */
if ( (res == OK) &&
(SYSERR == coreAPI->sendPlaintext(tsession,
buffer,
- heloEnd)) ) {
+ helloEnd)) ) {
if (stats != NULL)
stats->change(stat_hello_send_error, 1);
@@ -417,7 +417,7 @@
int confirmed,
void * cls) {
SendData * sd = cls;
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
TSession * tsession;
int prio;
#if DEBUG_ADVERTISING
@@ -467,20 +467,20 @@
return OK;
/* establish short-lived connection, send, tear down */
- helo = identity->identity2Helo(hi,
- proto,
- NO);
- if (NULL == helo) {
+ hello = identity->identity2Hello(hi,
+ proto,
+ NO);
+ if (NULL == hello) {
#if DEBUG_ADVERTISING
GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
"Exit from `%s' (error: `%s' failed).\n",
__FUNCTION__,
- "identity2Helo");
+ "identity2Hello");
#endif
return OK;
}
- tsession = transport->connect(helo);
- FREE(helo);
+ tsession = transport->connect(hello);
+ FREE(hello);
if (tsession == NULL) {
#if DEBUG_ADVERTISING
GE_LOG(ectx,
@@ -625,9 +625,9 @@
return OK;
if (protocol == NAT_PROTOCOL_NUMBER)
return OK; /* don't forward NAT addresses */
- hello = identity->identity2Helo(peer,
- protocol,
- NO);
+ hello = identity->identity2Hello(peer,
+ protocol,
+ NO);
if (NULL == hello)
return OK; /* this should not happen */
hello->header.type
Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c 2007-06-08 05:31:24 UTC (rev
4937)
+++ GNUnet/src/applications/dht/module/table.c 2007-06-08 05:56:01 UTC (rev
4938)
@@ -572,9 +572,9 @@
peer))
return; /* already have this peer in buckets */
/* do we know how to contact this peer? */
- hello = identity->identity2Helo(peer,
- ANY_PROTOCOL_NUMBER,
- NO);
+ hello = identity->identity2Hello(peer,
+ ANY_PROTOCOL_NUMBER,
+ NO);
if (hello == NULL) {
/* if identity not known, ask sender for HELLO of other peer */
ask.header.size = htons(sizeof(P2P_DHT_ASK_HELLO));
@@ -660,9 +660,9 @@
ask = (const P2P_DHT_ASK_HELLO *) msg;
if (NULL == findBucketFor(&ask->peer))
return OK;
- hello = identity->identity2Helo(&ask->peer,
- ANY_PROTOCOL_NUMBER,
- NO);
+ hello = identity->identity2Hello(&ask->peer,
+ ANY_PROTOCOL_NUMBER,
+ NO);
if (hello == NULL)
return OK;
coreAPI->unicast(sender,
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-06-08 05:31:24 UTC (rev
4937)
+++ GNUnet/src/applications/identity/identity.c 2007-06-08 05:56:01 UTC (rev
4938)
@@ -82,9 +82,9 @@
/**
* hellos for the peer (maybe NULL)!
*/
- P2P_hello_MESSAGE ** helos;
+ P2P_hello_MESSAGE ** hellos;
- unsigned int heloCount;
+ unsigned int helloCount;
/**
* for which protocols is this host known?
@@ -213,8 +213,8 @@
entry->protocols = NULL;
entry->protocolCount = 0;
entry->strict = NO;
- entry->helos = NULL;
- entry->heloCount = 0;
+ entry->hellos = NULL;
+ entry->helloCount = 0;
hash2enc(&identity->hashPubKey,
&fil);
fn = MALLOC(strlen(trustDirectory)+sizeof(EncName)+1);
@@ -401,7 +401,26 @@
GE_ASSERT(ectx, numberOfHosts_ <= sizeOfHosts_);
}
+
/**
+ * Obtain identity from publicPrivateKey.
+ * @param pubKey the public key of the host
+ * @param result address where to write the identity of the node
+ */
+static void getPeerIdentity(const PublicKey * pubKey,
+ PeerIdentity * result) {
+ if (pubKey == NULL) {
+ memset(&result,
+ 0,
+ sizeof(PeerIdentity));
+ } else {
+ hash(pubKey,
+ sizeof(PublicKey),
+ &result->hashPubKey);
+ }
+}
+
+/**
* Add a host to the temporary list.
*/
static void addHostTemporarily(const P2P_hello_MESSAGE * tmp) {
@@ -410,7 +429,16 @@
HostEntry * entry;
int i;
int slot;
+ PeerIdentity have;
+ getPeerIdentity(&msg->publicKey,
+ &have);
+ if (0 != memcmp(&have,
+ &msg->senderIdentity,
+ sizeof(PeerIdentity))) {
+ GE_BREAK(NULL, 0);
+ return;
+ }
msg = MALLOC(P2P_hello_MESSAGE_size(tmp));
memcpy(msg,
tmp,
@@ -433,15 +461,15 @@
entry->identity = msg->senderIdentity;
entry->until = 0;
entry->delta = 0;
- for (i=0;i<entry->heloCount;i++)
- FREE(entry->helos[i]);
- GROW(entry->helos,
- entry->heloCount,
+ for (i=0;i<entry->helloCount;i++)
+ FREE(entry->hellos[i]);
+ GROW(entry->hellos,
+ entry->helloCount,
1);
GROW(entry->protocols,
entry->protocolCount,
1);
- entry->helos[0] = msg;
+ entry->hellos[0] = msg;
entry->protocols[0] = ntohs(msg->protocol);
entry->strict = NO;
entry->trust = 0;
@@ -478,14 +506,14 @@
entry->protocolCount-1);
}
}
- for (j=0;j<entry->heloCount;j++) {
- if (protocol == ntohs(entry->helos[j]->protocol)) {
- FREE(entry->helos[j]);
- entry->helos[j]
- = entry->helos[entry->heloCount-1];
- GROW(entry->helos,
- entry->heloCount,
- entry->heloCount-1);
+ for (j=0;j<entry->helloCount;j++) {
+ if (protocol == ntohs(entry->hellos[j]->protocol)) {
+ FREE(entry->hellos[j]);
+ entry->hellos[j]
+ = entry->hellos[entry->helloCount-1];
+ GROW(entry->hellos,
+ entry->helloCount,
+ entry->helloCount-1);
}
}
/* also remove hello file itself */
@@ -499,11 +527,11 @@
FREE(fn);
if (entry->protocolCount == 0) {
- if (entry->heloCount > 0) {
- for (j=0;j<entry->heloCount;j++)
- FREE(entry->helos[j]);
- GROW(entry->helos,
- entry->heloCount,
+ if (entry->helloCount > 0) {
+ for (j=0;j<entry->helloCount;j++)
+ FREE(entry->hellos[j]);
+ GROW(entry->hellos,
+ entry->helloCount,
0);
}
hosts_[i] = hosts_[--numberOfHosts_];
@@ -519,7 +547,7 @@
}
/**
- * Bind a host address (helo) to a hostId.
+ * Bind a host address (hello) to a hostId.
* @param msg the verified (!) hello message
*/
static void bindAddress(const P2P_hello_MESSAGE * msg) {
@@ -529,7 +557,16 @@
int size;
HostEntry * host;
int i;
+ PeerIdentity have;
+ getPeerIdentity(&msg->publicKey,
+ &have);
+ if (0 != memcmp(&have,
+ &msg->senderIdentity,
+ sizeof(PeerIdentity))) {
+ GE_BREAK(NULL, 0);
+ return;
+ }
GE_ASSERT(ectx,
numberOfHosts_ <= sizeOfHosts_);
GE_ASSERT(ectx,
@@ -567,20 +604,20 @@
GE_ASSERT(ectx,
host != NULL);
- for (i=0;i<host->heloCount;i++) {
- if (msg->protocol == host->helos[i]->protocol) {
- FREE(host->helos[i]);
- host->helos[i] = NULL;
+ for (i=0;i<host->helloCount;i++) {
+ if (msg->protocol == host->hellos[i]->protocol) {
+ FREE(host->hellos[i]);
+ host->hellos[i] = NULL;
break;
}
}
- if (i == host->heloCount)
- GROW(host->helos,
- host->heloCount,
- host->heloCount+1);
- host->helos[i]
+ if (i == host->helloCount)
+ GROW(host->hellos,
+ host->helloCount,
+ host->helloCount+1);
+ host->hellos[i]
= MALLOC(P2P_hello_MESSAGE_size(msg));
- memcpy(host->helos[i],
+ memcpy(host->hellos[i],
msg,
P2P_hello_MESSAGE_size(msg));
MUTEX_UNLOCK(lock_);
@@ -600,13 +637,14 @@
* @param result where to store the result
* @returns SYSERR on failure, OK on success
*/
-static P2P_hello_MESSAGE * identity2Helo(const PeerIdentity * hostId,
+static P2P_hello_MESSAGE * identity2Hello(const PeerIdentity * hostId,
unsigned short protocol,
int tryTemporaryList) {
P2P_hello_MESSAGE * result;
HostEntry * host;
char * fn;
P2P_hello_MESSAGE buffer;
+ PeerIdentity have;
int size;
int i;
int j;
@@ -627,16 +665,16 @@
j = i;
else
j = perm[i];
- if ( (tempHosts[j].heloCount > 0) &&
+ if ( (tempHosts[j].helloCount > 0) &&
(0 == memcmp(hostId,
&tempHosts[j].identity,
sizeof(PeerIdentity))) &&
( (tempHosts[j].protocols[0] == protocol) ||
(protocol == ANY_PROTOCOL_NUMBER) ) ) {
- result = MALLOC(P2P_hello_MESSAGE_size(tempHosts[j].helos[0]));
+ result = MALLOC(P2P_hello_MESSAGE_size(tempHosts[j].hellos[0]));
memcpy(result,
- tempHosts[j].helos[0],
- P2P_hello_MESSAGE_size(tempHosts[j].helos[0]));
+ tempHosts[j].hellos[0],
+ P2P_hello_MESSAGE_size(tempHosts[j].hellos[0]));
MUTEX_UNLOCK(lock_);
FREENONNULL(perm);
return result;
@@ -655,13 +693,13 @@
if (protocol == ANY_PROTOCOL_NUMBER)
protocol = host->protocols[weak_randomi(host->protocolCount)];
- for (i=0;i<host->heloCount;i++) {
- if (ntohs(host->helos[i]->protocol) == protocol) {
+ for (i=0;i<host->helloCount;i++) {
+ if (ntohs(host->hellos[i]->protocol) == protocol) {
result
- = MALLOC(P2P_hello_MESSAGE_size(host->helos[i]));
+ = MALLOC(P2P_hello_MESSAGE_size(host->hellos[i]));
memcpy(result,
- host->helos[i],
- P2P_hello_MESSAGE_size(host->helos[i]));
+ host->hellos[i],
+ P2P_hello_MESSAGE_size(host->hellos[i]));
MUTEX_UNLOCK(lock_);
return result;
}
@@ -684,7 +722,7 @@
if (0 == UNLINK(fn))
GE_LOG(ectx,
GE_WARNING | GE_USER | GE_BULK,
- _("Removed file `%s' containing invalid hello data.\n"),
+ _("Removed file `%s' containing invalid HELLO data.\n"),
fn);
else
GE_LOG_STRERROR_FILE(ectx,
@@ -700,11 +738,19 @@
fn,
P2P_hello_MESSAGE_size(&buffer),
result);
- if ((unsigned int)size != P2P_hello_MESSAGE_size(&buffer)) {
+ getPeerIdentity(&result->publicKey,
+ &have);
+ if ( ((unsigned int)size != P2P_hello_MESSAGE_size(&buffer)) ||
+ (0 != memcmp(&have,
+ hostId,
+ sizeof(PeerIdentity))) ||
+ (0 != memcmp(&have,
+ &result->senderIdentity,
+ sizeof(PeerIdentity))) ) {
if (0 == UNLINK(fn))
GE_LOG(ectx,
GE_WARNING | GE_USER | GE_BULK,
- _("Removed file `%s' containing invalid hello data.\n"),
+ _("Removed file `%s' containing invalid HELLO data.\n"),
fn);
else
GE_LOG_STRERROR_FILE(ectx,
@@ -717,12 +763,12 @@
return NULL;
}
FREE(fn);
- GROW(host->helos,
- host->heloCount,
- host->heloCount+1);
- host->helos[host->heloCount-1]
+ GROW(host->hellos,
+ host->helloCount,
+ host->helloCount+1);
+ host->hellos[host->helloCount-1]
= MALLOC(P2P_hello_MESSAGE_size(&buffer));
- memcpy(host->helos[host->heloCount-1],
+ memcpy(host->hellos[host->helloCount-1],
result,
P2P_hello_MESSAGE_size(&buffer));
MUTEX_UNLOCK(lock_);
@@ -742,13 +788,13 @@
const void * message,
int size,
const Signature * sig) {
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
int res;
- helo = identity2Helo(signer,
+ hello = identity2Hello(signer,
ANY_PROTOCOL_NUMBER,
YES);
- if (helo == NULL) {
+ if (hello == NULL) {
EncName enc;
IF_GELOG(ectx,
@@ -762,12 +808,12 @@
return SYSERR;
}
res = verifySig(message, size, sig,
- &helo->publicKey);
+ &hello->publicKey);
if (res == SYSERR)
GE_LOG(ectx,
GE_ERROR | GE_REQUEST | GE_DEVELOPER | GE_USER,
_("Signature failed verification: signature invalid.\n"));
- FREE(helo);
+ FREE(hello);
return res;
}
@@ -975,7 +1021,7 @@
if (ret != OK)
break;
entry = &tempHosts[i];
- if (entry->heloCount == 0)
+ if (entry->helloCount == 0)
continue;
if ( (now == 0) ||
(now >= entry->until) ) {
@@ -1043,26 +1089,8 @@
}
/**
- * Obtain identity from publicPrivateKey.
- * @param pubKey the public key of the host
- * @param result address where to write the identity of the node
+ * @brief delete expired HELLO entries in data/hosts/
*/
-static void getPeerIdentity(const PublicKey * pubKey,
- PeerIdentity * result) {
- if (pubKey == NULL) {
- memset(&result,
- 0,
- sizeof(PeerIdentity));
- } else {
- hash(pubKey,
- sizeof(PublicKey),
- &result->hashPubKey);
- }
-}
-
-/**
- * @brief Delete expired hosts
- */
static int discardHostsHelper(const char *filename,
const char *dirname,
void *now) {
@@ -1225,9 +1253,9 @@
if (confirmed == NO)
return OK;
- hello = identity2Helo(identity,
- protocol,
- YES);
+ hello = identity2Hello(identity,
+ protocol,
+ YES);
if (hello == NULL)
return OK;
transport = coreAPI->requestService("transport");
@@ -1296,7 +1324,7 @@
id.addHostTemporarily = &addHostTemporarily;
id.addHost = &bindAddress;
id.forEachHost = &forEachHost;
- id.identity2Helo = &identity2Helo;
+ id.identity2Hello = &identity2Hello;
id.verifyPeerSignature = &verifyPeerSignature;
id.blacklistHost = &blacklistHost;
id.isBlacklistedStrict = &isBlacklistedStrict;
@@ -1397,10 +1425,10 @@
&identityRequestInfoHandler);
for (i=0;i<MAX_TEMP_HOSTS;i++) {
entry = &tempHosts[i];
- for (j=0;j<entry->heloCount;j++)
- FREE(entry->helos[j]);
- GROW(entry->helos,
- entry->heloCount,
+ for (j=0;j<entry->helloCount;j++)
+ FREE(entry->hellos[j]);
+ GROW(entry->hellos,
+ entry->helloCount,
0);
GROW(entry->protocols,
entry->protocolCount,
@@ -1423,10 +1451,10 @@
lock_ = NULL;
for (i=0;i<numberOfHosts_;i++) {
entry = hosts_[i];
- for (j=0;j<entry->heloCount;j++)
- FREE(entry->helos[j]);
- GROW(entry->helos,
- entry->heloCount,
+ for (j=0;j<entry->helloCount;j++)
+ FREE(entry->hellos[j]);
+ GROW(entry->hellos,
+ entry->helloCount,
0);
GROW(entry->protocols,
entry->protocolCount,
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2007-06-08 05:31:24 UTC (rev
4937)
+++ GNUnet/src/applications/session/connect.c 2007-06-08 05:56:01 UTC (rev
4938)
@@ -306,9 +306,9 @@
PeerIdentity hc;
GE_ASSERT(ectx, sk != NULL);
- foreignHello = identity->identity2Helo(hostId,
- ANY_PROTOCOL_NUMBER,
- YES);
+ foreignHello = identity->identity2Hello(hostId,
+ ANY_PROTOCOL_NUMBER,
+ YES);
/* create and encrypt sessionkey */
if (NULL == foreignHello) {
hash2enc(&hostId->hashPubKey,
@@ -319,15 +319,22 @@
&enc);
return NULL; /* other host not known */
}
- hash(&foreignHello->publicKey,
- sizeof(PublicKey),
- &hc.hashPubKey);
+ identity->getPeerIdentity(&foreignHello->publicKey,
+ &hc);
if ( (0 != memcmp(&hc,
&hostId,
sizeof(PeerIdentity))) ||
(0 != memcmp(&hc,
&foreignHello->senderIdentity,
sizeof(PeerIdentity))) ) {
+ GE_BREAK(NULL,
+ (0 != memcmp(&hc,
+ &foreignHello->senderIdentity,
+ sizeof(PeerIdentity))));
+ GE_BREAK(NULL,
+ 0 == memcmp(&hc,
+ &hostId,
+ sizeof(PeerIdentity)));
GE_BREAK(NULL, 0);
FREE(foreignHello);
return NULL;
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2007-06-08 05:31:24 UTC
(rev 4937)
+++ GNUnet/src/applications/transport/transport.c 2007-06-08 05:56:01 UTC
(rev 4938)
@@ -44,7 +44,7 @@
static unsigned int tapis_count = 0;
-static unsigned long long helo_live;
+static unsigned long long hello_live;
static struct MUTEX * tapis_lock;
@@ -56,7 +56,7 @@
/**
* Create signed hello for this transport and put it into
- * the cache tapi->helo.
+ * the cache tapi->hello.
*/
static void createSignedhello(void * cls) {
TransportAPI * tapi = cls;
@@ -74,7 +74,7 @@
coreAPI->myIdentity,
sizeof(PeerIdentity));
tapi->hello->expirationTime
- = htonl(TIME(NULL) + helo_live);
+ = htonl(TIME(NULL) + hello_live);
tapi->hello->header.type
= htons(p2p_PROTO_hello);
tapi->hello->header.size
@@ -172,7 +172,7 @@
* transport layer. This may fail if the appropriate
* transport mechanism is not available.
*
- * @param helo the hello of the target node. The
+ * @param hello the hello of the target node. The
* callee is responsible for freeing the hello (!), except
* if SYSERR is returned!
* @return OK on success, SYSERR on error
@@ -215,7 +215,7 @@
for (i=0;i<tapis_count;i++) {
if (tapis[perm[i]] == NULL)
continue;
- hello = identity->identity2Helo(peer,
+ hello = identity->identity2Hello(peer,
perm[i],
useTempList);
if (hello == NULL)
@@ -326,18 +326,18 @@
* @return OK if the attempt to verify is on the way,
* SYSERR if the transport mechanism is not supported
*/
-static int transportVerifyHelo(const P2P_hello_MESSAGE * helo) {
+static int transportVerifyHello(const P2P_hello_MESSAGE * hello) {
unsigned short prot;
- prot = ntohs(helo->protocol);
+ prot = ntohs(hello->protocol);
if ( (prot == NAT_PROTOCOL_NUMBER) &&
- ( (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) ) )
+ ( (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
+ (ntohs(hello->header.type) != p2p_PROTO_hello) ) )
return SYSERR; /* invalid */
- if ( (ntohs(helo->protocol) >= tapis_count) ||
+ if ( (ntohs(hello->protocol) >= tapis_count) ||
(tapis[prot] == NULL) )
return SYSERR; /* not supported */
- return tapis[prot]->verifyHelo(helo);
+ return tapis[prot]->verifyHello(hello);
}
/**
@@ -357,7 +357,7 @@
static P2P_hello_MESSAGE *
transportCreatehello(unsigned short ttype) {
TransportAPI * tapi;
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
MUTEX_LOCK(tapis_lock);
if (ttype == ANY_PROTOCOL_NUMBER) {
@@ -392,12 +392,12 @@
MUTEX_UNLOCK(tapis_lock);
return NULL; /* send-only transport */
}
- helo = MALLOC(P2P_hello_MESSAGE_size(tapi->hello));
- memcpy(helo,
+ hello = MALLOC(P2P_hello_MESSAGE_size(tapi->hello));
+ memcpy(hello,
tapi->hello,
P2P_hello_MESSAGE_size(tapi->hello));
MUTEX_UNLOCK(tapis_lock);
- return helo;
+ return hello;
}
/**
@@ -417,7 +417,7 @@
char * buff) {
int i;
int tcount;
- P2P_hello_MESSAGE ** helos;
+ P2P_hello_MESSAGE ** hellos;
int used;
MUTEX_LOCK(tapis_lock);
@@ -426,12 +426,12 @@
if (tapis[i] != NULL)
tcount++;
- helos = MALLOC(tcount * sizeof(P2P_hello_MESSAGE*));
+ hellos = MALLOC(tcount * sizeof(P2P_hello_MESSAGE*));
tcount = 0;
for (i=0;i<tapis_count;i++) {
if (tapis[i] != NULL) {
- helos[tcount] = transportCreatehello(i);
- if (NULL != helos[tcount])
+ hellos[tcount] = transportCreatehello(i);
+ if (NULL != hellos[tcount])
tcount++;
}
}
@@ -440,24 +440,24 @@
GE_LOG(ectx,
GE_INFO | GE_USER | GE_REQUEST,
_("No transport succeeded in creating a hello!\n"));
- FREE(helos);
+ FREE(hellos);
return SYSERR;
}
used = 0;
while (tcount > 0) {
i = weak_randomi(tcount); /* select a hello at random */
- if ((unsigned int)P2P_hello_MESSAGE_size(helos[i]) <= maxLen - used) {
+ if ((unsigned int)P2P_hello_MESSAGE_size(hellos[i]) <= maxLen - used) {
memcpy(&buff[used],
- helos[i],
- P2P_hello_MESSAGE_size(helos[i]));
- used += P2P_hello_MESSAGE_size(helos[i]);
+ hellos[i],
+ P2P_hello_MESSAGE_size(hellos[i]));
+ used += P2P_hello_MESSAGE_size(hellos[i]);
}
- FREE(helos[i]);
- helos[i] = helos[--tcount];
+ FREE(hellos[i]);
+ hellos[i] = hellos[--tcount];
}
for (i=0;i<tcount;i++)
- FREE(helos[i]);
- FREE(helos);
+ FREE(hellos[i]);
+ FREE(hellos);
if (used == 0)
GE_LOG(ectx,
GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
@@ -468,13 +468,13 @@
static void initHello(void * cls) {
TransportAPI * tapi = cls;
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
createSignedhello(tapi);
- helo = transportCreatehello(tapi->protocolNumber);
- if (NULL != helo) {
- identity->addHost(helo);
- FREE(helo);
+ hello = transportCreatehello(tapi->protocolNumber);
+ if (NULL != hello) {
+ identity->addHost(hello);
+ FREE(hello);
}
}
@@ -601,9 +601,9 @@
1,
MAX_HELLO_EXPIRES / 60,
60,
- &helo_live))
+ &hello_live))
return NULL;
- helo_live *= 60;
+ hello_live *= 60;
GE_ASSERT(ectx,
sizeof(P2P_hello_MESSAGE) == 600);
@@ -725,7 +725,7 @@
ret.getCost = &transportGetCost;
ret.send = &transportSend;
ret.disconnect = &transportDisconnect;
- ret.verifyhello = &transportVerifyHelo;
+ ret.verifyhello = &transportVerifyHello;
ret.helloToString = &helloToString;
ret.getMTU = &transportGetMTU;
ret.createhello = &transportCreatehello;
Modified: GNUnet/src/include/gnunet_identity_service.h
===================================================================
--- GNUnet/src/include/gnunet_identity_service.h 2007-06-08 05:31:24 UTC
(rev 4937)
+++ GNUnet/src/include/gnunet_identity_service.h 2007-06-08 05:56:01 UTC
(rev 4938)
@@ -146,9 +146,9 @@
* ANY_PROTOCOL_NUMBER if we do not care which protocol
* @return NULL on failure, the hello on success
*/
- P2P_hello_MESSAGE * (*identity2Helo)(const PeerIdentity * hostId,
- unsigned short protocol,
- int tryTemporaryList);
+ P2P_hello_MESSAGE * (*identity2Hello)(const PeerIdentity * hostId,
+ unsigned short protocol,
+ int tryTemporaryList);
/**
*
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2007-06-08 05:31:24 UTC (rev
4937)
+++ GNUnet/src/include/gnunet_transport.h 2007-06-08 05:56:01 UTC (rev
4938)
@@ -230,7 +230,7 @@
* (the signature/crc have been verified before)
* @return OK if the helo is well-formed
*/
- int (*verifyHelo)(const P2P_hello_MESSAGE * hello);
+ int (*verifyHello)(const P2P_hello_MESSAGE * hello);
/**
* Create a hello-Message for the current node. The hello is
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2007-06-08 05:31:24 UTC (rev
4937)
+++ GNUnet/src/server/gnunet-peer-info.c 2007-06-08 05:56:01 UTC (rev
4938)
@@ -69,7 +69,7 @@
const unsigned short proto,
int verified,
void * data) {
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
char * info;
EncName enc;
@@ -77,27 +77,27 @@
return SYSERR;
hash2enc(&id->hashPubKey,
&enc);
- helo = identity->identity2Helo(id,
- proto,
- NO);
- if (NULL == helo) {
+ hello = identity->identity2Hello(id,
+ proto,
+ NO);
+ if (NULL == hello) {
GE_LOG(ectx,
GE_WARNING | GE_BULK | GE_USER,
_("Could not get address of peer `%s'.\n"),
&enc);
return OK;
}
- if (SYSERR == verifySig(&helo->senderIdentity,
- P2P_hello_MESSAGE_size(helo) - sizeof(Signature) -
sizeof(PublicKey) - sizeof(MESSAGE_HEADER),
- &helo->signature,
- &helo->publicKey)) {
+ if (SYSERR == verifySig(&hello->senderIdentity,
+ P2P_hello_MESSAGE_size(hello) - sizeof(Signature) -
sizeof(PublicKey) - sizeof(MESSAGE_HEADER),
+ &hello->signature,
+ &hello->publicKey)) {
GE_LOG(ectx,
GE_WARNING | GE_BULK | GE_USER,
_("hello message invalid (signature invalid).\n"));
}
- info = transport->helloToString(helo,
+ info = transport->helloToString(hello,
! no_resolve);
- FREE(helo);
+ FREE(hello);
if (info == NULL) {
GE_LOG(ectx,
GE_WARNING | GE_BULK | GE_USER,
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/http.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -398,14 +398,14 @@
* (the signature/crc have been verified before)
* @return OK on success, SYSERR on error
*/
-static int verifyHelo(const P2P_hello_MESSAGE * helo) {
+static int verifyHello(const P2P_hello_MESSAGE * hello) {
const HostAddress * haddr;
- haddr = (const HostAddress*) &helo[1];
- if ( (ntohs(helo->senderAddressSize) != sizeof(HostAddress)) ||
- (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) ||
- (ntohs(helo->protocol) != HTTP_PROTOCOL_NUMBER) ||
+ haddr = (const HostAddress*) &hello[1];
+ if ( (ntohs(hello->senderAddressSize) != sizeof(HostAddress)) ||
+ (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
+ (ntohs(hello->header.type) != p2p_PROTO_hello) ||
+ (ntohs(hello->protocol) != HTTP_PROTOCOL_NUMBER) ||
(MHD_NO == acceptPolicyCallback(NULL,
(const struct sockaddr*) haddr,
sizeof(IPaddr))) )
@@ -756,13 +756,13 @@
/**
* Establish a connection to a remote node.
*
- * @param helo the hello-Message for the target node
+ * @param hello the hello-Message for the target node
* @param tsessionPtr the session handle that is set
* @return OK on success, SYSERR if the operation failed
*/
-static int httpConnect(const P2P_hello_MESSAGE * helo,
+static int httpConnect(const P2P_hello_MESSAGE * hello,
TSession ** tsessionPtr) {
- const HostAddress * haddr = (const HostAddress*) &helo[1];
+ const HostAddress * haddr = (const HostAddress*) &hello[1];
TSession * tsession;
HTTPSession * httpSession;
CURL * curl_get;
@@ -775,7 +775,7 @@
if (curl_get == NULL)
return SYSERR;
- hash2enc(&helo->senderIdentity.hashPubKey,
+ hash2enc(&hello->senderIdentity.hashPubKey,
&enc);
url = MALLOC(64 + sizeof(EncName));
SNPRINTF(url,
@@ -842,7 +842,7 @@
httpSession->woff = 0;
httpSession->wpos = 0;
httpSession->wbuff = NULL;
- httpSession->sender = helo->senderIdentity;
+ httpSession->sender = hello->senderIdentity;
httpSession->lock = MUTEX_CREATE(YES);
httpSession->users = 1; /* us only, core has not seen this tsession! */
httpSession->lastUse = get_time();
@@ -1268,7 +1268,7 @@
httpAPI.protocolNumber = HTTP_PROTOCOL_NUMBER;
httpAPI.mtu = 0;
httpAPI.cost = 20000; /* about equal to udp */
- httpAPI.verifyHelo = &verifyHelo;
+ httpAPI.verifyHello = &verifyHello;
httpAPI.createhello = &createhello;
httpAPI.connect = &httpConnect;
httpAPI.associate = &httpAssociate;
Modified: GNUnet/src/transports/nat.c
===================================================================
--- GNUnet/src/transports/nat.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/nat.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -53,14 +53,14 @@
* Verify that a hello-Message is correct (a node is reachable at that
* address).
*
- * @param helo the hello message to verify
+ * @param hello the hello message to verify
* (the signature/crc have been verified before)
* @return OK on success, SYSERR on failure
*/
-static int verifyHelo(const P2P_hello_MESSAGE * helo) {
- if ( (ntohs(helo->senderAddressSize) != sizeof(HostAddress)) ||
- (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) ) {
+static int verifyHello(const P2P_hello_MESSAGE * hello) {
+ if ( (ntohs(hello->senderAddressSize) != sizeof(HostAddress)) ||
+ (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
+ (ntohs(hello->header.type) != p2p_PROTO_hello) ) {
return SYSERR; /* obviously invalid */
} else {
if (YES == GC_get_configuration_value_yesno(coreAPI->cfg,
@@ -70,7 +70,7 @@
/* if WE are a NAT and this is not our hello,
it is invalid since NAT-to-NAT is not possible! */
if (0 == memcmp(&coreAPI->myIdentity->hashPubKey,
- &helo->senderIdentity.hashPubKey,
+ &hello->senderIdentity.hashPubKey,
sizeof(HashCode512)))
return OK;
else
@@ -104,11 +104,11 @@
/**
* Establish a connection to a remote node.
- * @param helo the hello-Message for the target node
+ * @param hello the hello-Message for the target node
* @param tsessionPtr the session handle that is to be set
* @return always fails (returns SYSERR)
*/
-static int natConnect(const P2P_hello_MESSAGE * helo,
+static int natConnect(const P2P_hello_MESSAGE * hello,
TSession ** tsessionPtr) {
return SYSERR;
}
@@ -193,8 +193,8 @@
natAPI.protocolNumber = NAT_PROTOCOL_NUMBER;
natAPI.mtu = 0;
natAPI.cost = 30000;
- natAPI.verifyHelo = &verifyHelo;
- natAPI.createhello = &createhello;
+ natAPI.verifyHello = &verifyHello;
+ natAPI.createhello = &createhello;
natAPI.connect = &natConnect;
natAPI.send = &natSend;
natAPI.associate = &natAssociate;
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/tcp.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -608,7 +608,7 @@
tcpAPI.protocolNumber = TCP_PROTOCOL_NUMBER;
tcpAPI.mtu = 0;
tcpAPI.cost = 20000; /* about equal to udp */
- tcpAPI.verifyHelo = &verifyHelo;
+ tcpAPI.verifyHello = &verifyHelo;
tcpAPI.createhello = &createhello;
tcpAPI.connect = &tcpConnect;
tcpAPI.associate = &tcpAssociate;
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/tcp6.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -174,18 +174,18 @@
* is reachable at that address). Since the reply
* will be asynchronous, a method must be called on
* success.
- * @param helo the hello message to verify
+ * @param hello the hello message to verify
* (the signature/crc have been verified before)
* @return OK on success, SYSERR on error
*/
-static int verifyHelo(const P2P_hello_MESSAGE * helo) {
+static int verifyHello(const P2P_hello_MESSAGE * hello) {
Host6Address * haddr;
- haddr = (Host6Address*) &helo[1];
- if ( (ntohs(helo->senderAddressSize) != sizeof(Host6Address)) ||
- (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) ||
- (ntohs(helo->protocol) != TCP6_PROTOCOL_NUMBER) ||
+ haddr = (Host6Address*) &hello[1];
+ if ( (ntohs(hello->senderAddressSize) != sizeof(Host6Address)) ||
+ (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
+ (ntohs(hello->header.type) != p2p_PROTO_hello) ||
+ (ntohs(hello->protocol) != TCP6_PROTOCOL_NUMBER) ||
(YES == isBlacklisted(&haddr->ip,
sizeof(IP6addr))) ||
(YES != isWhitelisted(&haddr->ip,
@@ -237,11 +237,11 @@
/**
* Establish a connection to a remote node.
*
- * @param helo the hello-Message for the target node
+ * @param hello the hello-Message for the target node
* @param tsessionPtr the session handle that is set
* @return OK on success, SYSERR if the operation failed
*/
-static int tcp6Connect(const P2P_hello_MESSAGE * helo,
+static int tcp6Connect(const P2P_hello_MESSAGE * hello,
TSession ** tsessionPtr) {
int i;
Host6Address * haddr;
@@ -253,7 +253,7 @@
if (selector == NULL)
return SYSERR;
- haddr = (Host6Address*) &helo[1];
+ haddr = (Host6Address*) &hello[1];
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
hints.ai_socktype = SOCK_STREAM;
@@ -325,7 +325,7 @@
if (sock == -1)
return SYSERR;
GE_ASSERT(ectx, s != NULL);
- return tcpConnectHelper(helo,
+ return tcpConnectHelper(hello,
s,
tcp6API.protocolNumber,
tsessionPtr);
@@ -553,7 +553,7 @@
tcp6API.protocolNumber = TCP6_PROTOCOL_NUMBER;
tcp6API.mtu = 0;
tcp6API.cost = 19950; /* about equal to udp6 */
- tcp6API.verifyHelo = &verifyHelo;
+ tcp6API.verifyHello = &verifyHello;
tcp6API.createhello = &createhello;
tcp6API.connect = &tcp6Connect;
tcp6API.associate = &tcpAssociate;
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/udp.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -220,7 +220,7 @@
* (the signature/crc have been verified before)
* @return OK on success, SYSERR on failure
*/
-static int verifyHelo(const P2P_hello_MESSAGE * hello) {
+static int verifyHello(const P2P_hello_MESSAGE * hello) {
const HostAddress * haddr;
haddr = (const HostAddress*) &hello[1];
@@ -232,15 +232,14 @@
(YES != isWhitelisted(&haddr->senderIP,
sizeof(IPaddr))) )
return SYSERR; /* obviously invalid */
- else {
#if DEBUG_UDP
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_BULK,
- "Verified UDP hello from %u.%u.%u.%u:%u.\n",
- PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
- ntohs(haddr->senderPort));
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_BULK,
+ "Verified UDP HELLO from %u.%u.%u.%u:%u.\n",
+ PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
+ ntohs(haddr->senderPort));
#endif
- return OK;
- }
+ return OK;
}
/**
@@ -586,7 +585,7 @@
udpAPI.protocolNumber = UDP_PROTOCOL_NUMBER;
udpAPI.mtu = mtu - sizeof(UDPMessage);
udpAPI.cost = 20000;
- udpAPI.verifyHelo = &verifyHelo;
+ udpAPI.verifyHello = &verifyHello;
udpAPI.createhello = &createhello;
udpAPI.connect = &udpConnect;
udpAPI.send = &udpSend;
Modified: GNUnet/src/transports/udp6.c
===================================================================
--- GNUnet/src/transports/udp6.c 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/src/transports/udp6.c 2007-06-08 05:56:01 UTC (rev 4938)
@@ -208,17 +208,17 @@
* address). Since the reply will be asynchronous, a method must be
* called on success.
*
- * @param helo the hello message to verify
+ * @param hello the hello message to verify
* (the signature/crc have been verified before)
* @return OK on success, SYSERR on failure
*/
-static int verifyHelo(const P2P_hello_MESSAGE * helo) {
+static int verifyHello(const P2P_hello_MESSAGE * hello) {
Host6Address * haddr;
- haddr = (Host6Address*) &helo[1];
- if ( (ntohs(helo->senderAddressSize) != sizeof(Host6Address)) ||
- (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) ||
+ haddr = (Host6Address*) &hello[1];
+ if ( (ntohs(hello->senderAddressSize) != sizeof(Host6Address)) ||
+ (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
+ (ntohs(hello->header.type) != p2p_PROTO_hello) ||
(YES == isBlacklisted(&haddr->senderIP,
sizeof(IP6addr))) ||
(YES != isWhitelisted(&haddr->senderIP,
@@ -228,7 +228,7 @@
#if DEBUG_UDP6
char inet6[INET6_ADDRSTRLEN];
GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Verified UDP6 helo from %u.%u.%u.%u:%u.\n",
+ "Verified UDP6 hello from %u.%u.%u.%u:%u.\n",
inet_ntop(AF_INET6,
&haddr->senderIP,
inet6,
@@ -288,7 +288,7 @@
const unsigned int size,
int importance) {
UDPMessage * mp;
- P2P_hello_MESSAGE * helo;
+ P2P_hello_MESSAGE * hello;
Host6Address * haddr;
struct sockaddr_in6 sin; /* an Internet endpoint address */
int ok;
@@ -307,11 +307,11 @@
GE_BREAK(ectx, 0);
return SYSERR;
}
- helo = (P2P_hello_MESSAGE*)tsession->internal;
- if (helo == NULL)
+ hello = (P2P_hello_MESSAGE*)tsession->internal;
+ if (hello == NULL)
return SYSERR;
- haddr = (Host6Address*) &helo[1];
+ haddr = (Host6Address*) &hello[1];
ssize = size + sizeof(UDPMessage);
mp = MALLOC(ssize);
mp->header.size = htons(ssize);
@@ -548,7 +548,7 @@
udpAPI.protocolNumber = UDP6_PROTOCOL_NUMBER;
udpAPI.mtu = mtu - sizeof(UDPMessage);
udpAPI.cost = 19950;
- udpAPI.verifyHelo = &verifyHelo;
+ udpAPI.verifyHello = &verifyHello;
udpAPI.createhello = &createhello;
udpAPI.connect = &udpConnect;
udpAPI.send = &udp6Send;
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2007-06-08 05:31:24 UTC (rev 4937)
+++ GNUnet/todo 2007-06-08 05:56:01 UTC (rev 4938)
@@ -10,8 +10,9 @@
- RC bugs:
* UDP assertion failure (mtu < size) [#1209]
* low connectivity (NAT? real issue?)
+ - session keys sent to wrong peers?
+ - likely related: gnunet.org's Decrypting message failed errors!?
- gnunet-transport-check -t udp -p fails consistently even in ideal
network!?
- - possibly related: gnunet.org's Decrypting message failed errors!?
0.7.3 [7'07] (aka "features"):
- chat support basics [RC]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4938 - in GNUnet: . src/applications/advertising src/applications/dht/module src/applications/identity src/applications/session src/applications/transport src/include src/server src/transports,
gnunet <=