How to drop specific packet captured in NS-3 mesh node?

70 views
Skip to first unread message

Caio Marcos Chaves Viana

unread,
May 28, 2023, 7:50:12 PM5/28/23
to ns-3-users
Hi, I'm using NS-3 v3.37 to simulate a WiFi Mesh network.
The grid topology (actually only one line, with IEEE 802.11s stack installed at each node, HWMP protocol) contains 3 WiFi Mesh nodes, Node0, Node1 and Node2. Then I bind a UDP socket (acting as receiver) in Node2, and another (acting as sender) in Node0. Node0 send a UDP packet to Node2 through Node1.

The topology as follow:
Node0 (sender) ---> Node1 ----> Node2 (receiver)

Then I set a MonitorSnifferRx function on Node1 to listen udp packets sent from Node0 to Node2 using Config::ConnectWithoutContext:

Config::ConnectWithoutContext ("/NodeList/1/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&SniffRxPkt));

In Node1 callback function "SniffRxPkt", I want to drop the packet received from Node0 based on an arbitrary condition (e.g. the time that packet was received).

My question is : When a specific UDP packet captured in Node1's MonitorSnifferRx callback function, how can I drop it thus it will not transfer to Node2?

Thanks and Regards,
Caio.

Tommaso Pecorella

unread,
May 31, 2023, 10:13:01 PM5/31/23
to ns-3-users
Hi,

you can't do that (in the MonitorSnifferRx function) because that function uses a copy of the packet. To drop the packet you'll have to modify the HWMP code to add a drop condition. Or you can modify the channel to add a selective packet drop, but that's quite more complex.
Reply all
Reply to author
Forward
0 new messages