summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-06 17:10:00 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-06 17:10:00 +0000
commit6939a82c2108622a84aac4e3a425ed613d393912 (patch)
treee8bfd078da17764204dc77d8ad551f06ca76a2ec
parentreadded kd generate (diff)
fixed wrong payload length bug
-rw-r--r--anytun.cpp2
-rw-r--r--encryptedPacket.cpp2
-rw-r--r--encryptedPacket.h2
-rw-r--r--plainPacket.cpp5
-rw-r--r--plainPacket.h1
5 files changed, 8 insertions, 4 deletions
diff --git a/anytun.cpp b/anytun.cpp
index ebff073..dafc7bf 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -144,10 +144,8 @@ void* sender(void* p)
// read packet from device
u_int32_t len = param->dev.read(plain_packet);
-// std::cout << len << std::endl;
plain_packet.setLength(len);
packet.setLength( len );
-
if( param->cl.empty())
continue;
ConnectionMap::iterator cit = param->cl.getConnection(mux);
diff --git a/encryptedPacket.cpp b/encryptedPacket.cpp
index a8e7a36..eb459e4 100644
--- a/encryptedPacket.cpp
+++ b/encryptedPacket.cpp
@@ -59,7 +59,7 @@ EncryptedPacket::~EncryptedPacket()
length_ = max_length_ + sizeof(struct HeaderStruct);
}
-void EncryptedPacket::setPayloadLength(u_int8_t payload_length)
+void EncryptedPacket::setPayloadLength(u_int32_t payload_length)
{
if( auth_tag_)
length_= payload_length + sizeof(struct HeaderStruct)+AUTHTAG_SIZE;
diff --git a/encryptedPacket.h b/encryptedPacket.h
index 83b831e..0535454 100644
--- a/encryptedPacket.h
+++ b/encryptedPacket.h
@@ -111,7 +111,7 @@ public:
AuthTag getAuthTag() const;
void setAuthTag(AuthTag& tag);
- void setPayloadLength(u_int8_t payload_length);
+ void setPayloadLength(u_int32_t payload_length);
// bool hasHeader() const;
diff --git a/plainPacket.cpp b/plainPacket.cpp
index 50b8280..3ce1521 100644
--- a/plainPacket.cpp
+++ b/plainPacket.cpp
@@ -67,6 +67,11 @@ void PlainPacket::setCompletePayloadLength(u_int32_t payload_length)
length_=complete_payload_length_-sizeof(payload_type_t);
}
+u_int32_t PlainPacket::getCompletePayloadLength()
+{
+ return complete_payload_length_;
+}
+
payload_type_t PlainPacket::getPayloadType() const
{
return PAYLOAD_TYPE_T_NTOH(*payload_type_);
diff --git a/plainPacket.h b/plainPacket.h
index 22664f4..39029c2 100644
--- a/plainPacket.h
+++ b/plainPacket.h
@@ -64,6 +64,7 @@ public:
void setPayloadType(payload_type_t payload_type);
void setCompletePayloadLength(u_int32_t payload_length);
+ u_int32_t getCompletePayloadLength();
/**
* Set the real payload length