Thread (2 messages) 2 messages, 2 authors, 36m ago
HOTtoday

[PATCH net-next] tap: report IFF_DETACH_QUEUE in TUNGETIFF

From: Umang Pokhriyal <hidden>
Date: 2026-09-29 14:24:30
Also in: lkml
Subsystem: networking drivers, the rest, tun/tap driver · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Willem de Bruijn, Jason Wang

tun sets IFF_DETACH_QUEUE in the flags returned by TUNGETIFF when the
queue is detached, since commit 3d407a80b62f ("tun: Report whether the
queue is attached or not"). tap_ioctl() returns only q->flags, so a
detached macvtap or ipvtap queue is reported as attached.

Cloud Hypervisor ran into this when checking queue state on macvtap.

Report the flag from q->enabled, as tun does.

Assisted-by: LLM
Signed-off-by: Umang Pokhriyal <redacted>
---
 drivers/net/tap.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index ff67d99deb39e..cb8ffb0c4a315 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -950,6 +950,8 @@ static long tap_ioctl(struct file *file, unsigned int cmd,
 
 		ret = 0;
 		u = q->flags;
+		if (!q->enabled)
+			u |= IFF_DETACH_QUEUE;
 		if (copy_to_user(&ifr->ifr_name, tap->dev->name, IFNAMSIZ) ||
 		    put_user(u, &ifr->ifr_flags))
 			ret = -EFAULT;
base-commit: c66d93e68728cfb5f40b40d0f24129d7768faf43
-- 
2.53.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help