summaryrefslogtreecommitdiffstats
path: root/src/latency.h
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-07-06 11:04:52 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-07-12 16:06:02 +0300
commitcc5cc5631e9df4ef0eee9c26705208dfcf035e8c (patch)
treecf43869ae348d02f7b3c1551e88d07d8a3f28a9d /src/latency.h
parentc19193cff9413a03dd85cc9facda0c28b28d37c2 (diff)
NAT seq num randomization working version - Missing some functionality
Diffstat (limited to 'src/latency.h')
-rw-r--r--src/latency.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/latency.h b/src/latency.h
index 724621f0..552b3999 100644
--- a/src/latency.h
+++ b/src/latency.h
@@ -107,19 +107,27 @@ public:
}
// Check if this packet contains NAT info in TCP ack
- inline bool IsNatInfoPkt() {
- if (!m_ipv4 || (m_protocol != IPPROTO_TCP)) {
- return false;
- }
- if (! m_l4 || (m_l4 - rte_pktmbuf_mtod(m_m, uint8_t*) + TCP_HEADER_LEN) > m_m->data_len) {
- return false;
- }
- // If we are here, relevant fields from tcp header are guaranteed to be in first mbuf
- TCPHeader *tcp = (TCPHeader *)m_l4;
- if (!tcp->getSynFlag() || (tcp->getAckNumber() == 0)) {
- return false;
- }
- return true;
+ // first - set to true if this is the first packet of the flow. false otherwise.
+ // relevant only if return value is true
+ inline bool IsNatInfoPkt(bool &first) {
+ if (!m_ipv4 || (m_protocol != IPPROTO_TCP)) {
+ return false;
+ }
+ if (! m_l4 || (m_l4 - rte_pktmbuf_mtod(m_m, uint8_t*) + TCP_HEADER_LEN) > m_m->data_len) {
+ return false;
+ }
+ // If we are here, relevant fields from tcp header are guaranteed to be in first mbuf
+ // We want to handle SYN and SYN+ACK packets
+ TCPHeader *tcp = (TCPHeader *)m_l4;
+ if (! tcp->getSynFlag())
+ return false;
+
+ if (! tcp->getAckFlag()) {
+ first = true;
+ } else {
+ first = false;
+ }
+ return true;
}
public: