summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anytun.cpp7
-rw-r--r--encryptedPacket.cpp4
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)