net: verify GSO flag bits against netdev features
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Wed, 16 Nov 2011 14:05:33 +0000 (14:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Nov 2011 04:12:20 +0000 (23:12 -0500)
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h

index b35ffd735ecc7d4bd5e761e75d7f8ea05cbcdfb1..31da3bbe7b1b2794ea39669186aabd930fd15bc6 100644 (file)
@@ -2492,6 +2492,15 @@ netdev_features_t netif_skb_features(struct sk_buff *skb);
 static inline int net_gso_ok(netdev_features_t features, int gso_type)
 {
        netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
+
+       /* check flags correspondence */
+       BUILD_BUG_ON(SKB_GSO_TCPV4   != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_UDP     != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_DODGY   != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_TCPV6   != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_FCOE    != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
+
        return (features & feature) == feature;
 }