lib/netdev-bsd.c
/*
 * This function attempts to receive a packet from the specified network
 * device. It is assumed that the network device is a system device or a tap
 * device opened as a system one. In this case the read operation is performed
 * from rxq->pcap.
 */
This function attempts to receive a packet from the specified network
device. It is assumed that the network device is a system device or a tap
device opened as a system one. In this case the read operation is performed
from rxq->pcap.
This function attempts to receive a packet from the specified network device . It is assumed that the network device is a system device or a tap device opened as a system one . In this case the read operation is performed from rxq - > pcap .
static int
netdev_rxq_bsd_recv_pcap(struct netdev_rxq_bsd *rxq, struct dp_packet *buffer)
{
    struct pcap_arg arg;
    int ret;
    arg.size = dp_packet_tailroom(buffer);
    arg.data = dp_packet_data(buffer);
    for (;;) {
        ret = pcap_dispatch(rxq->pcap_handle, 1, proc_pkt, (u_char *) &arg);
        if (ret > 0) {
            dp_packet_set_size(buffer, dp_packet_size(buffer) + arg.retval);
            return 0;
        }
        if (ret == -1) {
            if (errno == EINTR) {
                 continue;
            }
        }
        return EAGAIN;
    }
}
static int netdev_rxq_bsd_recv_pcap ( struct netdev_rxq_bsd * rxq , struct dp_packet * buffer ) { struct pcap_arg arg ; int ret ; arg . size = dp_packet_tailroom ( buffer ) ; arg . data = dp_packet_data ( buffer ) ; for ( ; ; ) { ret = pcap_dispatch ( rxq -> pcap_handle , 1 , proc_pkt , ( u_char * ) & arg ) ; if ( ret > 0 ) { dp_packet_set_size ( buffer , dp_packet_size ( buffer ) + arg . retval ) ; return 0 ; } if ( ret == -1 ) { if ( errno == EINTR ) { continue ; } } return EAGAIN ; } }
This function attempts to receive a packet from the specified network
 device.
This function attempts to receive a packet from the specified network device .
/* prepare the pcap argument to store the packet */