summaryrefslogtreecommitdiff
path: root/anytun.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-29 15:51:43 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-29 15:51:43 +0000
commitf48852fd961e8cdae2d36fad4dc76ffa1daf1215 (patch)
tree7f5287008d95786bc946d7061d4bd36ed9f4aeb4 /anytun.cpp
parentrouting debug (diff)
sender early setting of payload type
Diffstat (limited to 'anytun.cpp')
-rw-r--r--anytun.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/anytun.cpp b/anytun.cpp
index f607790..616e1e2 100644
--- a/anytun.cpp
+++ b/anytun.cpp
@@ -141,6 +141,13 @@ void* sender(void* p)
// read packet from device
u_int32_t len = param->dev.read(plain_packet.getPayload(), plain_packet.getPayloadLength());
plain_packet.setPayloadLength(len);
+ // set payload type
+ if(param->dev.getType() == TunDevice::TYPE_TUN)
+ plain_packet.setPayloadType(PAYLOAD_TYPE_TUN);
+ else if(param->dev.getType() == TunDevice::TYPE_TAP)
+ plain_packet.setPayloadType(PAYLOAD_TYPE_TAP);
+ else
+ plain_packet.setPayloadType(0);
if(param->cl.empty())
continue;
@@ -152,14 +159,6 @@ void* sender(void* p)
continue;
ConnectionParam & conn = cit->second;
- // set payload type
- if(param->dev.getType() == TunDevice::TYPE_TUN)
- plain_packet.setPayloadType(PAYLOAD_TYPE_TUN);
- else if(param->dev.getType() == TunDevice::TYPE_TAP)
- plain_packet.setPayloadType(PAYLOAD_TYPE_TAP);
- else
- plain_packet.setPayloadType(0);
-
// generate packet-key
conn.kd_.generate(LABEL_SATP_ENCRYPTION, conn.seq_nr_, session_key);
conn.kd_.generate(LABEL_SATP_SALT, conn.seq_nr_, session_salt);