Skip to contentSkip to conversation

netfilter: nf_tables: use skb->protocol instead of assuming ethernet header

PATCH New Pablo Neira Ayuso 1 participant 1 message Dec 15, 2015

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: use skb->protocol instead of assuming ethernet header

Otherwise we may end up with incorrect network and transport header for other protocols.

---
 net/netfilter/nf_tables_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_netdev.c +1 -1
index 3e9c87b..b6605e0 100644
@@ -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;
Signature · 1 line
2.1.4