Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tun: Allow tap device to send/receive UFO packets.

- Allow setting UFO on tap device and handle UFO packets.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

---------------------------------------------------------
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sridhar Samudrala and committed by
David S. Miller
e36aa25a 5c516751

+13 -1
+12 -1
drivers/net/tun.c
··· 641 641 case VIRTIO_NET_HDR_GSO_TCPV6: 642 642 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; 643 643 break; 644 + case VIRTIO_NET_HDR_GSO_UDP: 645 + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 646 + break; 644 647 default: 645 648 tun->dev->stats.rx_frame_errors++; 646 649 kfree_skb(skb); ··· 729 726 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; 730 727 else if (sinfo->gso_type & SKB_GSO_TCPV6) 731 728 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 729 + else if (sinfo->gso_type & SKB_GSO_UDP) 730 + gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; 732 731 else 733 732 BUG(); 734 733 if (sinfo->gso_type & SKB_GSO_TCP_ECN) ··· 1078 1073 old_features = dev->features; 1079 1074 /* Unset features, set them as we chew on the arg. */ 1080 1075 features = (old_features & ~(NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST 1081 - |NETIF_F_TSO_ECN|NETIF_F_TSO|NETIF_F_TSO6)); 1076 + |NETIF_F_TSO_ECN|NETIF_F_TSO|NETIF_F_TSO6 1077 + |NETIF_F_UFO)); 1082 1078 1083 1079 if (arg & TUN_F_CSUM) { 1084 1080 features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; ··· 1095 1089 if (arg & TUN_F_TSO6) 1096 1090 features |= NETIF_F_TSO6; 1097 1091 arg &= ~(TUN_F_TSO4|TUN_F_TSO6); 1092 + } 1093 + 1094 + if (arg & TUN_F_UFO) { 1095 + features |= NETIF_F_UFO; 1096 + arg &= ~TUN_F_UFO; 1098 1097 } 1099 1098 } 1100 1099
+1
include/linux/if_tun.h
··· 62 62 #define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ 63 63 #define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ 64 64 #define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ 65 + #define TUN_F_UFO 0x10 /* I can handle UFO packets */ 65 66 66 67 /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ 67 68 #define TUN_PKT_STRIP 0x0001