@ -15,6 +15,88 @@ traffic in one of the Zephyr network interfaces and send that traffic to
@@ -15,6 +15,88 @@ traffic in one of the Zephyr network interfaces and send that traffic to
external system for analysis. The monitoring can be setup either manually
using ``net-shell`` or automatically by using the ``net_capture`` API.
Cooked Mode Capture
*******************
If capturing is enabled and configured, the system will automatically capture
network traffic for a given network interface. If you would like to capture
network data when there is no network interface involved, then you need to use
the cooked mode capture API.
In cooked mode capture, arbitrary network packets can be captured and there
does not need to be network interface involved. For example low level HDLC
packets in PPP can be captured, as the HDLC L2 layer data is stripped away when
using the normal network interface based capture. Also CANBUS or Bluetooth
network data could be captured although currently there is no support in the
network stack to capture those.
The cooked mode capture works like this:
* An ``any`` network interface is created. It acts as a sink where the cooked
mode captured packets are written by the cooked mode capture API.
* A ``cooked`` virtual network interface is attached on top of this ``any``
interface.
* The ``cooked`` interface must be configured to capture certain L2 packet types
using the network interface configuration API.
* When cooked mode capture API is used, the caller must specify what is the
layer 2 protocol type of the captured data. The cooked mode capture API is then
able to determine what to capture when receiving such a L2 packet.
* The network packet capturing infrastructure is then setup so that the ``cooked``
interface is marked as captured network interface.
The packets received by the ``cooked`` interface via the ``any`` interface are
then automatically placed to the capture IP tunnel and sent to remote host
for analysis.
For example, in the sample capture application, these network interfaces