Here is a patch.
-Andi
--- linux-2.4.13-work/net/packet/af_packet.c-PACKET Tue Aug 7 17:30:50 2001
+++ linux-2.4.13-work/net/packet/af_packet.c Thu Nov 1 17:38:12 2001
@@ -250,6 +250,9 @@
if (skb->pkt_type == PACKET_LOOPBACK)
goto out;
+ if (sk->num != htons(ETH_P_ALL) && skb->protocol != sk->num)
+ goto out;
+
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
goto oom;
@@ -413,6 +416,10 @@
goto drop;
sk = (struct sock *) pt->data;
+
+ if (sk->num != htons(ETH_P_ALL) && skb->protocol != sk->num)
+ goto drop;
+
po = sk->protinfo.af_packet;
skb->dev = dev;
@@ -824,7 +831,8 @@
}
sk->num = protocol;
- sk->protinfo.af_packet->prot_hook.type = protocol;
+ /* XXX Always bind to ETH_P_ALL to catch outgoing packets. */
+ sk->protinfo.af_packet->prot_hook.type = htons(ETH_P_ALL);
sk->protinfo.af_packet->prot_hook.dev = dev;
sk->protinfo.af_packet->ifindex = dev ? dev->ifindex : 0;
@@ -973,7 +981,7 @@
sk->protinfo.af_packet->prot_hook.data = (void *)sk;
if (protocol) {
- sk->protinfo.af_packet->prot_hook.type = protocol;
+ sk->protinfo.af_packet->prot_hook.type = htons(ETH_P_ALL);
dev_add_pack(&sk->protinfo.af_packet->prot_hook);
sock_hold(sk);
sk->protinfo.af_packet->running = 1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/