diff --git a/Documentation/applications/examples/netpkt/index.rst b/Documentation/applications/examples/netpkt/index.rst index 5d2ca597de4..490d12701db 100644 --- a/Documentation/applications/examples/netpkt/index.rst +++ b/Documentation/applications/examples/netpkt/index.rst @@ -3,3 +3,49 @@ ==================================== A test of ``AF_PACKET``, raw sockets. Contributed by Lazlo Sitzer. + +Overview +======== + +The ``netpkt`` example demonstrates the use of raw packet sockets (``AF_PACKET``) +for sending and receiving Ethernet frames at the link layer, bypassing the +TCP/IP protocol stack. This is useful for network protocol testing, driver +verification, and low-level network analysis. + +Configuration +============= + +- ``CONFIG_EXAMPLES_NETPKT=y`` – Enables the netpkt example. + +Usage +===== + +The ``netpkt`` program supports the following command-line options: + +.. code-block:: bash + + netpkt [options] + +Options: + +- ``-a`` – Transmit and receive packets +- ``-r`` – Receive packets only +- ``-t`` – Transmit packets only +- ``-v`` – Verbose mode (display packet contents in hexadecimal) +- ``-i `` – Specify network interface name (e.g., ``eth0``) + +Examples: + +.. code-block:: bash + + # Send 3 packets on eth0 interface with verbose output + netpkt -i eth0 -t -v + + # Receive packets on eth0 interface + netpkt -i eth0 -r -v + + # Both send and receive on eth0 + netpkt -i eth0 -a -v + + # Send packets without specifying interface (uses default) + netpkt -t