From: "Tim Foerster" via qemu development <qemu-devel@nongnu.org>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Tim Foerster" <tim.foerster@hetzner.com>
Cc: <qemu-devel@nongnu.org>, "Jason Wang" <jasowangio@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
<qemu-devel-bounces+tim.foerster=hetzner.com@nongnu.org>
Subject: Re: QMP: exposing the host TAP interface name
Date: Thu, 17 Sep 2026 08:12:49 +0200 [thread overview]
Message-ID: <DLHDBGTBWCIV.1U1MGIZCXMASZ@hetzner.com> (raw)
In-Reply-To: <CAJ+F1CLxsqfT302SGcq9vx5pgjrY3OiibmTpZHVtx1d-rXroVQ@mail.gmail.com>
Hi,
On Wed Sep 16, 2026 at 3:18 PM CEST, Marc-André Lureau wrote:
> Hi
>
> On Wed, Sep 16, 2026 at 10:22 AM Tim Foerster via qemu development
> <qemu-devel@nongnu.org> wrote:
>>
>> Hi,
>>
>> I'd like to query the host TAP interface name of a network backend via QMP, especially when the TAP FD is passed to QEMU using SCM_RIGHTS
>> and then assigned to a backend through fd=.
>>
>> In my current setup, retrieving this information externally requires CAP_SYS_PTRACE. This gives the management process far more access
>> than needed and conflicts with the Landlock sandboxing I want to apply, due to Landlock's ptrace restrictions [1].
>>
>> QEMU already owns the FD, and tap_fd_get_ifname() can retrieve the name using TUNGETIFF on Linux. For a TAP passed through fd=, x-query-
>> network currently reports the following (simplified):
>>
>> {
>> "name": "hostnet0",
>> "type": "tap",
>> "info-str": "fd=42"
>> }
>>
>> I'd like to obtain the actual interface name in a structured field, regardless of how the TAP was created or passed to QEMU. For example:
>>
>> {
>> "name": "hostnet0",
>> "type": "tap",
>> "info-str": "fd=42",
>> "data": {
>> "ifname": "vnet7"
>> }
>> }
>>
>> Would extending x-query-network be the preferred approach? If so, would you prefer a dedicated ifname field or a type-specific data object
>> selected by the existing type field?
>
> x- QMP commands are not meant for any other usage than debugging and
> testing (in fact, we should probably exclude them in production
> builds!). In particular, this command is currently only meant to be a
> HMP "info network" substitute for test/debugging only atm.
Well, I know about this concern, I was mainly trying to open a door there.
Not sure how flexible we will end up being here. I also did not get into which
patterns should be part of the HMP and which should only be exposed to the QMP
layer.
>>
>> Personally, I'd prefer an approach that is reasonably easy to backport downstream to older QEMU releases. Since x-query-network is
>> relatively new, extending it would also require bringing that command to releases which don't have it yet, potentially increasing the
>> backporting effort.
>>
>> A type-specific data object could also accommodate additional TAP properties later, such as multiqueue mode or vnet_hdr. However, those
>> are outside my current scope, I only need the interface name.
>
> I'd suggest a new query-network-tap(name: hostnet0) -> TAPInfo command
> for your specific case. Eventually, later, NetworkClientInfo could
> later embed that data.
I like the idea of having a `query-network-tap(name: hostnet0)`. I can
also try to send a patch, but wanted to collect your opinions first.
Once we agree on an API layout, I'll give it a try.
>
> Let see what other people & maintainers think
>
> thanks
next prev parent reply other threads:[~2026-09-17 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 6:22 QMP: exposing the host TAP interface name Tim Foerster via qemu development
2026-09-16 13:18 ` Marc-André Lureau
2026-09-17 6:12 ` Tim Foerster via qemu development [this message]
2026-09-17 8:27 ` Daniel P. Berrangé
2026-09-17 9:13 ` Tim Foerster via qemu development
2026-09-17 9:51 ` Daniel P. Berrangé
2026-09-17 10:07 ` Tim Foerster via qemu development
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=DLHDBGTBWCIV.1U1MGIZCXMASZ@hetzner.com \
--to=qemu-devel@nongnu.org \
--cc=armbru@redhat.com \
--cc=jasowangio@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel-bounces+tim.foerster=hetzner.com@nongnu.org \
--cc=tim.foerster@hetzner.com \
/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 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.