diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-11-16 18:05:33 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-17 08:12:20 +0400 |
commit | 0345e1864283207bc236120dd3e13ff2391fa85f (patch) | |
tree | 9fe4b1871c01605a9a2ff97973a0448ccf92ac3d | |
parent | 3ad9b358e03fd9dbf6705721490c811b666b0fe2 (diff) | |
download | linux-0345e1864283207bc236120dd3e13ff2391fa85f.tar.xz |
net: verify GSO flag bits against netdev features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b35ffd735ecc..31da3bbe7b1b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -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; } |