diff options
author | David S. Miller <davem@davemloft.net> | 2017-10-06 03:57:03 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-06 04:19:22 +0300 |
commit | 53954cf8c5d205624167a2bfd117cc0c1a5f3c6d (patch) | |
tree | a287f0c80eb616758bb5212523c8fb3d8fc350a4 /drivers/net/tun.c | |
parent | 4b54db1375757aa3e870c075065a8ab9350d26c4 (diff) | |
parent | 7a92616c0bac849e790283723b36c399668a1d9f (diff) | |
download | linux-53954cf8c5d205624167a2bfd117cc0c1a5f3c6d.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Just simple overlapping changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a6e0bffe3d29..57e4c31fa84a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1676,11 +1676,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, switch (tun->flags & TUN_TYPE_MASK) { case IFF_TUN: if (tun->flags & IFF_NO_PI) { - switch (skb->data[0] & 0xf0) { - case 0x40: + u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0; + + switch (ip_version) { + case 4: pi.proto = htons(ETH_P_IP); break; - case 0x60: + case 6: pi.proto = htons(ETH_P_IPV6); break; default: |