bug 2157: OpenFlowSwitchNetDevice::BufferFromPacket setting eth_type incorrectly (patch due to Kang Chen)

This commit is contained in:
Tom Henderson
2015-09-02 16:37:05 -07:00
parent a722fdd7d9
commit 3634c939ce

View File

@@ -466,7 +466,18 @@ OpenFlowSwitchNetDevice::BufferFromPacket (Ptr<const Packet> constPacket, Addres
eth_header* eth_h = (eth_header*)buffer->l2;
dst.CopyTo (eth_h->eth_dst); // Destination Mac Address
src.CopyTo (eth_h->eth_src); // Source Mac Address
eth_h->eth_type = htons (ETH_TYPE_IP); // Ether Type
if (protocol == ArpL3Protocol::PROT_NUMBER)
{
eth_h->eth_type = htons (ETH_TYPE_ARP); // Ether Type
}
else if (protocol == Ipv4L3Protocol::PROT_NUMBER)
{
eth_h->eth_type = htons (ETH_TYPE_IP); // Ether Type
}
else
{
NS_LOG_WARN ("Protocol unsupported: " << protocol);
}
NS_LOG_INFO ("Parsed EthernetHeader");
l2_length = ETH_HEADER_LEN;