Skip to content

Commit

Permalink
tun: Report "persist" flag to userspace
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jun 12, 2013
1 parent 7c0cadc commit 274038f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/if_tun.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 274038f

Please sign in to comment.