All of lore.kernel.org
 help / color / mirror / Atom feed
* [regression] Completely editing packet should be allowed.
@ 2026-11-05 19:02 allfox wy
  2026-11-06  5:08 ` Florian Westphal
  0 siblings, 1 reply; 11+ messages in thread
From: allfox wy @ 2026-11-05 19:02 UTC (permalink / raw)
  To: netfilter

Greetings netfilter people.

I have a homebrew cipher program using libnetfilter_queue, which would
intercept certain IP in IP packets via iptables' NFQUEUE target, edit
them ( completely ) then put them back to OS for further processing.

Received packets would be redirected via RAW table ( which would
happen before CONNTRACK ) , while sending packets would be redirected
via MANGLE table POSTROUTING chain ( they are leaving the host, no
longer need to be CONTRACKed ).

The edit is to transform the entire inner packet with a cipher. By
entire, I mean including the inner header hidden and the original
length would change.
The receiving host would decipher it back to normal IP in IP packet in
RAW table.

This would form a transparent tunnel and had worked for years.

However recently I tried to switch from Linux 6.18 LTS to 7.4-rc1 ( in
favour of tcp_roccet ), my homebrew stopped working.
There is no error message anywhere, all libnetfilter_queue functions
return success, I could see the packet, I could edit it, I could send
the verdict. Just after my edit, the packet would fade into void
somehow. Like the host never had it.

So I did a bisect, it comes to
112e447d17f78d08485b3076a8baa1dfb9794bd8 is the first bad commit:
- netfilter: validate L4 headers after userspace packet writes.

I don't really get the idea of the situation here:
- Freestyle packet via libnetfilter_queue is no longer supported?
- What is the rule of validation? What can be edited and what can't be touched?

I still feel making a cipher should be a valid use case for
libnetfilter_queue. ( Which would replace the entire inner packet of
IP in IP encapsulation, so any validation on the inner content would
fail )
The whole point of libnetfilter_queue is giving userspace a way to
inspect/edit the packet. When all function calls success and the
userspace say "verdict, allow" then the system silently dropping the
packet into void does not sound very logical to me.

So that
- I vote for reverting 112e447d . As in my view, it would kill a valid
use case of libnetfilter_queue and NFQUEUE target.
- If it would stay, please consider adding an obvious message into
https://git.netfilter.org/libnetfilter_queue/tree/examples/nf-queue.c
, which would early warning the user that implementing a cipher or any
attempt to completely editing the packet via this library is blocked
by kernel policy. Before someone actually try it.

Thank you for taking a look. Please let me know if any further details
would be helpful.

Yue Wu

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-11-09 16:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 19:02 [regression] Completely editing packet should be allowed allfox wy
2026-11-06  5:08 ` Florian Westphal
2026-11-06 11:46   ` Pablo Neira Ayuso
2026-11-07  8:04   ` allfox wy
2026-11-07  8:10     ` allfox wy
2026-11-09 10:25     ` Pablo Neira Ayuso
2026-11-09 10:49       ` Pablo Neira Ayuso
2026-11-09 14:19     ` Florian Westphal
2026-11-09 15:45       ` allfox wy
2026-11-09 16:19         ` Florian Westphal
2026-11-09 16:44           ` allfox wy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.