1.\" Copyright (c) 2008 George V. Neville-Neil
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.\" $FreeBSD$
26.\"
27.Dd December 23, 2008
28.Dt ETHER_REFLECT 1
29.Os
30.Sh NAME
31.Nm ether_reflect
32.Nd "reflect ethernet packets"
33.Sh SYNOPSIS
34.Nm
35.Op Fl a Ar ethernet address
36.Op Fl e Ar ethertype
37.Op Fl i Ar interface
38.Op Fl t Ar timeout
39.Op Fl p
40.Op Fl d
41.Sh DESCRIPTION
42The
43.Nm
44command implements a simple ethernet packet reflector using the
45.Xr PCAP 3
46library and
47.Xr bpf 4 ,
48the Berkeley Packet Filter.  The program is useful primarily to test
49the low level round trip time of packets through an Ethernet interface
50and/or a switch.  Network protocols, such as IP, and the network stack
51in general are never invoked, only the device driver that implements
52the particular interface is executed.  As the
53.Nm
54command uses the
55.Xr bpf 4
56device the user must have root privileges to execute this program.
57.Pp
58The options are as follows:
59.Bl -tag -width ".Fl d Ar argument"
60.It Fl a Ar address
61Instead of reversing the ethernet destination and source addresses
62supply a different destination ethernet address for each packet
63received.
64.It Fl e Ar ether type
65Use a different ethertype than the default, 0x8822, which is the IEEE
66ether type for driver testing.
67.It Fl i Ar interface
68Network interface, which can be found with ifconfig(1).
69.It Fl t Ar timeout
70The time, in milliseconds, to wait for a packet.  Lower times decrease
71latency at the cost of CPU.
72.It Fl p
73Set the device into promiscuous mode before testing.  This is not
74usually necessary.
75.It Fl d
76Debug output.  Print various small pieces of debug information.
77.El
78.Sh EXAMPLES
79The following is an example of a typical usage
80of the
81.Nm
82command:
83.Pp
84.Dl "ether_reflect -i em0 -t 1"
85.Pp
86Reflect all test packets, those with an ether type of 0x8822, which
87are seen on ineterface em0.  The timeout is 1 millisecond.
88.Pp
89.Dl "ether_reflect -i em0 -a 00:00:00:aa:bb:cc -t 1"
90.Pp
91Rewrite the destination address in each packet to 00:00:00:aa:bb:cc
92before reflecting the packet.
93.Sh SEE ALSO
94.Xr tcpdump 1 ,
95.Xr bpf 2 ,
96.Xr pcap 4 ,
97.Xr ifconfig 8
98.Sh HISTORY
99The
100.Nm
101program first appeared in
102.Fx 8.0 .
103.Sh AUTHORS
104This
105manual page was written by
106.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org .
107.Sh BUGS
108Should be reported to the author or to
109.Aq Mt net@FreeBSD.org .
110