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