netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Receiving GENEVE packets for one VNI in user mode
@ 2024-01-13 22:35 Kasper Dupont
  2024-01-16 16:28 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Kasper Dupont @ 2024-01-13 22:35 UTC (permalink / raw)
  To: netdev

Is there a way for a user mode program to receive GENEVE packets
targeted at one specified VNI? None of the GENEVE related webpages I
have been reading through have brought me closer to an answer.

I can think of three different approaches, but each come with its
own problems making it not look like a viable solution.


Approach 1:

The most straightforward approach I can think of is to open a UDP
socket attach BPF rules to filter on VNI and bind it to port 6081.
This should work as long as there is nothing else on the host using
GENEVE.

But I don't see any way to get this approach working if multiple
programs are to receive GENEVE packets for different VNI and
simultaneously use the kernel drivers to receive packets for other
VNI.

Approach 2:

Use a raw socket to receive all UDP packets. Because there is a
possibility that packets arrive fragmented it has to duplicate the
reasembly work in user mode. And because the VNI will only be present
in one fragment, filtering has to be done after reassembly. So I
couldn't rely on BPF.

This approach seems possible but very inefficient.

Approach 3:

Use ip-link(8) to create a tunnel device and bind a raw socket to that
virtual interface. This will however only receive the encapsulated
packets and not the GENEVE header, so it would be unsuitable for any
use case that needs the actual GENEVE header. It would also lose all
packets with critical options that aren't understood by the kernel but
may be understood by the user mode program.


Is there a way to make one of these approaches work or some other way
to achieve it?

If it is impossible to do in user mode do you think a kernel module to
add the functionality would be possible with the current kernel code?

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

* Re: Receiving GENEVE packets for one VNI in user mode
  2024-01-13 22:35 Receiving GENEVE packets for one VNI in user mode Kasper Dupont
@ 2024-01-16 16:28 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-01-16 16:28 UTC (permalink / raw)
  To: Kasper Dupont; +Cc: netdev

On Sat, 13 Jan 2024 23:35:33 +0100 Kasper Dupont wrote:
> Is there a way to make one of these approaches work or some other way
> to achieve it?
> 
> If it is impossible to do in user mode do you think a kernel module to
> add the functionality would be possible with the current kernel code?

Perhaps open a tap interface and redirect to it with bpf/tc/whatnot?

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

end of thread, other threads:[~2024-01-16 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-13 22:35 Receiving GENEVE packets for one VNI in user mode Kasper Dupont
2024-01-16 16:28 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).