summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/common/Network/Packet/IPHeader.h9
-rw-r--r--src/flow_stat_parser.cpp3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/common/Network/Packet/IPHeader.h b/src/common/Network/Packet/IPHeader.h
index da9ba52c..0bf97fbb 100755
--- a/src/common/Network/Packet/IPHeader.h
+++ b/src/common/Network/Packet/IPHeader.h
@@ -91,6 +91,15 @@ public:
*/
inline void setHeaderLength (uint8_t);
+ inline uint16_t getFirstWord(){
+ return PKT_NTOHS(*((uint16_t *)&myVer_HeaderLength));
+ }
+
+ inline void setFirstWord (uint16_t word){
+ *((uint16_t *)&myVer_HeaderLength) = PKT_NTOHS(word);
+ }
+
+
inline uint8_t getTOS ();
inline void setTOS (uint8_t);
diff --git a/src/flow_stat_parser.cpp b/src/flow_stat_parser.cpp
index 7335a6a2..c0813c3e 100644
--- a/src/flow_stat_parser.cpp
+++ b/src/flow_stat_parser.cpp
@@ -27,6 +27,7 @@
#include "common/Network/Packet/TcpHeader.h"
#include "pkt_gen.h"
#include "flow_stat_parser.h"
+#include "bp_sim.h"
void CFlowStatParser::reset() {
m_start = 0;
@@ -120,8 +121,10 @@ int CFlowStatParser::get_ip_id(uint32_t &ip_id) {
int CFlowStatParser::set_ip_id(uint32_t new_id) {
if (m_ipv4) {
// Updating checksum, not recalculating, so if someone put bad checksum on purpose, it will stay bad
+ m_ipv4->updateCheckSum(PKT_NTOHS(m_ipv4->getFirstWord()), PKT_NTOHS(m_ipv4->getFirstWord() |TOS_TTL_RESERVE_DUPLICATE));
m_ipv4->updateCheckSum(PKT_NTOHS(m_ipv4->getId()), PKT_NTOHS(new_id));
m_ipv4->setId(new_id);
+ m_ipv4->setTOS(m_ipv4->getTOS()|TOS_TTL_RESERVE_DUPLICATE);
return 0;
}