summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-12-16 08:05:06 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-16 11:19:41 -0500
commit1cf8e410b6d3906aa1ecacdd15dd9b448c9ce111 (patch)
tree29c4b5be3413eecbf79dde5fd77f2937d05ad2a5 /drivers
parent5eea84f478537de769330079dc068414f9d417f4 (diff)
tun: drop broken IFF_VNET_LE
Use TUNSETVNETLE/TUNGETVNETLE instead. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/tun.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a5cbf67517f0..8c8dc16839a7 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -110,9 +110,11 @@ do { \
110 * overload it to mean fasync when stored there. 110 * overload it to mean fasync when stored there.
111 */ 111 */
112#define TUN_FASYNC IFF_ATTACH_QUEUE 112#define TUN_FASYNC IFF_ATTACH_QUEUE
113/* High bits in flags field are unused. */
114#define TUN_VNET_LE 0x80000000
113 115
114#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \ 116#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \
115 IFF_VNET_LE | IFF_MULTI_QUEUE) 117 IFF_MULTI_QUEUE)
116#define GOODCOPY_LEN 128 118#define GOODCOPY_LEN 128
117 119
118#define FLT_EXACT_COUNT 8 120#define FLT_EXACT_COUNT 8
@@ -208,12 +210,12 @@ struct tun_struct {
208 210
209static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val) 211static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val)
210{ 212{
211 return __virtio16_to_cpu(tun->flags & IFF_VNET_LE, val); 213 return __virtio16_to_cpu(tun->flags & TUN_VNET_LE, val);
212} 214}
213 215
214static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val) 216static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)
215{ 217{
216 return __cpu_to_virtio16(tun->flags & IFF_VNET_LE, val); 218 return __cpu_to_virtio16(tun->flags & TUN_VNET_LE, val);
217} 219}
218 220
219static inline u32 tun_hashfn(u32 rxhash) 221static inline u32 tun_hashfn(u32 rxhash)
@@ -1843,6 +1845,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
1843 int sndbuf; 1845 int sndbuf;
1844 int vnet_hdr_sz; 1846 int vnet_hdr_sz;
1845 unsigned int ifindex; 1847 unsigned int ifindex;
1848 int le;
1846 int ret; 1849 int ret;
1847 1850
1848 if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { 1851 if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) {
@@ -2042,6 +2045,23 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
2042 tun->vnet_hdr_sz = vnet_hdr_sz; 2045 tun->vnet_hdr_sz = vnet_hdr_sz;
2043 break; 2046 break;
2044 2047
2048 case TUNGETVNETLE:
2049 le = !!(tun->flags & TUN_VNET_LE);
2050 if (put_user(le, (int __user *)argp))
2051 ret = -EFAULT;
2052 break;
2053
2054 case TUNSETVNETLE:
2055 if (get_user(le, (int __user *)argp)) {
2056 ret = -EFAULT;
2057 break;
2058 }
2059 if (le)
2060 tun->flags |= TUN_VNET_LE;
2061 else
2062 tun->flags &= ~TUN_VNET_LE;
2063 break;
2064
2045 case TUNATTACHFILTER: 2065 case TUNATTACHFILTER:
2046 /* Can be set only for TAPs */ 2066 /* Can be set only for TAPs */
2047 ret = -EINVAL; 2067 ret = -EINVAL;