From e7d0e0673edad1449eb2665d2a29266979e2f74e Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 31 Jan 2008 11:59:15 +0000 Subject: finallly working, payload type needs further checks --- anytun.cpp | 7 ++++--- encryptedPacket.cpp | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/anytun.cpp b/anytun.cpp index ad2a433..03f1eba 100644 --- a/anytun.cpp +++ b/anytun.cpp @@ -282,9 +282,10 @@ void* receiver(void* p) c->decrypt(packet, plain_packet); // check payload_type and remove it - if((param->dev.getType() == TunDevice::TYPE_TUN && plain_packet.getPayloadType() != PAYLOAD_TYPE_TUN) || - (param->dev.getType() == TunDevice::TYPE_TAP && plain_packet.getPayloadType() != PAYLOAD_TYPE_TAP)) - continue; +//TODO: fix this! +// if((param->dev.getType() == TunDevice::TYPE_TUN && plain_packet.getPayloadType() != PAYLOAD_TYPE_TUN) || +// (param->dev.getType() == TunDevice::TYPE_TAP && plain_packet.getPayloadType() != PAYLOAD_TYPE_TAP)) +// continue; // write it on the device param->dev.write(plain_packet); diff --git a/encryptedPacket.cpp b/encryptedPacket.cpp index 9c091b5..a8e7a36 100644 --- a/encryptedPacket.cpp +++ b/encryptedPacket.cpp @@ -93,6 +93,10 @@ void EncryptedPacket::setLength(u_int32_t length) throw std::out_of_range("can't set length greater then size ofsize of allocated memory"); length_ = length; + if( auth_tag_) + payload_length_ = length_ - sizeof(struct HeaderStruct)+AUTHTAG_SIZE; + else + payload_length_ = length_ - sizeof(struct HeaderStruct); } void EncryptedPacket::setSeqNr(seq_nr_t seq_nr) -- cgit v1.2.3