How to pcap dropped packets with PointToPointHelper in NS3

402 Views Asked by At

I was trying to capture the packets in NS3 experiment.

I used PointToPointHelper to use pcap. And, it can capture the normal packets.

PointToPointHelper pointToPoint;
pointToPoint.EnablePcap ("Host", (hosts.Get(0))->GetDevice(1));

But, it cannot capture the packet that I intentionally dropped.

I dropped the packets in RouteInput method. And I just simply return false to drop the packet.

RouteInput(Ptr<Packet> p, Ipv4Header &header, Ptr<const NetDevice> idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) {
...
return false;
}

And I found that pcap didn't capture the dropped packets.

Although, the packet was intentionally dropped by the switch, it did come to the switch. So, I want the packet be capture by pcap.

Is there a way that I can capture the packets that is intentionally dropped?

1

There are 1 best solutions below

0
On

if not work with pcap file, NS3 generate also a .tr file with d operation, which means a packet was dropped.