All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tun: Report "persist" flag to userspace
@ 2013-06-11 10:41 Pavel Emelyanov
  2013-06-12 22:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2013-06-11 10:41 UTC (permalink / raw)
  To: David Miller, Linux Netdev List

The TUN_PERSIST flag is not reported at all -- both TUNGETIFF, and sysfs
"flags" attribute skip one. Knowing whether a device is persistent or not
is critical for checkpoint-restore, thus I propose to add the read-only
IFF_PERSIST one for this.

Setting this new IFF_PERSIST is hardly possible, as TUNSETIFF doesn't check
for unknown flags being zero and thus there can be trash.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 89776c5..b90a731 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1530,6 +1530,9 @@ static int tun_flags(struct tun_struct *tun)
 	if (tun->flags & TUN_TAP_MQ)
 		flags |= IFF_MULTI_QUEUE;
 
+	if (tun->flags & TUN_PERSIST)
+		flags |= IFF_PERSIST;
+
 	return flags;
 }
 
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 2835b85..82334f8 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -68,6 +68,8 @@
 #define IFF_MULTI_QUEUE 0x0100
 #define IFF_ATTACH_QUEUE 0x0200
 #define IFF_DETACH_QUEUE 0x0400
+/* read-only flag */
+#define IFF_PERSIST	0x0800
 
 /* Features for GSO (TUNSETOFFLOAD). */
 #define TUN_F_CSUM	0x01	/* You can hand me unchecksummed packets. */

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

* Re: [PATCH net-next] tun: Report "persist" flag to userspace
  2013-06-11 10:41 [PATCH net-next] tun: Report "persist" flag to userspace Pavel Emelyanov
@ 2013-06-12 22:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-06-12 22:07 UTC (permalink / raw)
  To: xemul; +Cc: netdev

From: Pavel Emelyanov <xemul@parallels.com>
Date: Tue, 11 Jun 2013 14:41:24 +0400

> The TUN_PERSIST flag is not reported at all -- both TUNGETIFF, and sysfs
> "flags" attribute skip one. Knowing whether a device is persistent or not
> is critical for checkpoint-restore, thus I propose to add the read-only
> IFF_PERSIST one for this.
> 
> Setting this new IFF_PERSIST is hardly possible, as TUNSETIFF doesn't check
> for unknown flags being zero and thus there can be trash.
> 
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

Applied, thanks.

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

end of thread, other threads:[~2013-06-12 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-11 10:41 [PATCH net-next] tun: Report "persist" flag to userspace Pavel Emelyanov
2013-06-12 22:07 ` David Miller

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.