summaryrefslogtreecommitdiffstats
path: root/src/pre_test.cpp
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-11-24 12:51:59 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-11-24 12:51:59 +0200
commit80fc6e4d8d2eba7c62ba6f688bdbbb56acd4405a (patch)
tree6197998d758f3855372175842200f09f1733fe75 /src/pre_test.cpp
parent79a9fe65a5f3f5251893d90a64a18e297c4ecbb0 (diff)
Fix issue of TRex dropping ARP packets shorter than 60 bytes
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/pre_test.cpp')
-rw-r--r--src/pre_test.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pre_test.cpp b/src/pre_test.cpp
index 583427eb..593d5f07 100644
--- a/src/pre_test.cpp
+++ b/src/pre_test.cpp
@@ -121,6 +121,8 @@ COneIPv6Info *CPretestOnePortInfo::find_ipv6(uint16_t ip[8], uint16_t vlan) {
}
bool CPretestOnePortInfo::get_mac(COneIPInfo *ip, uint8_t *mac) {
+ MacAddress defaultmac;
+
for (std::vector<COneIPInfo *>::iterator it = m_dst_info.begin(); it != m_dst_info.end(); ++it) {
if (ip->ip_ver() != (*it)->ip_ver())
continue;
@@ -139,7 +141,11 @@ bool CPretestOnePortInfo::get_mac(COneIPInfo *ip, uint8_t *mac) {
}
(*it)->get_mac(mac);
- return true;
+ if (! memcmp(mac, defaultmac.GetConstBuffer(), ETHER_ADDR_LEN)) {
+ return false;
+ } else {
+ return true;
+ }
}
return false;
@@ -361,7 +367,7 @@ bool CPretest::is_arp(const uint8_t *p, uint16_t pkt_size, ArpHdr *&arp, uint16_
EthernetHeader *m_ether = (EthernetHeader *)p;
vlan_tag = 0;
- if ((pkt_size < 60) ||
+ if ((pkt_size < sizeof(EthernetHeader)) ||
((m_ether->getNextProtocol() != EthernetHeader::Protocol::ARP)
&& (m_ether->getNextProtocol() != EthernetHeader::Protocol::VLAN)))
return false;