Skip to content

Commit

Permalink
adjusting the sender/sniffer narrative
Browse files Browse the repository at this point in the history
  • Loading branch information
donNewtonIntel committed Jun 22, 2022
1 parent 8c5cd4c commit 00a4f81
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions doc/pins/Packet_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,16 @@ std::thread StartReceive(
- Packet metadata can be specified by the using application in the P4 program.  

## Sniffer Application:
The `sniffer` application provides the means of a `tcpdump`-like tool to listen to the genetlink device. The sniffer can be used for listening to traffic, as well as recording the traffic into a file or displaying to standard out. The resulting pcapng file can then be viewed using Wireshark. The `sender` application can be used to send an example packet or packets from a pcap/pcapng file through genetlink. The sender also registers a new genetlink family and group called genl_packet and packets respectively. Both sniffer and sender use the pcapplusplus library which is an actively maintained open source library.
The `sniffer` application provides the means of a `tcpdump`-like tool to listen to the genetlink device. The sniffer can be used for listening to traffic, as well as recording the traffic into a file or displaying to standard out. The resulting pcapng file can then be viewed using Wireshark. The `sender` application can be used to send an example packet or packets from a pcap/pcapng file through genetlink. The sender also registers a new genetlink family and group called genl_packet and packets respectively.

## Sender application:
The `sender` application is currently used for testing purposes. It can create a packet, add the appropriate metadata and then send it to the generic netlink device where the `listening` application can pick it up and act on it. It is also useful for recreating error conditions where generic netlink functionality is part of the causality chain.
New applications that are designed to send to the generic netlink devices directly instead of using a kernel module can use this code as a template.

Both the sender and the sniffer can be compiled via bazel or sonic-buildimage. Either way, once compiled or the necessary binary installed the following commands can be used to use the two applications ([sniffer] indicates the sniffer application and [sender] indicates the sender application):

Both sniffer and sender use the pcapplusplus library which is an actively maintained open source library.

```
- [sniffer] : launches the sniffer and records all packets into a file named out.pcapng.
- [sniffer] -a : will either append the packets to out.pcapng or to a custom filename if given.
Expand All @@ -203,9 +210,6 @@ Both the sender and the sniffer can be compiled via bazel or sonic-buildimage. E

The packet metadata carried with process_callback_function gets put into a comment in the pcapng. If the sniffer is to be run outside of P4Runtime the user might want to construct their own custom receive thread using customCallbackReceive found in the header file for the sniffer, since the carried metadata might be different.

## Sender application:
The `sender` application is currently used for testing purposes. It can create a packet, add the appropriate metadata and then send it to the generic netlink device where the `listening` application can pick it up and act on it. It is also useful for recreating error conditions where generic netlink functionality is part of the causality chain.
New applications that are designed to send to the generic netlink devices directly instead of using a kernel module can use this code as a template.

```
- sudo [sender] : will send a sample packet using genetlink.
Expand Down

0 comments on commit 00a4f81

Please sign in to comment.