dev->addr_len = 0;
dev->mtu = 1500;
- /* Type PPP seems most suitable */
- dev->type = ARPHRD_PPP;
+ /* Zero header length */
+ dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->tx_queue_len = 10;
break;
}
/* Write */
-static ssize_t tun_chr_write(struct file * file, const char * buf,
+static ssize_t tun_chr_write(struct file * file, const char __user * buf,
size_t count, loff_t *pos)
{
- struct iovec iv = { (void *) buf, count };
+ struct iovec iv = { (void __user *) buf, count };
return tun_chr_writev(file, &iv, 1, pos);
}
}
/* Read */
-static ssize_t tun_chr_read(struct file * file, char * buf,
+static ssize_t tun_chr_read(struct file * file, char __user * buf,
size_t count, loff_t *pos)
{
struct iovec iv = { buf, count };
struct ifreq ifr;
int err;
- if (copy_from_user(&ifr, (void *)arg, sizeof(ifr)))
+ if (copy_from_user(&ifr, (void __user *)arg, sizeof(ifr)))
return -EFAULT;
ifr.ifr_name[IFNAMSIZ-1] = '\0';
if (err)
return err;
- if (copy_to_user((void *)arg, &ifr, sizeof(ifr)))
+ if (copy_to_user((void __user *)arg, &ifr, sizeof(ifr)))
return -EFAULT;
return 0;
}