From 034fee969a22278b2d7bd93a2ad48664ebe69ac0 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 21 Jun 2007 00:42:47 +0000 Subject: first working version lacks still some features --- anytun.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'anytun.cpp') diff --git a/anytun.cpp b/anytun.cpp index 372d2e1..c32c134 100644 --- a/anytun.cpp +++ b/anytun.cpp @@ -107,22 +107,23 @@ void* receiver(void* p) string remote_host; u_int16_t remote_port; Packet pack(1600); - // read packet from socket - int len = param->src->recv(pack, remote_host, remote_port); + u_int32_t len = param->src->recv(pack, remote_host, remote_port); pack.resizeBack(len); + pack.withPayloadType(true).withHeader(true).withAuthTag(true); // check auth_tag and remove it - auth_tag_t at = param->a->calc(pack); - if(at != pack.getAuthTag()) + auth_tag_t at = pack.getAuthTag(); + pack.removeAuthTag(); + if(at != param->a->calc(pack)) continue; - + // compare sender_id and seq with window pack.removeHeader(); - + // decypher the packet param->c->cypher(pack); - + // check payload_type and remove it if((param->dev->getType() == TunDevice::TYPE_TUN && pack.getPayloadType() != PAYLOAD_TYPE_TUN) || (param->dev->getType() == TunDevice::TYPE_TAP && pack.getPayloadType() != PAYLOAD_TYPE_TAP)) -- cgit v1.2.3