diff options
author | Othmar Gsenger <otti@anytun.org> | 2008-02-29 15:51:43 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2008-02-29 15:51:43 +0000 |
commit | f48852fd961e8cdae2d36fad4dc76ffa1daf1215 (patch) | |
tree | 7f5287008d95786bc946d7061d4bd36ed9f4aeb4 /anytun.cpp | |
parent | routing debug (diff) |
sender early setting of payload type
Diffstat (limited to 'anytun.cpp')
-rw-r--r-- | anytun.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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); |