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...
- 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!