oremanj/python-netfilterqueue

how to deal with fragment?

rhoninzhang opened this issue · 1 comments

Hey, it's a great job, I can modify data in net transmission with it, but if the package more than 1460 bytes, it will be fragmented due to IP MTU.

Since the complete message was packed via private protocol, the fragment can't be parsed and modified, is any method for caching fragment in netfilterqueue and send after repackaging, or could you please give any suggestion? Many thanks in advance.

Netfilterqueue doesn't reassemble packets itself.

Suggestions:

  1. Keep your own cache of IP fragments received, and implement something such as https://tools.ietf.org/html/rfc815 to re-assemble them. When you have a full packet, send from Python. But you won't be using set_payload for this, as you will be sending a brand new packet.
  2. Investigate if your network card supports and has enabled large receive offload/generic receive offload and if that might solve the problem for you. Try ethtool -k eth0 | grep offload to see your interface settings.