summaryrefslogtreecommitdiffstats
path: root/src/test_pkt_gen.cpp
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-09-26 16:26:37 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-10-05 10:45:28 +0300
commit2223955b8eb3b378c1ab79e3735ed340852b04b9 (patch)
tree334b533001dd013a5e5293f61b835341fdf1f300 /src/test_pkt_gen.cpp
parenta42bf7bc43e78e63c266c22cccf15ce3f4cab297 (diff)
pre test: Some small fixes
Diffstat (limited to 'src/test_pkt_gen.cpp')
-rw-r--r--src/test_pkt_gen.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/test_pkt_gen.cpp b/src/test_pkt_gen.cpp
index 14547c41..502e84dc 100644
--- a/src/test_pkt_gen.cpp
+++ b/src/test_pkt_gen.cpp
@@ -21,13 +21,13 @@
#include <assert.h>
#include <netinet/in.h>
-#include <rte_arp.h>
#include <common/Network/Packet/TcpHeader.h>
#include <common/Network/Packet/UdpHeader.h>
#include <common/Network/Packet/IcmpHeader.h>
#include <common/Network/Packet/IPHeader.h>
#include <common/Network/Packet/IPv6Header.h>
#include <common/Network/Packet/EthernetHeader.h>
+#include <common/Network/Packet/Arp.h>
#include "rx_check_header.h"
#include "test_pkt_gen.h"
@@ -267,18 +267,18 @@ void CTestPktGen::create_arp_req(uint8_t *pkt, uint32_t sip, uint32_t tip, uint8
memcpy(pkt, &l2_proto, sizeof(l2_proto));
pkt += 2;
- struct arp_hdr *arp = (struct arp_hdr *)pkt;
- arp->arp_hrd = htons(ARP_HRD_ETHER); // Format of hardware address
- arp->arp_pro = htons(EthernetHeader::Protocol::IP); // Format of protocol address
- arp->arp_hln = ETHER_ADDR_LEN; // Length of hardware address
- arp->arp_pln = 4; // Length of protocol address
- arp->arp_op = htons(ARP_OP_REQUEST); // ARP opcode (command)
+ ArpHdr *arp = (ArpHdr *)pkt;
+ arp->m_arp_hrd = htons(ArpHdr::ARP_HDR_HRD_ETHER); // Format of hardware address
+ arp->m_arp_pro = htons(EthernetHeader::Protocol::IP); // Format of protocol address
+ arp->m_arp_hln = ETHER_ADDR_LEN; // Length of hardware address
+ arp->m_arp_pln = 4; // Length of protocol address
+ arp->m_arp_op = htons(ArpHdr::ARP_HDR_OP_REQUEST); // ARP opcode (command)
- memcpy(&arp->arp_data.arp_sha, src_mac, ETHER_ADDR_LEN); // Sender MAC address
- arp->arp_data.arp_sip = htonl(sip); // Sender IP address
+ memcpy(&arp->m_arp_sha.data, src_mac, ETHER_ADDR_LEN); // Sender MAC address
+ arp->m_arp_sip = htonl(sip); // Sender IP address
uint8_t magic[5] = {0x1, 0x3, 0x5, 0x7, 0x9};
- memcpy(&arp->arp_data.arp_tha, magic, 5); // Target MAC address
- arp->arp_data.arp_tha.addr_bytes[5] = port;
- arp->arp_data.arp_tip = htonl(tip);
+ memcpy(&arp->m_arp_tha.data, magic, 5); // Target MAC address
+ arp->m_arp_tha.data[5] = port;
+ arp->m_arp_tip = htonl(tip);
}