AFAIK, there are times when you can get data, while others do not (in both directions). It’s possible that I have some details, but I’m sure that someone will correct me.
Pcap uses various mechanisms for sniffing interfaces, but here's how the general case works:
- The network card receives the packet (driver is notified via interrupt)
- The kernel puts this packet in the appropriate listening queues: for example,
- TCP stack.
- Bridge driver if the interface is connected to the bridge.
- The interface used by PCAP (raw socket connection).
- These buffers are flushed independently of each other:
- As you build TCP streams and transfer data to processes.
- When the bridge sends a packet to the corresponding connected interfaces.
- PCAP .
, , . , ( , , ). , Ethernet, .
, , . , . Google , , .
, , . Netgraph . , ( , ).