mmaraya / port-mirroring

OpenWrt package for copying network packets without iptables
BSD 2-Clause "Simplified" License
102 stars 32 forks source link

Segmentation Fault during TEE capturing mode with large packets #66

Open polachz opened 6 years ago

polachz commented 6 years ago

The tool port-mirroring can't handle correctly captured packets with packet size > 2048. For example it occurs when generic receive offloading assembles several packets together.

I have prepared a patch for the 1.4.2 version (see attachment) , used in Turris Omnia, and OpenWRT. This patch checks packet size and realloc the buffer if necessary. Of course here is question how pcap re-inject modified packet back to capturing interface (from brief check i do not see any big issues in wireshark capture), but anyway the patch solves the Seg Fault problem.

I see newer version of the packet-mirroring daemon here, but by quick analysis of the current code, the same problem is here too. I believe that the patch can be easily used in this version or based on the patch principles, the problem can be fixed here better.

Patch:

port_mirroring_large_packet-patch.tar.gz

mmaraya commented 5 years ago

Apologies for the late reply (alas life gets in the way). Let me look at this today.

mmaraya commented 5 years ago

I've refactored quite a bit from 1.4.2 to 1.4.3 so I can't apply the patch directly. This will need more work.