tun: Report "persist" flag to userspace
authorPavel Emelyanov <xemul@parallels.com>
Tue, 11 Jun 2013 10:41:24 +0000 (14:41 +0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Jun 2013 22:07:21 +0000 (15:07 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/uapi/linux/if_tun.h

index 89776c5921518e60a3f73816277e027b4a9f8739..b90a73165d30a32c98f76c7d876bee378f11461c 100644 (file)
@@ -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;
 }
 
index 2835b85fd46d85ae47ec857caa93db1ee5ba79b9..82334f88967e9ba269d3e3fa121f563c33e64eed 100644 (file)
@@ -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. */
This page took 0.042757 seconds and 5 git commands to generate.