--- linux-2.6.22.14/net/packet/af_packet.c 2008-01-22 13:57:20.000000000 +0200 +++ linux/net/packet/af_packet.c 2008-01-15 10:57:26.000000000 +0200 @@ -457,6 +457,14 @@ static int packet_rcv(struct sk_buff *sk sk = pt->af_packet_priv; po = pkt_sk(sk); + if (sk->sk_type == SOCK_DGRAM) { + if (skb->protocol != htons(ETH_P_IP)) + goto drop; + + /* NOTE: incoming PPP packets can have ethernet header */ + skb_pull(skb, skb_network_offset(skb)); + } + skb->dev = dev; if (dev->hard_header) { @@ -573,6 +581,14 @@ static int tpacket_rcv(struct sk_buff *s sk = pt->af_packet_priv; po = pkt_sk(sk); + if (sk->sk_type == SOCK_DGRAM) { + if (skb->protocol != htons(ETH_P_IP)) + goto drop; + + /* NOTE: incoming PPP packets can have ethernet header */ + skb_pull(skb, skb_network_offset(skb)); + } + if (dev->hard_header) { if (sk->sk_type != SOCK_DGRAM) skb_push(skb, skb->data - skb_mac_header(skb));