Hi,

Basically, I am trying to write a simple layer2 switching software.
I am trying to tap a packet in layer 2 using netfilter hook in kernel netif_receive_skb() routine. In the hook handler, I just change the device of the skb and send it out using dev_queue_xmit. Everything works fine till 255 packets, after which the kernel hangs.
Packets are received in eth1 interface and switched to eth0 interface.
Can anyone tell why it hangs after 255 packets? Whatelse should I fill in skb before sending it out, if that could be the problem? Pl. help

The hook handler code is below:

unsigned int PktIn (unsigned int hooknum, struct sk_buff **skb,
const struct net_device *indev, const struct net_device *outdev,
int (*okfn) (struct sk_buff *))
{
struct net_device *out_dev;

out_dev = dev_get_by_name ("eth0");

(*skb)->dev = out_dev;
if ((*skb)->dev->hard_header)
(*skb)->dev->hard_header ((*skb), (*skb)->dev,
ntohs ((*skb)->protocol), NULL, NULL,
(*skb)->len);
dev_queue_xmit (*skb);
return NF_DROP;
}

Thanks,
TechM