@@ -845,7 +845,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
ph.raw = frame;
- skb->protocol = proto;
skb->dev = dev;
skb->priority = po->sk.sk_priority;
skb->mark = po->sk.sk_mark;
@@ -924,6 +923,11 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
len = ((to_write > len_max) ? len_max : to_write);
}
+ if (proto == htons(ETH_P_ALL) && dev->type == ARPHRD_ETHER)
+ skb->protocol = eth_hdr(skb)->h_proto;
+ else
+ skb->protocol = proto;
+
return tp_len;
}
@@ -1113,7 +1117,10 @@ static int packet_snd(struct socket *sock,
if (err)
goto out_free;
- skb->protocol = proto;
+ if (proto == htons(ETH_P_ALL) && dev->type == ARPHRD_ETHER)
+ skb->protocol = eth_hdr(skb)->h_proto;
+ else
+ skb->protocol = proto;
skb->dev = dev;
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;