1.\" Copyright (c) 2016 Luigi Rizzo, Universita` di Pisa 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.Dd December 21, 2018 26.Dt NMREPLAY 8 27.Os 28.Sh NAME 29.Nm nmreplay 30.Nd playback a pcap file through a netmap interface 31.Sh SYNOPSIS 32.Bk -words 33.Bl -tag -width "nmreplay" 34.It Nm 35.Op Fl f Ar pcap-file 36.Op Fl i Ar netmap-interface 37.Op Fl B Ar bandwidth 38.Op Fl D Ar delay 39.Op Fl L Ar loss 40.Op Fl b Ar batch size 41.Op Fl w Ar wait-link 42.Op Fl v 43.Op Fl C Ar cpu-placement 44.El 45.Ek 46.Sh DESCRIPTION 47.Nm 48works like 49.Nm tcpreplay 50to replay a pcap file through a netmap interface, 51with programmable rates and possibly delays, losses 52and packet alterations. 53.Nm 54is designed to run at high speed, so the transmit schedule 55is computed ahead of time, and the thread in charge of transmission 56only has to pump data through the interface. 57.Nm 58can connect to any type of netmap port. 59.Pp 60Command line options are as follows 61.Bl -tag -width Ds 62.It Fl f Ar pcap-file 63Name of the pcap file to replay. 64.It Fl i Ar interface 65Name of the netmap interface to use as output. 66See 67.Xr netmap 4 68for interface name format. 69.It Fl v 70Enable verbose mode 71.It Fl b Ar batch-size 72Maximum batch size to use during transmissions. 73.Nm 74normally transmits packets one at a time, but it may use 75larger batches, up to the value specified with this option, 76when running at high rates. 77.It Fl B Ar bps | Cm constant , Ns Ar bps | Cm ether , Ns Ar bps | Cm real Ns Op , Ns Ar speedup 78Bandwidth to be used for transmission. 79.Ar bps 80is a floating point number optionally follow by a character 81(k, K, m, M, g, G) that multiplies the value by 10^3, 10^6 and 10^9 82respectively. 83.Cm constant 84(can be omitted) means that the bandwidth will be computed 85with reference to the actual packet size (excluding CRC and framing). 86.Cm ether 87indicates that the ethernet framing (160 bits) and CRC (32 bits) 88will be included in the computation of the packet size. 89.Cm real 90means transmission will occur according to the timestamps 91recorded in the trace. 92The optional 93.Ar speedup 94multiplier (defaults to 1) indicates how much faster 95or slower than real time the trace should be replayed. 96.It Fl D Ar dt | Cm constant , Ns Ar dt | Cm uniform , Ns Ar dmin,dmax | Cm exp , Ar dmin,davg 97Adds additional delay to the packet transmission, whose distribution 98can be constant, uniform or exponential. 99.Ar dt, dmin, dmax, avt 100are times expressed as floating point numbers optionally followed 101by a character (s, m, u, n) to indicate seconds, milliseconds, 102microseconds, nanoseconds. 103The delay is added to the transmit time and adjusted so that there is 104never packet reordering. 105.It Fl L Ar x | Cm plr , Ns Ar x | Cm ber , Ns Ar x 106Simulates packet or bit errors, causing offending packets to be dropped. 107.Ar x 108is a floating point number indicating the packet or bit error rate. 109.It Fl w Ar wait-link 110indicates the number of seconds to wait before transmitting. 111It defaults to 2, and may be useful when talking to physical 112ports to let link negotiation complete before starting transmission. 113.El 114.Sh OPERATION 115.Nm 116creates an in-memory schedule with all packets to be transmitted, 117and then launches a separate thread to take care of transmissions 118while the main thread reports statistics every second. 119.Sh SEE ALSO 120.Xr netmap 4 121.Sh AUTHORS 122.An -nosplit 123.Nm 124has been written by 125.An Luigi Rizzo, Andrea Beconcini, Francesco Mola and Lorenzo Biagini 126at the Universita` di Pisa, Italy. 127