Permalink
Browse files

Assert fail bug in IpTunnel and minor logging.

  • Loading branch information...
1 parent cb6e137 commit 14a054e03df90fb24e99c19deb1ff77a2030bf71 Caleb James DeLisle committed Dec 9, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −0 net/Ducttape.c
  2. +4 −2 tunnel/IpTunnel.c
View
@@ -516,6 +516,7 @@ static inline uint8_t incomingFromTun(struct Message* message,
static uint8_t sendToNode(struct Message* message, struct Interface* iface)
{
struct Ducttape_pvt* context = Identity_cast((struct Ducttape_pvt*)iface->receiverContext);
+ context->switchHeader = NULL;
struct IpTunnel_PacketInfoHeader* header = (struct IpTunnel_PacketInfoHeader*) message->bytes;
Message_shift(message, -IpTunnel_PacketInfoHeader_SIZE);
struct Node* n = RouterModule_lookup(header->nodeIp6Addr, context->routerModule);
View
@@ -143,11 +143,11 @@ static uint8_t sendToNode(struct Message* message,
struct IpTunnel_Connection* connection,
struct IpTunnel_pvt* context)
{
- Message_shift(message, IpTunnel_PacketInfoHeader_SIZE);
- Bits_memcpyConst(message->bytes, &connection->header, IpTunnel_PacketInfoHeader_SIZE);
+ Message_push(message, &connection->header, IpTunnel_PacketInfoHeader_SIZE);
if (context->pub.nodeInterface.receiveMessage) {
return context->pub.nodeInterface.receiveMessage(message, &context->pub.nodeInterface);
}
+ Log_info(context->logger, "Message undeliverable because IpTunnel is not registered");
return Error_UNDELIVERABLE;
}
@@ -586,6 +586,8 @@ static uint8_t incomingFromNode(struct Message* message, struct Interface* nodeI
(struct IpTunnel_pvt*)(((char*)nodeIf) - offsetof(struct IpTunnel, nodeInterface));
Identity_check(context);
+ Log_debug(context->logger, "Got incoming message");
+
Assert_true(message->length >= IpTunnel_PacketInfoHeader_SIZE);
struct IpTunnel_PacketInfoHeader* header = (struct IpTunnel_PacketInfoHeader*) message->bytes;
struct IpTunnel_Connection* conn = connectionByPubKey(header->nodeKey, context);

0 comments on commit 14a054e

Please sign in to comment.