Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jtt authored and esatormi committed Dec 21, 2023
1 parent ae3e50f commit 4b772e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name = "pktreplay"
version = "0.1.0"
edition = "2021"
authors = ["SensorFleet R&D <rd.contact@sensorfleet.com>"]
homepage = "https://github.com/sensorfleet/pktreplay"
repository = "https://github.com/sensorfleet/pktreplay"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2022 Jukka Taimisto
Copyright (c) 2023 SensorFleet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Pktreplay

`pktreplay` can be used to read packets from `pcap` file or interface and write
them into interface. By default packets are written with the same rate they have
`pktreplay` reads packets from `pcap` file or interface and writes them into
output interface. By default packets are written with the same rate they have
been saved into the pcap file, or, when reading from interface, as fast as they
are received.

`pktreplay` takes its inspiration from
[tcpreplay](https://tcpreplay.appneta.com), but without packet editing
capabilities.

`pktreplay` uses [libpcap](https://www.tcpdump.org/index.html) through Rust
-bindings provided by [luomu-libpcap](https://github.com/sensorfu/luomu-libpcap)
to access network data and `pcap` files.

## Usage

`pktreplay` needs to be run as `root` or (on Linux) with `cap_net_raw`
Expand All @@ -24,9 +28,9 @@ Following command line options are available:
- `-l` or `--loop`: Loop packets from file, that is start writing packets again
from the beginning once all packets are written. Program terminates when user
presses ctrl+c.
- `-c` or `--count <NUM>`: Read only NUM first packets from the file and output
them. If `--loop` is set, then loop the first NUM packets.
- `-S` or `--stats <SEC>`: Print statistics every SEC seconds.
- `-c` or `--count <NUM>`: Read only `NUM` first packets from the file and
output them. If `--loop` is set, then loop the first NUM packets.
- `-S` or `--stats <SEC>`: Print statistics every `SEC`` seconds.
- Options to control packet rate. Only one can be given, if none of these
options is present, packets are written with the rate they have been saved to
the `pcap` file or as soon as they are received from interface:
Expand All @@ -37,13 +41,13 @@ Following command line options are available:
bits per second.
- Options to control internal packet buffer size. `pktreplay` reads packets into
internal buffer from where they are written to interface.
- `-H` or `--hi <NUM>`: Maximum number of packets to buffer. After this many
- `-H` or `--high <NUM>`: Maximum number of packets to buffer. After this many
packets are buffered, no more packets are read into the buffer until buffer
contains only `low` number of packets.
- `-L` or `--low <NUM>`: Low watermark for packet buffer. If buffer contains
only this number of packets, new packets are read into the buffer until the
buffer contains `hi` number of packets. Default value for this is half of
the maximum number of packets.

After packets are written, a summary is written. The program can be terminated
by pressing `ctrl+C`.
After packets are written, a summary is written to `stdout`. The program can be
terminated by pressing `ctrl+C`.

0 comments on commit 4b772e8

Please sign in to comment.