netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kasper Dupont <kasperd@sgcrd.13.jan.2024.kasperd.net>
To: netdev@vger.kernel.org
Subject: Receiving GENEVE packets for one VNI in user mode
Date: Sat, 13 Jan 2024 23:35:33 +0100	[thread overview]
Message-ID: <20240113223533.GA3929032@sniper.kasperd.net> (raw)

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?

             reply	other threads:[~2024-01-13 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13 22:35 Kasper Dupont [this message]
2024-01-16 16:28 ` Receiving GENEVE packets for one VNI in user mode Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240113223533.GA3929032@sniper.kasperd.net \
    --to=kasperd@sgcrd.13.jan.2024.kasperd.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).