Results 1 to 2 of 2
Hi i would receive packets that arrives on a NIC also on a virtual interfaces...these packets are of type ETH_P_802_2. I would open a raw socket (AF_PACKET), bind it on ...
- 07-27-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 4
How to receive packets on a virtual interface?
Hi i would receive packets that arrives on a NIC also on a virtual interfaces...these packets are of type ETH_P_802_2. I would open a raw socket (AF_PACKET), bind it on the virtual interface (let's say virt0) and sniff...So which is the correct way to do this? I found only a way: register a new protocol handler for packets of type ETH_P_802_2 and pass the packets to virt0 by netif_receive_skb method. However the system restarts when my method is called (the system doesn't restart if i comment the call to netif_receive_skb) Maybe i'm missing something...
Questions:
- Which are the difference between netif_rx and netif_receive_skb?
if i use netif_rx instead of netif_receive_skb the system doesn't crash but becomes very slow...By debugging a UML system i noticed that if i send only one packet
netif_receive_skb is called a lot of time like there was a loop...
- When my protocol handler is called the skb->data points to the beginning of the eth header or it was already stripped out?
- Which is the correct way to set skb->protocol field?
Thank you all for the help!
MirkoLast edited by MirkoBanchi; 07-27-2011 at 11:45 AM.
- 07-27-2011 #2Just Joined!
- Join Date
- May 2011
- Posts
- 4
Maybe i found the reason for the crash...setting skb->protocol in the following manner:
the system doesn't crash and doesn't become slow. However in user space i don't receive nothing if i bind the socket with interface virt0...how can i pass the frame to user-space?Code:skb->dev = virt0; skb->protocol = eth_type_trans(skb, skb->dev);


Reply With Quote
