why doesn't dev_queue_xmit actually transmit the packet?
I have a PC with two network cards (eth0 and eth1). I create a simple netfilter NF_INET_PRE_ROUTING hook. In my hook, I change the pkt_type to PACKET_OUTGOING, and the skb->dev to eth1/eth0, whichever it didn't come in on. I call dev_queue_xmit(skb) and then return NF_STOLEN.
I think this should create a simple bridge, since I also put the network cards in promiscuous mode, but what I am seeing is that only broadcast packets are being transmitted. Can anyone help with this? Here is the code:
unsigned int in_hook(
unsigned int hooknum,
struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
struct net_device * eth0 = dev_get_by_name(&init_net, "eth0");
struct net_device * eth1 = dev_get_by_name(&init_net, "eth1");
if (eth1 == skb->dev)
{
skb->dev = eth0;
skb->pkt_type = PACKET_OUTGOING;
dev_queue_xmit(skb);
return NF_STOLEN;
}
else if (eth0 == skb->dev)
{
skb->dev = eth1;
skb->pkt_type = PACKET_OUTGOING;
dev_queue_xmit(skb);
return NF_STOLEN;
}
else
{
return NF_ACCEPT;
}
}
Last edited by drblmb; 09-16-2009 at 06:27 PM.
|