tun: Report "persist" flag to userspace
Subsystems (3)
PATCH 1/1 tun: Report "persist" flag to userspace
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.
---
drivers/net/tun.c +3 -0
@@ -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; }
include/uapi/linux/if_tun.h +2 -0
@@ -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. */
From: Pavel Emelyanov <[email protected]>
Date: Tue, 11 Jun 2013 14:41:24 +0400
Quoted 9 lines
The
TUN_PERSISTflag 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-onlyIFF_PERSISTone for this.Setting this new
IFF_PERSISTis hardly possible, as TUNSETIFF doesn't check for unknown flags being zero and thus there can be trash.Signed-off-by Pavel Emelyanov <[email protected]>
Applied, thanks.