aregm / nff-go

NFF-Go -Network Function Framework for GO (former YANFF)
BSD 3-Clause "New" or "Revised" License
1.38k stars 156 forks source link

IP Reassembly not working. #645

Closed shahrukh668 closed 5 years ago

shahrukh668 commented 5 years ago

I am trying to do IP Reassembly using Chained Reassembly but it doesn't reassemble/forward any packets. I am using the following pcap attached.

I am forwarding packets received on one interface to another interface without performing any actions on them. When I don't use ChainedReassembly packets are forwarded successfully but when I set ChainedReassembly to true, no packets are forwarded neither fragmented nor normal packets.

frag_http_req.zip

gshimansky commented 5 years ago

I just checked with your pcap file. I used pktgen to stream it to my forwarding application. I modified it to enable chained reassembly

diff --git a/examples/forwarding/forwarding.go b/examples/forwarding/forwarding.go
index cfbd18f..a0249b4 100644
--- a/examples/forwarding/forwarding.go
+++ b/examples/forwarding/forwarding.go
@@ -33,6 +33,7 @@ func main() {
        // Initialize NFF-GO library at 16 cores by default
        config := flow.Config{
                StatsHTTPAddress: statsServerAddres,
+                ChainedReassembly: true,
        }
        flow.CheckFatal(flow.SystemInit(&config))

and I am getting packets just fine on a target system. Could it be that MAC addresses have to be corrected in forwarded packets?

shahrukh668 commented 5 years ago

Are the packets being reassembled? Cuz I am not getting any. I tried a different pcap, where every packet was only fragmented into two parts, and they were successfully reassembled and forwarded. But for the pcap i uploaded it doesn't work. Is it because maybe dpdk has a limit on max number of fragments per packet that it can reassemble ? stream limit

shahrukh668 commented 5 years ago

Figured out why I wasn't getting any reassembled packets. The ChainedReassembly function only reassembles packets with 4 fragments, since the pcap i was using had 11 fragments for 1 packet it was not being reassembled.

Also ChainedReassembly does not take vlan headers into account. Vlan headers need to be stripped before using nff-go for IP reassembly.