aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3c9985f29950..5ce580f413b9 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1496,11 +1496,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1496 switch (tun->flags & TUN_TYPE_MASK) { 1496 switch (tun->flags & TUN_TYPE_MASK) {
1497 case IFF_TUN: 1497 case IFF_TUN:
1498 if (tun->flags & IFF_NO_PI) { 1498 if (tun->flags & IFF_NO_PI) {
1499 switch (skb->data[0] & 0xf0) { 1499 u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0;
1500 case 0x40: 1500
1501 switch (ip_version) {
1502 case 4:
1501 pi.proto = htons(ETH_P_IP); 1503 pi.proto = htons(ETH_P_IP);
1502 break; 1504 break;
1503 case 0x60: 1505 case 6:
1504 pi.proto = htons(ETH_P_IPV6); 1506 pi.proto = htons(ETH_P_IPV6);
1505 break; 1507 break;
1506 default: 1508 default: