diff options
author | 2016-11-16 17:40:01 +0200 | |
---|---|---|
committer | 2016-11-16 17:40:01 +0200 | |
commit | 11c216470c30e4c200e46e1b51d721a549f440d6 (patch) | |
tree | 03ad20c67decf7da4d52e5679c2fd22dd8f5eaa6 /src/pkt_gen.cpp | |
parent | e46e3f598e52112b9db21d6faabde7a5c87341cb (diff) | |
parent | efba1bd2c32391c443a9dbaf0fffa6468bb681c6 (diff) |
Merge branch 'master' to rx_features phase 0.5
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'src/pkt_gen.cpp')
-rw-r--r-- | src/pkt_gen.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/pkt_gen.cpp b/src/pkt_gen.cpp index eb9a26f9..45e3a298 100644 --- a/src/pkt_gen.cpp +++ b/src/pkt_gen.cpp @@ -30,7 +30,7 @@ #include <common/Network/Packet/Arp.h> #include "rx_check_header.h" #include "pkt_gen.h" - +#include "bp_sim.h" // For use in tests char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t ttl, uint32_t ip_id, uint16_t flags , uint16_t max_payload, int &pkt_size) { @@ -52,7 +52,7 @@ char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t } uint8_t ip_header[] = { - 0x45,0x02,0x00,0x30, + 0x45,0x03,0x00,0x30, 0x00,0x00,0x40,0x00, 0xff,0x01,0xbd,0x04, 0x10,0x0,0x0,0x1, //SIP @@ -60,7 +60,7 @@ char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t // 0x82, 0x0b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // IP option. change 45 to 48 (header len) if using it. }; uint8_t ipv6_header[] = { - 0x60,0x00,0xff,0x30, // traffic class + flow label + 0x60,0x10,0xff,0x30, // traffic class + flow label 0x00,0x00,0x40,0x00, // payload len + next header + hop limit 0x10,0x0,0x0,0x1,0x10,0x0,0x0,0x1,0x10,0x0,0x0,0x1,0x10,0x0,0x0,0x1, //SIP 0x30,0x0,0x0,0x1,0x10,0x0,0x0,0x1,0x30,0x0,0x0,0x1,0x10,0x0,0x0,0x1, //DIP @@ -222,10 +222,22 @@ char *CTestPktGen::create_test_pkt(uint16_t l3_type, uint16_t l4_proto, uint8_t switch(l3_type) { case EthernetHeader::Protocol::IP: ip->setTimeToLive(ttl); + if (ttl==TTL_RESERVE_DUPLICATE || ttl==(TTL_RESERVE_DUPLICATE-1)) { + ip->setTOS(TOS_TTL_RESERVE_DUPLICATE); + }else{ + ip->setTOS(0x2); + } + ip->updateCheckSum(); break; case EthernetHeader::Protocol::IPv6: ipv6->setHopLimit(ttl); + if (ttl==TTL_RESERVE_DUPLICATE || ttl==(TTL_RESERVE_DUPLICATE-1)) { + ipv6->setTrafficClass(TOS_TTL_RESERVE_DUPLICATE); + }else{ + ipv6->setTrafficClass(0x2); + } + break; } |