xref: /freebsd/share/man/man4/siftr.4 (revision d9550d0229a07be5240e68963a89d5a987d9c18c)
1a5548bf6SLawrence Stewart.\"
2a5548bf6SLawrence Stewart.\" Copyright (c) 2010 The FreeBSD Foundation
3a5548bf6SLawrence Stewart.\" All rights reserved.
4a5548bf6SLawrence Stewart.\"
5a5548bf6SLawrence Stewart.\" Portions of this software were developed at the Centre for Advanced
6a5548bf6SLawrence Stewart.\" Internet Architectures, Swinburne University of Technology, Melbourne,
7a5548bf6SLawrence Stewart.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
8a5548bf6SLawrence Stewart.\" Foundation.
9a5548bf6SLawrence Stewart.\"
10a5548bf6SLawrence Stewart.\" Redistribution and use in source and binary forms, with or without
11a5548bf6SLawrence Stewart.\" modification, are permitted provided that the following conditions
12a5548bf6SLawrence Stewart.\" are met:
13a5548bf6SLawrence Stewart.\" 1. Redistributions of source code must retain the above copyright
14a5548bf6SLawrence Stewart.\"    notice, this list of conditions, and the following disclaimer,
15a5548bf6SLawrence Stewart.\"    without modification, immediately at the beginning of the file.
16a5548bf6SLawrence Stewart.\" 2. The name of the author may not be used to endorse or promote products
17a5548bf6SLawrence Stewart.\"    derived from this software without specific prior written permission.
18a5548bf6SLawrence Stewart.\"
19a5548bf6SLawrence Stewart.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20a5548bf6SLawrence Stewart.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21a5548bf6SLawrence Stewart.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22a5548bf6SLawrence Stewart.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23a5548bf6SLawrence Stewart.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24a5548bf6SLawrence Stewart.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25a5548bf6SLawrence Stewart.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26a5548bf6SLawrence Stewart.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27a5548bf6SLawrence Stewart.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28a5548bf6SLawrence Stewart.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29a5548bf6SLawrence Stewart.\" SUCH DAMAGE.
30a5548bf6SLawrence Stewart.\"
31a5548bf6SLawrence Stewart.\" $FreeBSD$
32a5548bf6SLawrence Stewart.\"
33d25e560aSLawrence Stewart.Dd November 12, 2010
34a5548bf6SLawrence Stewart.Dt SIFTR 4
35a5548bf6SLawrence Stewart.Os
36a5548bf6SLawrence Stewart.Sh NAME
37a5548bf6SLawrence Stewart.Nm SIFTR
38a5548bf6SLawrence Stewart.Nd Statistical Information For TCP Research
39a5548bf6SLawrence Stewart.Sh SYNOPSIS
40a5548bf6SLawrence StewartTo load
41a5548bf6SLawrence Stewart.Ns Nm
42a5548bf6SLawrence Stewartas a module at run-time, run the following command as root:
43a5548bf6SLawrence Stewart.Bd -literal -offset indent
44a5548bf6SLawrence Stewartkldload siftr
45a5548bf6SLawrence Stewart.Ed
46a5548bf6SLawrence Stewart.Pp
47a5548bf6SLawrence StewartAlternatively, to load
48a5548bf6SLawrence Stewart.Ns Nm
49a5548bf6SLawrence Stewartas a module at boot time, add the following line into the
50a5548bf6SLawrence Stewart.Xr loader.conf 5
51a5548bf6SLawrence Stewartfile:
52a5548bf6SLawrence Stewart.Bd -literal -offset indent
53a5548bf6SLawrence Stewartsiftr_load="YES"
54a5548bf6SLawrence Stewart.Ed
55a5548bf6SLawrence Stewart.Sh DESCRIPTION
56a5548bf6SLawrence Stewart.Nm
57a5548bf6SLawrence Stewart.Ns ( Em S Ns tatistical
58a5548bf6SLawrence Stewart.Em I Ns nformation
59a5548bf6SLawrence Stewart.Em F Ns or
60a5548bf6SLawrence Stewart.Em T Ns CP
61a5548bf6SLawrence Stewart.Em R Ns esearch )
62a5548bf6SLawrence Stewartis a kernel module that logs a range of statistics on active TCP connections to
63a5548bf6SLawrence Stewarta log file.
64a5548bf6SLawrence StewartIt provides the ability to make highly granular measurements of TCP connection
65a5548bf6SLawrence Stewartstate, aimed at system administrators, developers and researchers.
66a5548bf6SLawrence Stewart.Ss Compile-time Configuration
67a5548bf6SLawrence StewartThe default operation of
68a5548bf6SLawrence Stewart.Nm
69a5548bf6SLawrence Stewartis to capture IPv4 TCP/IP packets.
70a5548bf6SLawrence Stewart.Nm
71a5548bf6SLawrence Stewartcan be configured to support IPv4 and IPv6 by uncommenting:
72a5548bf6SLawrence Stewart.Bd -literal -offset indent
73a5548bf6SLawrence StewartCFLAGS+=-DSIFTR_IPV6
74a5548bf6SLawrence Stewart.Ed
75a5548bf6SLawrence Stewart.Pp
76a5548bf6SLawrence Stewartin
77a5548bf6SLawrence Stewart.Aq sys/modules/siftr/Makefile
78a5548bf6SLawrence Stewartand recompiling.
79a5548bf6SLawrence Stewart.Pp
80a5548bf6SLawrence StewartIn the IPv4-only (default) mode, standard dotted decimal notation (e.g.
81a5548bf6SLawrence Stewart"136.186.229.95") is used to format IPv4 addresses for logging.
82a5548bf6SLawrence StewartIn IPv6 mode, standard dotted decimal notation is used to format IPv4 addresses,
83a5548bf6SLawrence Stewartand standard colon-separated hex notation (see RFC 4291) is used to format IPv6
84a5548bf6SLawrence Stewartaddresses for logging. Note that SIFTR uses uncompressed notation to format IPv6
85a5548bf6SLawrence Stewartaddresses.
86a5548bf6SLawrence StewartFor example, the address "fe80::20f:feff:fea2:531b" would be logged as
87a5548bf6SLawrence Stewart"fe80:0:0:0:20f:feff:fea2:531b".
88a5548bf6SLawrence Stewart.Ss Run-time Configuration
89a5548bf6SLawrence Stewart.Nm
90a5548bf6SLawrence Stewartutilises the
91a5548bf6SLawrence Stewart.Xr sysctl 8
92a5548bf6SLawrence Stewartinterface to export its configuration variables to user-space.
93a5548bf6SLawrence StewartThe following variables are available:
94a5548bf6SLawrence Stewart.Bl -tag -offset indent
95a5548bf6SLawrence Stewart.It Va net.inet.siftr.enabled
96a5548bf6SLawrence Stewartcontrols whether the module performs its
97a5548bf6SLawrence Stewartmeasurements or not.
98a5548bf6SLawrence StewartBy default, the value is set to 0, which means the module
99a5548bf6SLawrence Stewartwill not be taking any measurements.
100a5548bf6SLawrence StewartHaving the module loaded with
101a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled
102a5548bf6SLawrence Stewartset to 0 will have no impact on the performance of the network stack, as the
103a5548bf6SLawrence Stewartpacket filtering hooks are only inserted when
104a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled
105a5548bf6SLawrence Stewartis set to 1.
106a5548bf6SLawrence Stewart.El
107a5548bf6SLawrence Stewart.Bl -tag -offset indent
108a5548bf6SLawrence Stewart.It Va net.inet.siftr.ppl
109a5548bf6SLawrence Stewartcontrols how many inbound/outbound packets for a given TCP connection will cause
110a5548bf6SLawrence Stewarta log message to be generated for the connection.
111a5548bf6SLawrence StewartBy default, the value is set to 1, which means the module will log a message for
112a5548bf6SLawrence Stewartevery packet of every TCP connection.
113a5548bf6SLawrence StewartThe value can be set to any integer in the range [1,2^32], and can be changed at
114a5548bf6SLawrence Stewartany time, even while the module is enabled.
115a5548bf6SLawrence Stewart.El
116a5548bf6SLawrence Stewart.Bl -tag -offset indent
117a5548bf6SLawrence Stewart.It Va net.inet.siftr.logfile
118a5548bf6SLawrence Stewartcontrols the path to the file that the module writes its log messages to.
119a5548bf6SLawrence StewartBy default, the file /var/log/siftr.log is used.
120a5548bf6SLawrence StewartThe path can be changed at any time, even while the module is enabled.
121a5548bf6SLawrence Stewart.El
122a5548bf6SLawrence Stewart.Bl -tag -offset indent
123a5548bf6SLawrence Stewart.It Va net.inet.siftr.genhashes
124a5548bf6SLawrence Stewartcontrols whether a hash is generated for each TCP packet seen by
125a5548bf6SLawrence Stewart.Nm .
126a5548bf6SLawrence StewartBy default, the value is set to 0, which means no hashes are generated.
127a5548bf6SLawrence StewartThe hashes are useful to correlate which TCP packet triggered the generation of
128a5548bf6SLawrence Stewarta particular log message, but calculating them adds additional computational
129a5548bf6SLawrence Stewartoverhead into the fast path.
130a5548bf6SLawrence Stewart.El
131a5548bf6SLawrence Stewart.Ss Log Format
132a5548bf6SLawrence StewartA typical
133a5548bf6SLawrence Stewart.Nm
134a5548bf6SLawrence Stewartlog file will contain 3 different types of log message.
135a5548bf6SLawrence StewartAll messages are written in plain ASCII text.
136a5548bf6SLawrence Stewart.Pp
137a5548bf6SLawrence StewartNote: The
138a5548bf6SLawrence Stewart.Qq \e
139a5548bf6SLawrence Stewartpresent in the example log messages in this section indicates a
140a5548bf6SLawrence Stewartline continuation and is not part of the actual log message
141a5548bf6SLawrence Stewart.Pp
142a5548bf6SLawrence StewartThe first type of log message is written to the file when the module is
143a5548bf6SLawrence Stewartenabled and starts collecting data from the running kernel. The text below
144a5548bf6SLawrence Stewartshows an example module enable log. The fields are tab delimited key-value
145a5548bf6SLawrence Stewartpairs which describe some basic information about the system.
146a5548bf6SLawrence Stewart.Bd -literal -offset indent
147a5548bf6SLawrence Stewartenable_time_secs=1238556193    enable_time_usecs=462104 \\
148a5548bf6SLawrence Stewartsiftrver=1.2.2    hz=1000    tcp_rtt_scale=32 \\
149a5548bf6SLawrence Stewartsysname=FreeBSD    sysver=604000    ipmode=4
150a5548bf6SLawrence Stewart.Ed
151a5548bf6SLawrence Stewart.Pp
152a5548bf6SLawrence StewartField descriptions are as follows:
153a5548bf6SLawrence Stewart.Bl -tag -offset indent
154a5548bf6SLawrence Stewart.It Va enable_time_secs
155a5548bf6SLawrence Stewarttime at which the module was enabled, in seconds since the UNIX epoch.
156a5548bf6SLawrence Stewart.El
157a5548bf6SLawrence Stewart.Bl -tag -offset indent
158a5548bf6SLawrence Stewart.It Va enable_time_usecs
159a5548bf6SLawrence Stewarttime at which the module was enabled, in microseconds since enable_time_secs.
160a5548bf6SLawrence Stewart.El
161a5548bf6SLawrence Stewart.Bl -tag -offset indent
162a5548bf6SLawrence Stewart.It Va siftrver
163a5548bf6SLawrence Stewartversion of
164a5548bf6SLawrence Stewart.Nm .
165a5548bf6SLawrence Stewart.El
166a5548bf6SLawrence Stewart.Bl -tag -offset indent
167a5548bf6SLawrence Stewart.It Va hz
168a5548bf6SLawrence Stewarttick rate of the kernel in ticks per second.
169a5548bf6SLawrence Stewart.El
170a5548bf6SLawrence Stewart.Bl -tag -offset indent
171a5548bf6SLawrence Stewart.It Va tcp_rtt_scale
172a5548bf6SLawrence Stewartsmoothed RTT estimate scaling factor
173a5548bf6SLawrence Stewart.El
174a5548bf6SLawrence Stewart.Bl -tag -offset indent
175a5548bf6SLawrence Stewart.It Va sysname
176a5548bf6SLawrence Stewartoperating system name
177a5548bf6SLawrence Stewart.El
178a5548bf6SLawrence Stewart.Bl -tag -offset indent
179a5548bf6SLawrence Stewart.It Va sysver
180a5548bf6SLawrence Stewartoperating system version
181a5548bf6SLawrence Stewart.El
182a5548bf6SLawrence Stewart.Bl -tag -offset indent
183a5548bf6SLawrence Stewart.It Va ipmode
184a5548bf6SLawrence StewartIP mode as defined at compile time.
185a5548bf6SLawrence StewartAn ipmode of "4" means IPv6 is not supported and IP addresses are logged in
186a5548bf6SLawrence Stewartregular dotted quad format.
187a5548bf6SLawrence StewartAn ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted
188a5548bf6SLawrence Stewartquad or hex format, as described in the
189a5548bf6SLawrence Stewart.Qq Compile-time Configuration
190a5548bf6SLawrence Stewartsubsection.
191a5548bf6SLawrence Stewart.El
192a5548bf6SLawrence Stewart.Pp
193a5548bf6SLawrence StewartThe second type of log message is written to the file when a data log message
194a5548bf6SLawrence Stewartis generated.
195a5548bf6SLawrence StewartThe text below shows an example data log triggered by an IPv4
196a5548bf6SLawrence StewartTCP/IP packet.
197a5548bf6SLawrence StewartThe data is CSV formatted.
198a5548bf6SLawrence Stewart.Bd -literal -offset indent
199a5548bf6SLawrence Stewarto,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\
200a5548bf6SLawrence Stewart1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\
201d4d3e218SLawrence Stewart33304,208,66608,0,208,0
202a5548bf6SLawrence Stewart.Ed
203a5548bf6SLawrence Stewart.Pp
204a5548bf6SLawrence StewartField descriptions are as follows:
205a5548bf6SLawrence Stewart.Bl -tag -offset indent
206a5548bf6SLawrence Stewart.It Va 1
207a5548bf6SLawrence StewartDirection of packet that triggered the log message.
208a5548bf6SLawrence StewartEither
209a5548bf6SLawrence Stewart.Qq i
210a5548bf6SLawrence Stewartfor in, or
211a5548bf6SLawrence Stewart.Qq o
212a5548bf6SLawrence Stewartfor out.
213a5548bf6SLawrence Stewart.El
214a5548bf6SLawrence Stewart.Bl -tag -offset indent
215a5548bf6SLawrence Stewart.It Va 2
216a5548bf6SLawrence StewartHash of the packet that triggered the log message.
217a5548bf6SLawrence Stewart.El
218a5548bf6SLawrence Stewart.Bl -tag -offset indent
219a5548bf6SLawrence Stewart.It Va 3
220a5548bf6SLawrence StewartTime at which the packet that triggered the log message was processed by
221a5548bf6SLawrence Stewartthe
222a5548bf6SLawrence Stewart.Xr pfil 9
223a5548bf6SLawrence Stewarthook function, in seconds and microseconds since the UNIX epoch.
224a5548bf6SLawrence Stewart.El
225a5548bf6SLawrence Stewart.Bl -tag -offset indent
226a5548bf6SLawrence Stewart.It Va 4
227a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet)
228a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation.
229a5548bf6SLawrence Stewart.El
230a5548bf6SLawrence Stewart.Bl -tag -offset indent
231a5548bf6SLawrence Stewart.It Va 5
232a5548bf6SLawrence StewartThe TCP port that the local host is communicating via.
233a5548bf6SLawrence Stewart.El
234a5548bf6SLawrence Stewart.Bl -tag -offset indent
235a5548bf6SLawrence Stewart.It Va 6
236a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet)
237a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation.
238a5548bf6SLawrence Stewart.El
239a5548bf6SLawrence Stewart.Bl -tag -offset indent
240a5548bf6SLawrence Stewart.It Va 7
241a5548bf6SLawrence StewartThe TCP port that the foreign host is communicating via.
242a5548bf6SLawrence Stewart.El
243a5548bf6SLawrence Stewart.Bl -tag -offset indent
244a5548bf6SLawrence Stewart.It Va 8
245a5548bf6SLawrence StewartThe slow start threshold for the flow, in bytes.
246a5548bf6SLawrence Stewart.El
247a5548bf6SLawrence Stewart.Bl -tag -offset indent
248a5548bf6SLawrence Stewart.It Va 9
249a5548bf6SLawrence StewartThe current congestion window for the flow, in bytes.
250a5548bf6SLawrence Stewart.El
251a5548bf6SLawrence Stewart.Bl -tag -offset indent
252a5548bf6SLawrence Stewart.It Va 10
253a5548bf6SLawrence StewartThe current bandwidth-controlled window for the flow, in bytes.
254a5548bf6SLawrence Stewart.El
255a5548bf6SLawrence Stewart.Bl -tag -offset indent
256a5548bf6SLawrence Stewart.It Va 11
257a5548bf6SLawrence StewartThe current sending window for the flow, in bytes.
258a5548bf6SLawrence StewartThe post scaled value is reported, except during the initial handshake (first
259a5548bf6SLawrence Stewartfew packets), during which time the unscaled value is reported.
260a5548bf6SLawrence Stewart.El
261a5548bf6SLawrence Stewart.Bl -tag -offset indent
262a5548bf6SLawrence Stewart.It Va 12
263a5548bf6SLawrence StewartThe current receive window for the flow, in bytes.
264a5548bf6SLawrence StewartThe post scaled value is always reported.
265a5548bf6SLawrence Stewart.El
266a5548bf6SLawrence Stewart.Bl -tag -offset indent
267a5548bf6SLawrence Stewart.It Va 13
268a5548bf6SLawrence StewartThe current window scaling factor for the sending window.
269a5548bf6SLawrence Stewart.El
270a5548bf6SLawrence Stewart.Bl -tag -offset indent
271a5548bf6SLawrence Stewart.It Va 14
272a5548bf6SLawrence StewartThe current window scaling factor for the receiving window.
273a5548bf6SLawrence Stewart.El
274a5548bf6SLawrence Stewart.Bl -tag -offset indent
275a5548bf6SLawrence Stewart.It Va 15
276a5548bf6SLawrence StewartThe current state of the TCP finite state machine, as defined
277a5548bf6SLawrence Stewartin
278a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_fsm.h .
279a5548bf6SLawrence Stewart.El
280a5548bf6SLawrence Stewart.Bl -tag -offset indent
281a5548bf6SLawrence Stewart.It Va 16
282a5548bf6SLawrence StewartThe maximum segment size for the flow, in bytes.
283a5548bf6SLawrence Stewart.El
284a5548bf6SLawrence Stewart.Bl -tag -offset indent
285a5548bf6SLawrence Stewart.It Va 17
286a5548bf6SLawrence StewartThe current smoothed RTT estimate for the flow, in units of TCP_RTT_SCALE * HZ,
287a5548bf6SLawrence Stewartwhere TCP_RTT_SCALE is a define found in tcp_var.h, and HZ is the kernel's tick
288a5548bf6SLawrence Stewarttimer.
289a5548bf6SLawrence StewartDivide by TCP_RTT_SCALE * HZ to get the RTT in secs. TCP_RTT_SCALE and HZ are
290a5548bf6SLawrence Stewartreported in the enable log message.
291a5548bf6SLawrence Stewart.El
292a5548bf6SLawrence Stewart.Bl -tag -offset indent
293a5548bf6SLawrence Stewart.It Va 18
294a5548bf6SLawrence StewartSACK enabled indicator. 1 if SACK enabled, 0 otherwise.
295a5548bf6SLawrence Stewart.El
296a5548bf6SLawrence Stewart.Bl -tag -offset indent
297a5548bf6SLawrence Stewart.It Va 19
298a5548bf6SLawrence StewartThe current state of the TCP flags for the flow.
299a5548bf6SLawrence StewartSee
300a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_var.h
301a5548bf6SLawrence Stewartfor information about the various flags.
302a5548bf6SLawrence Stewart.El
303a5548bf6SLawrence Stewart.Bl -tag -offset indent
304a5548bf6SLawrence Stewart.It Va 20
305a5548bf6SLawrence StewartThe current retransmission timeout length for the flow, in units of HZ, where HZ
306a5548bf6SLawrence Stewartis the kernel's tick timer.
307a5548bf6SLawrence StewartDivide by HZ to get the timeout length in seconds. HZ is reported in the
308a5548bf6SLawrence Stewartenable log message.
309a5548bf6SLawrence Stewart.El
310a5548bf6SLawrence Stewart.Bl -tag -offset indent
311a5548bf6SLawrence Stewart.It Va 21
312a5548bf6SLawrence StewartThe current size of the socket send buffer in bytes.
313a5548bf6SLawrence Stewart.El
314a5548bf6SLawrence Stewart.Bl -tag -offset indent
315a5548bf6SLawrence Stewart.It Va 22
316a5548bf6SLawrence StewartThe current number of bytes in the socket send buffer.
317a5548bf6SLawrence Stewart.El
318a5548bf6SLawrence Stewart.Bl -tag -offset indent
319a5548bf6SLawrence Stewart.It Va 23
320a5548bf6SLawrence StewartThe current size of the socket receive buffer in bytes.
321a5548bf6SLawrence Stewart.El
322a5548bf6SLawrence Stewart.Bl -tag -offset indent
323a5548bf6SLawrence Stewart.It Va 24
324a5548bf6SLawrence StewartThe current number of bytes in the socket receive buffer.
325a5548bf6SLawrence Stewart.El
326a5548bf6SLawrence Stewart.Bl -tag -offset indent
327a5548bf6SLawrence Stewart.It Va 25
328a5548bf6SLawrence StewartThe current number of unacknowledged bytes in-flight.
329a5548bf6SLawrence StewartBytes acknowledged via SACK are not excluded from this count.
330a5548bf6SLawrence Stewart.El
331d4d3e218SLawrence Stewart.Bl -tag -offset indent
332d4d3e218SLawrence Stewart.It Va 26
333d4d3e218SLawrence StewartThe current number of segments in the reassembly queue.
334d4d3e218SLawrence Stewart.El
335a5548bf6SLawrence Stewart.Pp
336a5548bf6SLawrence StewartThe third type of log message is written to the file when the module is disabled
337a5548bf6SLawrence Stewartand ceases collecting data from the running kernel.
338a5548bf6SLawrence StewartThe text below shows an example module disable log.
339a5548bf6SLawrence StewartThe fields are tab delimited key-value pairs which provide statistics about
340a5548bf6SLawrence Stewartoperations since the module was most recently enabled.
341a5548bf6SLawrence Stewart.Bd -literal -offset indent
342a5548bf6SLawrence Stewartdisable_time_secs=1238556197    disable_time_usecs=933607 \\
343a5548bf6SLawrence Stewartnum_inbound_tcp_pkts=356    num_outbound_tcp_pkts=627 \\
344a5548bf6SLawrence Stewarttotal_tcp_pkts=983    num_inbound_skipped_pkts_malloc=0 \\
345a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_malloc=0    num_inbound_skipped_pkts_mtx=0 \\
346a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_mtx=0    num_inbound_skipped_pkts_tcb=0 \\
347a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_tcb=0    num_inbound_skipped_pkts_icb=0 \\
348a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_icb=0    total_skipped_tcp_pkts=0 \\
349a5548bf6SLawrence Stewartflow_list=172.16.7.28;22-172.16.2.5;55931,
350a5548bf6SLawrence Stewart.Ed
351a5548bf6SLawrence Stewart.Pp
352a5548bf6SLawrence StewartField descriptions are as follows:
353a5548bf6SLawrence Stewart.Bl -tag -offset indent
354a5548bf6SLawrence Stewart.It Va disable_time_secs
355a5548bf6SLawrence StewartTime at which the module was disabled, in seconds since the UNIX epoch.
356a5548bf6SLawrence Stewart.El
357a5548bf6SLawrence Stewart.Bl -tag -offset indent
358a5548bf6SLawrence Stewart.It Va disable_time_usecs
359a5548bf6SLawrence StewartTime at which the module was disabled, in microseconds since disable_time_secs.
360a5548bf6SLawrence Stewart.El
361a5548bf6SLawrence Stewart.Bl -tag -offset indent
362a5548bf6SLawrence Stewart.It Va num_inbound_tcp_pkts
363a5548bf6SLawrence StewartNumber of TCP packets that traversed up the network stack.
364a5548bf6SLawrence StewartThis only includes inbound TCP packets during the periods when
365a5548bf6SLawrence Stewart.Nm
366a5548bf6SLawrence Stewartwas enabled.
367a5548bf6SLawrence Stewart.El
368a5548bf6SLawrence Stewart.Bl -tag -offset indent
369a5548bf6SLawrence Stewart.It Va num_outbound_tcp_pkts
370a5548bf6SLawrence StewartNumber of TCP packets that traversed down the network stack.
371a5548bf6SLawrence StewartThis only includes outbound TCP packets during the periods when
372a5548bf6SLawrence Stewart.Nm
373a5548bf6SLawrence Stewartwas enabled.
374a5548bf6SLawrence Stewart.El
375a5548bf6SLawrence Stewart.Bl -tag -offset indent
376a5548bf6SLawrence Stewart.It Va total_tcp_pkts
377a5548bf6SLawrence StewartThe summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts.
378a5548bf6SLawrence Stewart.El
379a5548bf6SLawrence Stewart.Bl -tag -offset indent
380a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_malloc
381a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failed malloc() calls.
382a5548bf6SLawrence Stewart.El
383a5548bf6SLawrence Stewart.Bl -tag -offset indent
384a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_malloc
385a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failed malloc() calls.
386a5548bf6SLawrence Stewart.El
387a5548bf6SLawrence Stewart.Bl -tag -offset indent
388a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_mtx
389a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to add the
390a5548bf6SLawrence Stewartpacket to the packet processing queue.
391a5548bf6SLawrence Stewart.El
392a5548bf6SLawrence Stewart.Bl -tag -offset indent
393a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_mtx
394a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to add the
395a5548bf6SLawrence Stewartpacket to the packet processing queue.
396a5548bf6SLawrence Stewart.El
397a5548bf6SLawrence Stewart.Bl -tag -offset indent
398a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_tcb
399a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the
400a5548bf6SLawrence StewartTCP control block associated with the packet.
401a5548bf6SLawrence Stewart.El
402a5548bf6SLawrence Stewart.Bl -tag -offset indent
403a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_tcb
404a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find
405a5548bf6SLawrence Stewartthe TCP control block associated with the packet.
406a5548bf6SLawrence Stewart.El
407a5548bf6SLawrence Stewart.Bl -tag -offset indent
408a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_icb
409a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the
410a5548bf6SLawrence StewartIP control block associated with the packet.
411a5548bf6SLawrence Stewart.El
412a5548bf6SLawrence Stewart.Bl -tag -offset indent
413a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_icb
414a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find
415a5548bf6SLawrence Stewartthe IP control block associated with the packet.
416a5548bf6SLawrence Stewart.El
417a5548bf6SLawrence Stewart.Bl -tag -offset indent
418a5548bf6SLawrence Stewart.It Va total_skipped_tcp_pkts
419a5548bf6SLawrence StewartThe summation of all skipped packet counters.
420a5548bf6SLawrence Stewart.El
421a5548bf6SLawrence Stewart.Bl -tag -offset indent
422a5548bf6SLawrence Stewart.It Va flow_list
423a5548bf6SLawrence StewartA CSV list of TCP flows that triggered data log messages to be generated since
424a5548bf6SLawrence Stewartthe module was loaded.
425a5548bf6SLawrence StewartEach flow entry in the CSV list is
426a5548bf6SLawrence Stewartformatted as
427a5548bf6SLawrence Stewart.Qq local_ip;local_port-foreign_ip;foreign_port .
428a5548bf6SLawrence StewartIf there are no entries in the list (i.e. no data log messages were generated),
429a5548bf6SLawrence Stewartthe value will be blank.
430a5548bf6SLawrence StewartIf there is at least one entry in the list, a trailing comma will always be
431a5548bf6SLawrence Stewartpresent.
432a5548bf6SLawrence Stewart.El
433a5548bf6SLawrence Stewart.Pp
434a5548bf6SLawrence StewartThe total number of data log messages found in the log file for a module
435a5548bf6SLawrence Stewartenable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts.
436a5548bf6SLawrence Stewart.Sh IMPLEMENTATION NOTES
437a5548bf6SLawrence Stewart.Nm
438a5548bf6SLawrence Stewarthooks into the network stack using the
439a5548bf6SLawrence Stewart.Xr pfil 9
440a5548bf6SLawrence Stewartinterface.
441a5548bf6SLawrence StewartIn its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6)
442a5548bf6SLawrence Stewart.Xr pfil 9
443a5548bf6SLawrence Stewartfiltering points, which means it sees packets at the IP layer of the network
444a5548bf6SLawrence Stewartstack.
445a5548bf6SLawrence StewartThis means that TCP packets inbound to the stack are intercepted before
446a5548bf6SLawrence Stewartthey have been processed by the TCP layer.
447a5548bf6SLawrence StewartPackets outbound from the stack are intercepted after they have been processed
448a5548bf6SLawrence Stewartby the TCP layer.
449a5548bf6SLawrence Stewart.Pp
450a5548bf6SLawrence StewartThe diagram below illustrates how
451a5548bf6SLawrence Stewart.Nm
452a5548bf6SLawrence Stewartinserts itself into the stack.
453a5548bf6SLawrence Stewart.Bd -literal -offset indent
454a5548bf6SLawrence Stewart----------------------------------
455a5548bf6SLawrence Stewart           Upper Layers
456a5548bf6SLawrence Stewart----------------------------------
457a5548bf6SLawrence Stewart    ^                       |
458a5548bf6SLawrence Stewart    |                       |
459a5548bf6SLawrence Stewart    |                       |
460a5548bf6SLawrence Stewart    |                       v
461a5548bf6SLawrence Stewart TCP in                  TCP out
462a5548bf6SLawrence Stewart----------------------------------
463a5548bf6SLawrence Stewart    ^                      |
464a5548bf6SLawrence Stewart    |________     _________|
465a5548bf6SLawrence Stewart            |     |
466a5548bf6SLawrence Stewart            |     v
467a5548bf6SLawrence Stewart           ---------
468a5548bf6SLawrence Stewart           | SIFTR |
469a5548bf6SLawrence Stewart           ---------
470a5548bf6SLawrence Stewart            ^     |
471a5548bf6SLawrence Stewart    ________|     |__________
472a5548bf6SLawrence Stewart    |                       |
473a5548bf6SLawrence Stewart    |                       v
474a5548bf6SLawrence StewartIPv{4/6} in            IPv{4/6} out
475a5548bf6SLawrence Stewart----------------------------------
476a5548bf6SLawrence Stewart    ^                       |
477a5548bf6SLawrence Stewart    |                       |
478a5548bf6SLawrence Stewart    |                       v
479a5548bf6SLawrence StewartLayer 2 in             Layer 2 out
480a5548bf6SLawrence Stewart----------------------------------
481a5548bf6SLawrence Stewart          Physical Layer
482a5548bf6SLawrence Stewart----------------------------------
483a5548bf6SLawrence Stewart.Ed
484a5548bf6SLawrence Stewart.Pp
485a5548bf6SLawrence Stewart.Nm
486a5548bf6SLawrence Stewartuses the
487a5548bf6SLawrence Stewart.Xr alq 9
488a5548bf6SLawrence Stewartinterface to manage writing data to disk.
489a5548bf6SLawrence Stewart.Pp
490a5548bf6SLawrence StewartAt first glance, you might mistakenly think that
491a5548bf6SLawrence Stewart.Nm
492a5548bf6SLawrence Stewartextracts information from
493a5548bf6SLawrence Stewartindividual TCP packets.
494a5548bf6SLawrence StewartThis is not the case.
495a5548bf6SLawrence Stewart.Nm
496a5548bf6SLawrence Stewartuses TCP packet events (inbound and outbound) for each TCP flow originating from
497a5548bf6SLawrence Stewartthe system to trigger a dump of the state of the TCP control block for that
498a5548bf6SLawrence Stewartflow.
499a5548bf6SLawrence StewartWith the PPL set to 1, we are in effect sampling each TCP flow's control block
500a5548bf6SLawrence Stewartstate as frequently as flow packets enter/leave the system.
501a5548bf6SLawrence StewartFor example, setting PPL to 2 halves the sampling rate i.e. every second flow
502a5548bf6SLawrence Stewartpacket (inbound OR outbound) causes a dump of the control block state.
503a5548bf6SLawrence Stewart.Pp
504a5548bf6SLawrence StewartThe distinction between interrogating individual packets vs interrogating the
505a5548bf6SLawrence Stewartcontrol block is important, because
506a5548bf6SLawrence Stewart.Nm
507a5548bf6SLawrence Stewartdoes not remove the need for packet capturing tools like
508a5548bf6SLawrence Stewart.Xr tcpdump 1 .
509a5548bf6SLawrence Stewart.Nm
510a5548bf6SLawrence Stewartallows you to correlate and observe the cause-and-affect relationship between
511a5548bf6SLawrence Stewartwhat you see on the wire (captured using a tool like
512a5548bf6SLawrence Stewart.Xr tcpdump 1 Ns )
513a5548bf6SLawrence Stewartand changes in the TCP control block corresponding to the flow of interest.
514a5548bf6SLawrence StewartIt is therefore useful to use
515a5548bf6SLawrence Stewart.Nm
516a5548bf6SLawrence Stewartand a tool like
517a5548bf6SLawrence Stewart.Xr tcpdump 1
518a5548bf6SLawrence Stewartto gather the necessary data to piece together the complete picture.
519a5548bf6SLawrence StewartUse of either tool on its own will not be able to provide all of the necessary
520a5548bf6SLawrence Stewartdata.
521a5548bf6SLawrence Stewart.Pp
522a5548bf6SLawrence StewartAs a result of needing to interrogate the TCP control block, certain packets
523a5548bf6SLawrence Stewartduring the lifecycle of a connection are unable to trigger a
524a5548bf6SLawrence Stewart.Nm
525a5548bf6SLawrence Stewartlog message.
526a5548bf6SLawrence StewartThe initial handshake takes place without the existence of a control block and
527a5548bf6SLawrence Stewartthe final ACK is exchanged when the connection is in the TIMEWAIT state.
528a5548bf6SLawrence Stewart.Pp
529a5548bf6SLawrence Stewart.Nm
530a5548bf6SLawrence Stewartwas designed to minimise the delay introduced to packets traversing the network
531a5548bf6SLawrence Stewartstack.
532a5548bf6SLawrence StewartThis design called for a highly optimised and minimal hook function that
533a5548bf6SLawrence Stewartextracted the minimal details necessary whilst holding the packet up, and
534a5548bf6SLawrence Stewartpassing these details to another thread for actual processing and logging.
535a5548bf6SLawrence Stewart.Pp
536a5548bf6SLawrence StewartThis multithreaded design does introduce some contention issues when accessing
537a5548bf6SLawrence Stewartthe data structure shared between the threads of operation.
538a5548bf6SLawrence StewartWhen the hook function tries to place details in the structure, it must first
539a5548bf6SLawrence Stewartacquire an exclusive lock.
540a5548bf6SLawrence StewartLikewise, when the processing thread tries to read details from the structure,
541a5548bf6SLawrence Stewartit must also acquire an exclusive lock to do so.
542a5548bf6SLawrence StewartIf one thread holds the lock, the other must wait before it can obtain it.
543a5548bf6SLawrence StewartThis does introduce some additional bounded delay into the kernel's packet
544a5548bf6SLawrence Stewartprocessing code path.
545a5548bf6SLawrence Stewart.Pp
546a5548bf6SLawrence StewartIn some cases (e.g. low memory, connection termination), TCP packets that enter
547a5548bf6SLawrence Stewartthe
548a5548bf6SLawrence Stewart.Nm
549a5548bf6SLawrence Stewart.Xr pfil 9
550a5548bf6SLawrence Stewarthook function will not trigger a log message to be generated.
551a5548bf6SLawrence Stewart.Nm
552a5548bf6SLawrence Stewartrefers to this outcome as a
553a5548bf6SLawrence Stewart.Qq skipped packet .
554a5548bf6SLawrence StewartNote that
555a5548bf6SLawrence Stewart.Nm
556a5548bf6SLawrence Stewartalways ensures that packets are allowed to continue through the stack, even if
557a5548bf6SLawrence Stewartthey could not successfully trigger a data log message.
558a5548bf6SLawrence Stewart.Nm
559a5548bf6SLawrence Stewartwill therefore not introduce any packet loss for TCP/IP packets traversing the
560a5548bf6SLawrence Stewartnetwork stack.
561a5548bf6SLawrence Stewart.Ss Important Behaviours
562a5548bf6SLawrence StewartThe behaviour of a log file path change whilst the module is enabled is as
563a5548bf6SLawrence Stewartfollows:
564a5548bf6SLawrence Stewart.Bl -enum
565a5548bf6SLawrence Stewart.It
566a5548bf6SLawrence StewartAttempt to open the new file path for writing.
567a5548bf6SLawrence StewartIf this fails, the path change will fail and the existing path will continue to
568a5548bf6SLawrence Stewartbe used.
569a5548bf6SLawrence Stewart.It
570a5548bf6SLawrence StewartAssuming the new path is valid and opened successfully:
571a5548bf6SLawrence Stewart.Bl -dash
572a5548bf6SLawrence Stewart.It
573a5548bf6SLawrence StewartFlush all pending log messages to the old file path.
574a5548bf6SLawrence Stewart.It
575a5548bf6SLawrence StewartClose the old file path.
576a5548bf6SLawrence Stewart.It
577a5548bf6SLawrence StewartSwitch the active log file pointer to point at the new file path.
578a5548bf6SLawrence Stewart.It
579a5548bf6SLawrence StewartCommence logging to the new file.
580a5548bf6SLawrence Stewart.El
581a5548bf6SLawrence Stewart.El
582a5548bf6SLawrence Stewart.Pp
583a5548bf6SLawrence StewartDuring the time between the flush of pending log messages to the old file and
584a5548bf6SLawrence Stewartcommencing logging to the new file, new log messages will still be generated and
585a5548bf6SLawrence Stewartbuffered.
586a5548bf6SLawrence StewartAs soon as the new file path is ready for writing, the accumulated log messages
587a5548bf6SLawrence Stewartwill be written out to the file.
588a5548bf6SLawrence Stewart.Sh EXAMPLES
589a5548bf6SLawrence StewartTo enable the module's operations, run the following command as root:
590a5548bf6SLawrence Stewartsysctl net.inet.siftr.enabled=1
591a5548bf6SLawrence Stewart.Pp
592a5548bf6SLawrence StewartTo change the granularity of log messages such that 1 log message is
593a5548bf6SLawrence Stewartgenerated for every 10 TCP packets per connection, run the following
594a5548bf6SLawrence Stewartcommand as root:
595a5548bf6SLawrence Stewartsysctl net.inet.siftr.ppl=10
596a5548bf6SLawrence Stewart.Pp
597a5548bf6SLawrence StewartTo change the log file location to /tmp/siftr.log, run the following
598a5548bf6SLawrence Stewartcommand as root:
599a5548bf6SLawrence Stewartsysctl net.inet.siftr.logfile=/tmp/siftr.log
600a5548bf6SLawrence Stewart.Sh SEE ALSO
601*d9550d02SMaxim Konovalov.Xr tcpdump 1 ,
602*d9550d02SMaxim Konovalov.Xr tcp 4 ,
603*d9550d02SMaxim Konovalov.Xr sysctl 8 ,
604a5548bf6SLawrence Stewart.Xr alq 9 ,
605a5548bf6SLawrence Stewart.Xr pfil 9
606a5548bf6SLawrence Stewart.Sh ACKNOWLEDGEMENTS
607a5548bf6SLawrence StewartDevelopment of this software was made possible in part by grants from the
608a5548bf6SLawrence StewartCisco University Research Program Fund at Community Foundation Silicon Valley,
609a5548bf6SLawrence Stewartand the FreeBSD Foundation.
610a5548bf6SLawrence Stewart.Sh HISTORY
611a5548bf6SLawrence Stewart.Nm
612a5548bf6SLawrence Stewartfirst appeared in
613d25e560aSLawrence Stewart.Fx 7.4
614d25e560aSLawrence Stewartand
615d25e560aSLawrence Stewart.Fx 8.2 .
616a5548bf6SLawrence Stewart.Pp
617a5548bf6SLawrence Stewart.Nm
618a5548bf6SLawrence Stewartwas first released in 2007 by Lawrence Stewart and James Healy whilst working on
619891b8ed4SLawrence Stewartthe NewTCP research project at Swinburne University of Technology's Centre for
620891b8ed4SLawrence StewartAdvanced Internet Architectures, Melbourne, Australia, which was made possible
621891b8ed4SLawrence Stewartin part by a grant from the Cisco University Research Program Fund at Community
622891b8ed4SLawrence StewartFoundation Silicon Valley.
623a5548bf6SLawrence StewartMore details are available at:
624a5548bf6SLawrence Stewart.Pp
625a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/urp/newtcp/
626a5548bf6SLawrence Stewart.Pp
627a5548bf6SLawrence StewartWork on
628a5548bf6SLawrence Stewart.Nm
629a5548bf6SLawrence Stewartv1.2.x was sponsored by the FreeBSD Foundation as part of
630a5548bf6SLawrence Stewartthe
631a5548bf6SLawrence Stewart.Qq Enhancing the FreeBSD TCP Implementation
632a5548bf6SLawrence Stewartproject 2008-2009.
633a5548bf6SLawrence StewartMore details are available at:
634a5548bf6SLawrence Stewart.Pp
635a5548bf6SLawrence Stewarthttp://www.freebsdfoundation.org/
636a5548bf6SLawrence Stewart.Pp
637a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/freebsd/etcp09/
638a5548bf6SLawrence Stewart.Sh AUTHORS
639a5548bf6SLawrence Stewart.An -nosplit
640a5548bf6SLawrence Stewart.Nm
641a5548bf6SLawrence Stewartwas written by
642a5548bf6SLawrence Stewart.An Lawrence Stewart Aq lstewart@FreeBSD.org
643a5548bf6SLawrence Stewartand
644a5548bf6SLawrence Stewart.An James Healy Aq jimmy@deefa.com .
645a5548bf6SLawrence Stewart.Pp
646a5548bf6SLawrence StewartThis manual page was written by
647a5548bf6SLawrence Stewart.An Lawrence Stewart Aq lstewart@FreeBSD.org .
648a5548bf6SLawrence Stewart.Sh BUGS
649a5548bf6SLawrence StewartCurrent known limitations and any relevant workarounds are outlined below:
650a5548bf6SLawrence Stewart.Bl -dash
651a5548bf6SLawrence Stewart.It
652a5548bf6SLawrence StewartThe internal queue used to pass information between the threads of operation is
653a5548bf6SLawrence Stewartcurrently unbounded.
654a5548bf6SLawrence StewartThis allows
655a5548bf6SLawrence Stewart.Nm
656a5548bf6SLawrence Stewartto cope with bursty network traffic, but sustained high packet-per-second
657a5548bf6SLawrence Stewarttraffic can cause exhaustion of kernel memory if the processing thread cannot
658a5548bf6SLawrence Stewartkeep up with the packet rate.
659a5548bf6SLawrence Stewart.It
660a5548bf6SLawrence StewartIf using
661a5548bf6SLawrence Stewart.Nm
662a5548bf6SLawrence Stewarton a machine that is also running other modules utilising the
663a5548bf6SLawrence Stewart.Xr pfil 9
664a5548bf6SLawrence Stewartframework e.g.
665a5548bf6SLawrence Stewart.Xr dummynet 4 ,
666a5548bf6SLawrence Stewart.Xr ipfw 8 ,
667a5548bf6SLawrence Stewart.Xr pf 4 Ns ,
668a5548bf6SLawrence Stewartthe order in which you load the modules is important.
669a5548bf6SLawrence StewartYou should kldload the other modules first, as this will ensure TCP packets
670a5548bf6SLawrence Stewartundergo any necessary manipulations before
671a5548bf6SLawrence Stewart.Nm
672a5548bf6SLawrence Stewart.Qq sees
673a5548bf6SLawrence Stewartand processes them.
674a5548bf6SLawrence Stewart.It
675a5548bf6SLawrence StewartThere is a known, harmless lock order reversal warning between the
676a5548bf6SLawrence Stewart.Xr pfil 9
677a5548bf6SLawrence Stewartmutex and tcbinfo TCP lock reported by
678a5548bf6SLawrence Stewart.Xr witness 4
679a5548bf6SLawrence Stewartwhen
680a5548bf6SLawrence Stewart.Nm
681a5548bf6SLawrence Stewartis enabled in a kernel compiled with
682a5548bf6SLawrence Stewart.Xr witness 4
683a5548bf6SLawrence Stewartsupport.
684a5548bf6SLawrence Stewart.It
685a5548bf6SLawrence StewartThere is no way to filter which TCP flows you wish to capture data for.
686a5548bf6SLawrence StewartPost processing is required to separate out data belonging to particular flows
687a5548bf6SLawrence Stewartof interest.
688a5548bf6SLawrence Stewart.It
689a5548bf6SLawrence StewartThe module does not detect deletion of the log file path.
690a5548bf6SLawrence StewartNew log messages will simply be lost if the log file being used by
691a5548bf6SLawrence Stewart.Nm
692a5548bf6SLawrence Stewartis deleted whilst the module is set to use the file.
693a5548bf6SLawrence StewartSwitching to a new log file using the
694a5548bf6SLawrence Stewart.Em net.inet.siftr.logfile
695a5548bf6SLawrence Stewartvariable will create the new file and allow log messages to begin being written
696a5548bf6SLawrence Stewartto disk again.
697a5548bf6SLawrence StewartThe new log file path must differ from the path to the deleted file.
698a5548bf6SLawrence Stewart.It
699a5548bf6SLawrence StewartThe hash table used within the code is sized to hold 65536 flows.  This is not a
700a5548bf6SLawrence Stewarthard limit, because chaining is used to handle collisions within the hash table
701a5548bf6SLawrence Stewartstructure.
702a5548bf6SLawrence StewartHowever, we suspect (based on analogies with other hash table performance data)
703a5548bf6SLawrence Stewartthat the hash table look up performance (and therefore the module's packet
704a5548bf6SLawrence Stewartprocessing performance) will degrade in an exponential manner as the number of
705a5548bf6SLawrence Stewartunique flows handled in a module enable/disable cycle approaches and surpasses
706a5548bf6SLawrence Stewart65536.
707a5548bf6SLawrence Stewart.It
708a5548bf6SLawrence StewartThere is no garbage collection performed on the flow hash table.
709a5548bf6SLawrence StewartThe only way currently to flush it is to disable
710a5548bf6SLawrence Stewart.Nm .
711a5548bf6SLawrence Stewart.It
712a5548bf6SLawrence StewartThe PPL variable applies to packets that make it into the processing thread,
713a5548bf6SLawrence Stewartnot total packets received in the hook function.
714a5548bf6SLawrence StewartPackets are skipped before the PPL variable is applied, which means there may be
715a5548bf6SLawrence Stewarta slight discrepancy in the triggering of log messages.
716a5548bf6SLawrence StewartFor example, if PPL was set to 10, and the 8th packet since the last log message
717a5548bf6SLawrence Stewartis skipped, the 11th packet will actually trigger the log message to be
718a5548bf6SLawrence Stewartgenerated.
719a5548bf6SLawrence StewartThis is discussed in greater depth in CAIA technical report 070824A.
720a5548bf6SLawrence Stewart.It
721a5548bf6SLawrence StewartAt the time of writing, there was no simple way to hook into the TCP layer
722a5548bf6SLawrence Stewartto intercept packets.
723a5548bf6SLawrence Stewart.Nm Ap s
724a5548bf6SLawrence Stewartuse of IP layer hook points means all IP
725a5548bf6SLawrence Stewarttraffic will be processed by the
726a5548bf6SLawrence Stewart.Nm
727a5548bf6SLawrence Stewart.Xr pfil 9
728a5548bf6SLawrence Stewarthook function, which introduces minor, but nonetheless unnecessary packet delay
729a5548bf6SLawrence Stewartand processing overhead on the system for non-TCP packets as well.
730a5548bf6SLawrence StewartHooking in at the IP layer is also not ideal from the data gathering point of
731a5548bf6SLawrence Stewartview.
732a5548bf6SLawrence StewartPackets traversing up the stack will be intercepted and cause a log message
733a5548bf6SLawrence Stewartgeneration BEFORE they have been processed by the TCP layer, which means we
734a5548bf6SLawrence Stewartcannot observe the cause-and-affect relationship between inbound events and the
735a5548bf6SLawrence Stewartcorresponding TCP control block as precisely as could be.
736a5548bf6SLawrence StewartIdeally,
737a5548bf6SLawrence Stewart.Nm
738a5548bf6SLawrence Stewartshould intercept packets after they have been processed by the TCP layer i.e.
739a5548bf6SLawrence Stewartintercept packets coming up the stack after they have been processed by
740a5548bf6SLawrence Stewarttcp_input(), and intercept packets coming down the stack after they have been
741a5548bf6SLawrence Stewartprocessed by tcp_output().
742a5548bf6SLawrence StewartThe current code still gives satisfactory granularity though, as inbound events
743a5548bf6SLawrence Stewarttend to trigger outbound events, allowing the cause-and-effect to be observed
744a5548bf6SLawrence Stewartindirectly by capturing the state on outbound events as well.
745a5548bf6SLawrence Stewart.It
746a5548bf6SLawrence StewartThe
747a5548bf6SLawrence Stewart.Qq inflight bytes
748a5548bf6SLawrence Stewartvalue logged by
749a5548bf6SLawrence Stewart.Nm
750a5548bf6SLawrence Stewartdoes not take into account bytes that have been
751a5548bf6SLawrence Stewart.No SACK Ap ed
752a5548bf6SLawrence Stewartby the receiving host.
753a5548bf6SLawrence Stewart.It
754a5548bf6SLawrence StewartPacket hash generation does not currently work for IPv6 based TCP packets.
755a5548bf6SLawrence Stewart.It
756a5548bf6SLawrence StewartCompressed notation is not used for IPv6 address representation.
757a5548bf6SLawrence StewartThis consumes more bytes than is necessary in log output.
758a5548bf6SLawrence Stewart.El
759