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