• Vlad Yasevich's avatar
    macvtap: Add support of packet capture on macvtap device. · 6acf54f1
    Vlad Yasevich authored
    Macvtap device currently doesn not allow a user to capture
    traffic on due to the fact that it steals the packets
    from the network stack before the skb->dev is set correctly
    on the receive side, and that use uses macvlan transmit
    path directly on the send side.  As a result, we never
    get a change to give traffic to the taps while the correct
    device is set in the skb.
    
    This patch makes macvtap device behave almost exaclty like
    macvlan.  On the send side, we switch to using dev_queue_xmit().
    On the receive side, to deliver packets to macvtap, we now
    use netif_rx and dev_forward_skb just like macvlan.  The only
    differnce now is that macvtap has its own rx_handler which is
    attached to the macvtap netdev.  It is here that we now steal
    the packet and provide it to the socket.
    
    As a result, we can now capture traffic on the macvtap device:
       tcpdump -i macvtap0
    
    It also gives us the abilit to add tc actions to the macvtap
    device and actually utilize different bandwidth management
    queues on output.
    Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6acf54f1
macvtap.c 29 KB