netfilter: nf_tables: use skb->protocol instead of assuming ethernet header
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 15 Dec 2015 20:29:16 +0000 (21:29 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 18 Dec 2015 13:45:45 +0000 (14:45 +0100)
Otherwise we may end up with incorrect network and transport header for
other protocols.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_netdev.c

index 7b9c053ba75072276ee9227ea8d1e67ce3307715..edb3502f20161cf53d44e3fe84d9f0c63072be6a 100644 (file)
@@ -94,7 +94,7 @@ nft_do_chain_netdev(void *priv, struct sk_buff *skb,
 {
        struct nft_pktinfo pkt;
 
-       switch (eth_hdr(skb)->h_proto) {
+       switch (skb->protocol) {
        case htons(ETH_P_IP):
                nft_netdev_set_pktinfo_ipv4(&pkt, skb, state);
                break;