1a5548bf6SLawrence Stewart.\" 2a5548bf6SLawrence Stewart.\" Copyright (c) 2010 The FreeBSD Foundation 3a5548bf6SLawrence Stewart.\" 4a5548bf6SLawrence Stewart.\" Portions of this software were developed at the Centre for Advanced 5a5548bf6SLawrence Stewart.\" Internet Architectures, Swinburne University of Technology, Melbourne, 6a5548bf6SLawrence Stewart.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD 7a5548bf6SLawrence Stewart.\" Foundation. 8a5548bf6SLawrence Stewart.\" 9a5548bf6SLawrence Stewart.\" Redistribution and use in source and binary forms, with or without 10a5548bf6SLawrence Stewart.\" modification, are permitted provided that the following conditions 11a5548bf6SLawrence Stewart.\" are met: 12a5548bf6SLawrence Stewart.\" 1. Redistributions of source code must retain the above copyright 13a5548bf6SLawrence Stewart.\" notice, this list of conditions, and the following disclaimer, 14a5548bf6SLawrence Stewart.\" without modification, immediately at the beginning of the file. 15a5548bf6SLawrence Stewart.\" 2. The name of the author may not be used to endorse or promote products 16a5548bf6SLawrence Stewart.\" derived from this software without specific prior written permission. 17a5548bf6SLawrence Stewart.\" 18a5548bf6SLawrence Stewart.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19a5548bf6SLawrence Stewart.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20a5548bf6SLawrence Stewart.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21a5548bf6SLawrence Stewart.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 22a5548bf6SLawrence Stewart.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23a5548bf6SLawrence Stewart.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24a5548bf6SLawrence Stewart.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25a5548bf6SLawrence Stewart.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26a5548bf6SLawrence Stewart.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27a5548bf6SLawrence Stewart.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28a5548bf6SLawrence Stewart.\" SUCH DAMAGE. 29a5548bf6SLawrence Stewart.\" 30*78914cd6SCheng Cui.Dd May 29, 2023 31a5548bf6SLawrence Stewart.Dt SIFTR 4 32a5548bf6SLawrence Stewart.Os 33a5548bf6SLawrence Stewart.Sh NAME 34a5548bf6SLawrence Stewart.Nm SIFTR 35a5548bf6SLawrence Stewart.Nd Statistical Information For TCP Research 36a5548bf6SLawrence Stewart.Sh SYNOPSIS 37a5548bf6SLawrence StewartTo load 387646a841SJoel Dahlthe driver 39a5548bf6SLawrence Stewartas a module at run-time, run the following command as root: 40a5548bf6SLawrence Stewart.Bd -literal -offset indent 41a5548bf6SLawrence Stewartkldload siftr 42a5548bf6SLawrence Stewart.Ed 43a5548bf6SLawrence Stewart.Pp 44a5548bf6SLawrence StewartAlternatively, to load 457646a841SJoel Dahlthe driver 46a5548bf6SLawrence Stewartas a module at boot time, add the following line into the 47a5548bf6SLawrence Stewart.Xr loader.conf 5 48a5548bf6SLawrence Stewartfile: 49a5548bf6SLawrence Stewart.Bd -literal -offset indent 50a5548bf6SLawrence Stewartsiftr_load="YES" 51a5548bf6SLawrence Stewart.Ed 52a5548bf6SLawrence Stewart.Sh DESCRIPTION 537646a841SJoel DahlThe 54a5548bf6SLawrence Stewart.Nm 557646a841SJoel Dahl.Po 567646a841SJoel Dahl.Em S Ns tatistical 57a5548bf6SLawrence Stewart.Em I Ns nformation 58a5548bf6SLawrence Stewart.Em F Ns or 59a5548bf6SLawrence Stewart.Em T Ns CP 607646a841SJoel Dahl.Em R Ns esearch 617646a841SJoel Dahl.Pc 627646a841SJoel Dahlkernel module 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 84aa61cff4SCheng Cuiaddresses (e.g. "fd00::2") for logging. 85a5548bf6SLawrence Stewart.Ss Run-time Configuration 86a5548bf6SLawrence Stewart.Nm 87a5548bf6SLawrence Stewartutilises the 88a5548bf6SLawrence Stewart.Xr sysctl 8 89a5548bf6SLawrence Stewartinterface to export its configuration variables to user-space. 90a5548bf6SLawrence StewartThe following variables are available: 916f5baf29SGlen Barber.Bl -tag -offset indent -width Va 92a5548bf6SLawrence Stewart.It Va net.inet.siftr.enabled 93a5548bf6SLawrence Stewartcontrols whether the module performs its 94a5548bf6SLawrence Stewartmeasurements or not. 95a5548bf6SLawrence StewartBy default, the value is set to 0, which means the module 96a5548bf6SLawrence Stewartwill not be taking any measurements. 97a5548bf6SLawrence StewartHaving the module loaded with 98a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled 99a5548bf6SLawrence Stewartset to 0 will have no impact on the performance of the network stack, as the 100a5548bf6SLawrence Stewartpacket filtering hooks are only inserted when 101a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled 102a5548bf6SLawrence Stewartis set to 1. 103a5548bf6SLawrence Stewart.El 1046f5baf29SGlen Barber.Bl -tag -offset indent -width Va 105a5548bf6SLawrence Stewart.It Va net.inet.siftr.ppl 106a5548bf6SLawrence Stewartcontrols how many inbound/outbound packets for a given TCP connection will cause 107a5548bf6SLawrence Stewarta log message to be generated for the connection. 108a5548bf6SLawrence StewartBy default, the value is set to 1, which means the module will log a message for 109a5548bf6SLawrence Stewartevery packet of every TCP connection. 110a5548bf6SLawrence StewartThe value can be set to any integer in the range [1,2^32], and can be changed at 111a5548bf6SLawrence Stewartany time, even while the module is enabled. 112a5548bf6SLawrence Stewart.El 1136f5baf29SGlen Barber.Bl -tag -offset indent -width Va 114a5548bf6SLawrence Stewart.It Va net.inet.siftr.logfile 115a5548bf6SLawrence Stewartcontrols the path to the file that the module writes its log messages to. 116a5548bf6SLawrence StewartBy default, the file /var/log/siftr.log is used. 117a5548bf6SLawrence StewartThe path can be changed at any time, even while the module is enabled. 118a5548bf6SLawrence Stewart.El 1196f5baf29SGlen Barber.Bl -tag -offset indent -width Va 120746c7ae5SMichael Tuexen.It Va net.inet.siftr.port_filter 121*78914cd6SCheng Cuicontrols on which source or destination port 122*78914cd6SCheng Cui.Nm 123*78914cd6SCheng Cuishould capture. 124746c7ae5SMichael TuexenBy default, the value is set to 0, which means all ports are eligible for logging. 125746c7ae5SMichael TuexenSet to any other value, only packets where either the source or destination 126746c7ae5SMichael Tuexenport is equal to this number are logged. 127746c7ae5SMichael Tuexen.El 128a5548bf6SLawrence Stewart.Ss Log Format 129a5548bf6SLawrence StewartA typical 130a5548bf6SLawrence Stewart.Nm 131a5548bf6SLawrence Stewartlog file will contain 3 different types of log message. 132a5548bf6SLawrence StewartAll messages are written in plain ASCII text. 133a5548bf6SLawrence Stewart.Pp 134a5548bf6SLawrence StewartNote: The 135a5548bf6SLawrence Stewart.Qq \e 136a5548bf6SLawrence Stewartpresent in the example log messages in this section indicates a 13750d922a0SGlen Barberline continuation and is not part of the actual log message. 138a5548bf6SLawrence Stewart.Pp 139a5548bf6SLawrence StewartThe first type of log message is written to the file when the module is 14025972509SEdward Tomasz Napieralaenabled and starts collecting data from the running kernel. 14125972509SEdward Tomasz NapieralaThe text below shows an example module enable log. 14225972509SEdward Tomasz NapieralaThe fields are tab delimited key-value 143a5548bf6SLawrence Stewartpairs which describe some basic information about the system. 144a5548bf6SLawrence Stewart.Bd -literal -offset indent 145*78914cd6SCheng Cuienable_time_secs=1685191807 enable_time_usecs=160752 \\ 146*78914cd6SCheng Cuisiftrver=1.3.0 sysname=FreeBSD sysver=1400089 ipmode=4 147a5548bf6SLawrence Stewart.Ed 148a5548bf6SLawrence Stewart.Pp 149a5548bf6SLawrence StewartField descriptions are as follows: 1506f5baf29SGlen Barber.Bl -tag -offset indent -width Va 151a5548bf6SLawrence Stewart.It Va enable_time_secs 152a5548bf6SLawrence Stewarttime at which the module was enabled, in seconds since the UNIX epoch. 153a5548bf6SLawrence Stewart.El 1546f5baf29SGlen Barber.Bl -tag -offset indent -width Va 155a5548bf6SLawrence Stewart.It Va enable_time_usecs 156a5548bf6SLawrence Stewarttime at which the module was enabled, in microseconds since enable_time_secs. 157a5548bf6SLawrence Stewart.El 1586f5baf29SGlen Barber.Bl -tag -offset indent -width Va 159a5548bf6SLawrence Stewart.It Va siftrver 160a5548bf6SLawrence Stewartversion of 161a5548bf6SLawrence Stewart.Nm . 162a5548bf6SLawrence Stewart.El 1636f5baf29SGlen Barber.Bl -tag -offset indent -width Va 164a5548bf6SLawrence Stewart.It Va sysname 16550d922a0SGlen Barberoperating system name. 166a5548bf6SLawrence Stewart.El 1676f5baf29SGlen Barber.Bl -tag -offset indent -width Va 168a5548bf6SLawrence Stewart.It Va sysver 16950d922a0SGlen Barberoperating system version. 170a5548bf6SLawrence Stewart.El 1716f5baf29SGlen Barber.Bl -tag -offset indent -width Va 172a5548bf6SLawrence Stewart.It Va ipmode 173a5548bf6SLawrence StewartIP mode as defined at compile time. 174a5548bf6SLawrence StewartAn ipmode of "4" means IPv6 is not supported and IP addresses are logged in 175a5548bf6SLawrence Stewartregular dotted quad format. 176a5548bf6SLawrence StewartAn ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted 177a5548bf6SLawrence Stewartquad or hex format, as described in the 178a5548bf6SLawrence Stewart.Qq Compile-time Configuration 179a5548bf6SLawrence Stewartsubsection. 180a5548bf6SLawrence Stewart.El 181a5548bf6SLawrence Stewart.Pp 182a5548bf6SLawrence StewartThe second type of log message is written to the file when a data log message 183a5548bf6SLawrence Stewartis generated. 184a5548bf6SLawrence StewartThe text below shows an example data log triggered by an IPv4 185a5548bf6SLawrence StewartTCP/IP packet. 186a5548bf6SLawrence StewartThe data is CSV formatted. 187a5548bf6SLawrence Stewart.Bd -literal -offset indent 188*78914cd6SCheng Cuio,1685191814.185109,10.1.1.2,32291,10.1.1.3,5001,1073725440, \\ 189*78914cd6SCheng Cui14480,2,65160,65700,7,9,4,1460,1000,1,16778209,230000,33580,0, \\ 190*78914cd6SCheng Cui65700,0,0,0,86707916,130 191a5548bf6SLawrence Stewart.Ed 192a5548bf6SLawrence Stewart.Pp 193a5548bf6SLawrence StewartField descriptions are as follows: 1946f5baf29SGlen Barber.Bl -tag -offset indent -width Va 195a5548bf6SLawrence Stewart.It Va 1 196a5548bf6SLawrence StewartDirection of packet that triggered the log message. 197a5548bf6SLawrence StewartEither 198a5548bf6SLawrence Stewart.Qq i 199a5548bf6SLawrence Stewartfor in, or 200a5548bf6SLawrence Stewart.Qq o 201a5548bf6SLawrence Stewartfor out. 202a5548bf6SLawrence Stewart.El 2036f5baf29SGlen Barber.Bl -tag -offset indent -width Va 204a5548bf6SLawrence Stewart.It Va 2 205a5548bf6SLawrence StewartTime at which the packet that triggered the log message was processed by 206a5548bf6SLawrence Stewartthe 207a5548bf6SLawrence Stewart.Xr pfil 9 208a5548bf6SLawrence Stewarthook function, in seconds and microseconds since the UNIX epoch. 209a5548bf6SLawrence Stewart.El 2106f5baf29SGlen Barber.Bl -tag -offset indent -width Va 21160167184SCheng Cui.It Va 3 212a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet) 213a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation. 214a5548bf6SLawrence Stewart.El 2156f5baf29SGlen Barber.Bl -tag -offset indent -width Va 21660167184SCheng Cui.It Va 4 217a5548bf6SLawrence StewartThe TCP port that the local host is communicating via. 218a5548bf6SLawrence Stewart.El 2196f5baf29SGlen Barber.Bl -tag -offset indent -width Va 22060167184SCheng Cui.It Va 5 221a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet) 222a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation. 223a5548bf6SLawrence Stewart.El 2246f5baf29SGlen Barber.Bl -tag -offset indent -width Va 22560167184SCheng Cui.It Va 6 226a5548bf6SLawrence StewartThe TCP port that the foreign host is communicating via. 227a5548bf6SLawrence Stewart.El 2286f5baf29SGlen Barber.Bl -tag -offset indent -width Va 22960167184SCheng Cui.It Va 7 230a5548bf6SLawrence StewartThe slow start threshold for the flow, in bytes. 231a5548bf6SLawrence Stewart.El 2326f5baf29SGlen Barber.Bl -tag -offset indent -width Va 23360167184SCheng Cui.It Va 8 234a5548bf6SLawrence StewartThe current congestion window for the flow, in bytes. 235a5548bf6SLawrence Stewart.El 2366f5baf29SGlen Barber.Bl -tag -offset indent -width Va 23760167184SCheng Cui.It Va 9 2381241e8e7STom JonesThe current state of the t_flags2 field for the flow. 239a5548bf6SLawrence Stewart.El 2406f5baf29SGlen Barber.Bl -tag -offset indent -width Va 24160167184SCheng Cui.It Va 10 242a5548bf6SLawrence StewartThe current sending window for the flow, in bytes. 243*78914cd6SCheng CuiThe post scaled value is reported. 244a5548bf6SLawrence Stewart.El 2456f5baf29SGlen Barber.Bl -tag -offset indent -width Va 24660167184SCheng Cui.It Va 11 247a5548bf6SLawrence StewartThe current receive window for the flow, in bytes. 248a5548bf6SLawrence StewartThe post scaled value is always reported. 249a5548bf6SLawrence Stewart.El 2506f5baf29SGlen Barber.Bl -tag -offset indent -width Va 25160167184SCheng Cui.It Va 12 252a5548bf6SLawrence StewartThe current window scaling factor for the sending window. 253a5548bf6SLawrence Stewart.El 2546f5baf29SGlen Barber.Bl -tag -offset indent -width Va 25560167184SCheng Cui.It Va 13 256a5548bf6SLawrence StewartThe current window scaling factor for the receiving window. 257a5548bf6SLawrence Stewart.El 2586f5baf29SGlen Barber.Bl -tag -offset indent -width Va 25960167184SCheng Cui.It Va 14 260a5548bf6SLawrence StewartThe current state of the TCP finite state machine, as defined 261a5548bf6SLawrence Stewartin 262a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_fsm.h . 263a5548bf6SLawrence Stewart.El 2646f5baf29SGlen Barber.Bl -tag -offset indent -width Va 26560167184SCheng Cui.It Va 15 266a5548bf6SLawrence StewartThe maximum segment size for the flow, in bytes. 267a5548bf6SLawrence Stewart.El 2686f5baf29SGlen Barber.Bl -tag -offset indent -width Va 26960167184SCheng Cui.It Va 16 270d090464eSCheng CuiThe current smoothed RTT estimate for the flow, in units of microsecond. 271a5548bf6SLawrence Stewart.El 2726f5baf29SGlen Barber.Bl -tag -offset indent -width Va 27360167184SCheng Cui.It Va 17 274a5548bf6SLawrence StewartSACK enabled indicator. 1 if SACK enabled, 0 otherwise. 275a5548bf6SLawrence Stewart.El 2766f5baf29SGlen Barber.Bl -tag -offset indent -width Va 27760167184SCheng Cui.It Va 18 278a5548bf6SLawrence StewartThe current state of the TCP flags for the flow. 279a5548bf6SLawrence StewartSee 280a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_var.h 281a5548bf6SLawrence Stewartfor information about the various flags. 282a5548bf6SLawrence Stewart.El 2836f5baf29SGlen Barber.Bl -tag -offset indent -width Va 28460167184SCheng Cui.It Va 19 285d090464eSCheng CuiThe current retransmission timeout length for the flow, in units microsecond. 286a5548bf6SLawrence Stewart.El 2876f5baf29SGlen Barber.Bl -tag -offset indent -width Va 28860167184SCheng Cui.It Va 20 289a5548bf6SLawrence StewartThe current size of the socket send buffer in bytes. 290a5548bf6SLawrence Stewart.El 2916f5baf29SGlen Barber.Bl -tag -offset indent -width Va 29260167184SCheng Cui.It Va 21 293a5548bf6SLawrence StewartThe current number of bytes in the socket send buffer. 294a5548bf6SLawrence Stewart.El 2956f5baf29SGlen Barber.Bl -tag -offset indent -width Va 29660167184SCheng Cui.It Va 22 297a5548bf6SLawrence StewartThe current size of the socket receive buffer in bytes. 298a5548bf6SLawrence Stewart.El 2996f5baf29SGlen Barber.Bl -tag -offset indent -width Va 30060167184SCheng Cui.It Va 23 301a5548bf6SLawrence StewartThe current number of bytes in the socket receive buffer. 302a5548bf6SLawrence Stewart.El 3036f5baf29SGlen Barber.Bl -tag -offset indent -width Va 30460167184SCheng Cui.It Va 24 305a5548bf6SLawrence StewartThe current number of unacknowledged bytes in-flight. 306a5548bf6SLawrence StewartBytes acknowledged via SACK are not excluded from this count. 307a5548bf6SLawrence Stewart.El 3086f5baf29SGlen Barber.Bl -tag -offset indent -width Va 30960167184SCheng Cui.It Va 25 310d4d3e218SLawrence StewartThe current number of segments in the reassembly queue. 311d4d3e218SLawrence Stewart.El 312a025fd14SHiren Panchasara.Bl -tag -offset indent -width Va 31360167184SCheng Cui.It Va 26 314a025fd14SHiren PanchasaraFlowid for the connection. 315a025fd14SHiren PanchasaraA caveat: Zero '0' either represents a valid flowid or a default value when it's 31625972509SEdward Tomasz Napieralanot being set. 31725972509SEdward Tomasz NapieralaThere is no easy way to differentiate without looking at actual 318a025fd14SHiren Panchasaranetwork interface card and drivers being used. 319a025fd14SHiren Panchasara.El 320d0a8b2a5SHiren Panchasara.Bl -tag -offset indent -width Va 32160167184SCheng Cui.It Va 27 322d0a8b2a5SHiren PanchasaraFlow type for the connection. 323d0a8b2a5SHiren PanchasaraFlowtype defines which protocol fields are hashed to produce the flowid. 324d0a8b2a5SHiren PanchasaraA complete listing is available in 325d0a8b2a5SHiren Panchasara.Pa sys/mbuf.h 326d0a8b2a5SHiren Panchasaraunder 327d0a8b2a5SHiren Panchasara.Dv M_HASHTYPE_* . 328d0a8b2a5SHiren Panchasara.El 329a5548bf6SLawrence Stewart.Pp 330a5548bf6SLawrence StewartThe third type of log message is written to the file when the module is disabled 331a5548bf6SLawrence Stewartand ceases collecting data from the running kernel. 332a5548bf6SLawrence StewartThe text below shows an example module disable log. 333a5548bf6SLawrence StewartThe fields are tab delimited key-value pairs which provide statistics about 334a5548bf6SLawrence Stewartoperations since the module was most recently enabled. 335a5548bf6SLawrence Stewart.Bd -literal -offset indent 336*78914cd6SCheng Cuidisable_time_secs=1685191816 disable_time_usecs=629397 \\ 337*78914cd6SCheng Cuinum_inbound_tcp_pkts=10 num_outbound_tcp_pkts=10 \\ 338*78914cd6SCheng Cuitotal_tcp_pkts=20 num_inbound_skipped_pkts_malloc=0 \\ 339*78914cd6SCheng Cuinum_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_tcpcb=2 \\ 340*78914cd6SCheng Cuinum_outbound_skipped_pkts_tcpcb=2 num_inbound_skipped_pkts_inpcb=0 \\ 341*78914cd6SCheng Cuinum_outbound_skipped_pkts_inpcb=0 total_skipped_tcp_pkts=4 \\ 342*78914cd6SCheng Cuiflow_list=10.1.1.2;32291-10.1.1.3;5001,10.1.1.2;58544-10.1.1.3;5001, 343a5548bf6SLawrence Stewart.Ed 344a5548bf6SLawrence Stewart.Pp 345a5548bf6SLawrence StewartField descriptions are as follows: 3466f5baf29SGlen Barber.Bl -tag -offset indent -width Va 347a5548bf6SLawrence Stewart.It Va disable_time_secs 348a5548bf6SLawrence StewartTime at which the module was disabled, in seconds since the UNIX epoch. 349a5548bf6SLawrence Stewart.El 3506f5baf29SGlen Barber.Bl -tag -offset indent -width Va 351a5548bf6SLawrence Stewart.It Va disable_time_usecs 352a5548bf6SLawrence StewartTime at which the module was disabled, in microseconds since disable_time_secs. 353a5548bf6SLawrence Stewart.El 3546f5baf29SGlen Barber.Bl -tag -offset indent -width Va 355a5548bf6SLawrence Stewart.It Va num_inbound_tcp_pkts 356a5548bf6SLawrence StewartNumber of TCP packets that traversed up the network stack. 357a5548bf6SLawrence StewartThis only includes inbound TCP packets during the periods when 358a5548bf6SLawrence Stewart.Nm 359a5548bf6SLawrence Stewartwas enabled. 360a5548bf6SLawrence Stewart.El 3616f5baf29SGlen Barber.Bl -tag -offset indent -width Va 362a5548bf6SLawrence Stewart.It Va num_outbound_tcp_pkts 363a5548bf6SLawrence StewartNumber of TCP packets that traversed down the network stack. 364a5548bf6SLawrence StewartThis only includes outbound TCP packets during the periods when 365a5548bf6SLawrence Stewart.Nm 366a5548bf6SLawrence Stewartwas enabled. 367a5548bf6SLawrence Stewart.El 3686f5baf29SGlen Barber.Bl -tag -offset indent -width Va 369a5548bf6SLawrence Stewart.It Va total_tcp_pkts 370a5548bf6SLawrence StewartThe summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts. 371a5548bf6SLawrence Stewart.El 3726f5baf29SGlen Barber.Bl -tag -offset indent -width Va 373a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_malloc 3741adc28f5SChristian BruefferNumber of inbound packets that were not processed because of failed 3751adc28f5SChristian Brueffer.Fn malloc 3761adc28f5SChristian Brueffercalls. 377a5548bf6SLawrence Stewart.El 3786f5baf29SGlen Barber.Bl -tag -offset indent -width Va 379a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_malloc 3801adc28f5SChristian BruefferNumber of outbound packets that were not processed because of failed 3811adc28f5SChristian Brueffer.Fn malloc 3821adc28f5SChristian Brueffercalls. 383a5548bf6SLawrence Stewart.El 3846f5baf29SGlen Barber.Bl -tag -offset indent -width Va 385*78914cd6SCheng Cui.It Va num_inbound_skipped_pkts_tcpcb 386a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the 387a5548bf6SLawrence StewartTCP control block associated with the packet. 388a5548bf6SLawrence Stewart.El 3896f5baf29SGlen Barber.Bl -tag -offset indent -width Va 390*78914cd6SCheng Cui.It Va num_outbound_skipped_pkts_tcpcb 391a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find 392a5548bf6SLawrence Stewartthe TCP control block associated with the packet. 393a5548bf6SLawrence Stewart.El 3946f5baf29SGlen Barber.Bl -tag -offset indent -width Va 395*78914cd6SCheng Cui.It Va num_inbound_skipped_pkts_inpcb 396a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the 397a5548bf6SLawrence StewartIP control block associated with the packet. 398a5548bf6SLawrence Stewart.El 3996f5baf29SGlen Barber.Bl -tag -offset indent -width Va 400*78914cd6SCheng Cui.It Va num_outbound_skipped_pkts_inpcb 401a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find 402a5548bf6SLawrence Stewartthe IP control block associated with the packet. 403a5548bf6SLawrence Stewart.El 4046f5baf29SGlen Barber.Bl -tag -offset indent -width Va 405a5548bf6SLawrence Stewart.It Va total_skipped_tcp_pkts 406a5548bf6SLawrence StewartThe summation of all skipped packet counters. 407a5548bf6SLawrence Stewart.El 4086f5baf29SGlen Barber.Bl -tag -offset indent -width Va 409a5548bf6SLawrence Stewart.It Va flow_list 410a5548bf6SLawrence StewartA CSV list of TCP flows that triggered data log messages to be generated since 411a5548bf6SLawrence Stewartthe module was loaded. 412a5548bf6SLawrence StewartEach flow entry in the CSV list is 413a5548bf6SLawrence Stewartformatted as 414a5548bf6SLawrence Stewart.Qq local_ip;local_port-foreign_ip;foreign_port . 4156f5baf29SGlen BarberIf there are no entries in the list (i.e., no data log messages were generated), 416a5548bf6SLawrence Stewartthe value will be blank. 417a5548bf6SLawrence StewartIf there is at least one entry in the list, a trailing comma will always be 418a5548bf6SLawrence Stewartpresent. 419a5548bf6SLawrence Stewart.El 420a5548bf6SLawrence Stewart.Pp 421a5548bf6SLawrence StewartThe total number of data log messages found in the log file for a module 422a5548bf6SLawrence Stewartenable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts. 423a5548bf6SLawrence Stewart.Sh IMPLEMENTATION NOTES 424a5548bf6SLawrence Stewart.Nm 425a5548bf6SLawrence Stewarthooks into the network stack using the 426a5548bf6SLawrence Stewart.Xr pfil 9 427a5548bf6SLawrence Stewartinterface. 428a5548bf6SLawrence StewartIn its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6) 429a5548bf6SLawrence Stewart.Xr pfil 9 430a5548bf6SLawrence Stewartfiltering points, which means it sees packets at the IP layer of the network 431a5548bf6SLawrence Stewartstack. 432a5548bf6SLawrence StewartThis means that TCP packets inbound to the stack are intercepted before 433a5548bf6SLawrence Stewartthey have been processed by the TCP layer. 434a5548bf6SLawrence StewartPackets outbound from the stack are intercepted after they have been processed 435a5548bf6SLawrence Stewartby the TCP layer. 436a5548bf6SLawrence Stewart.Pp 437a5548bf6SLawrence StewartThe diagram below illustrates how 438a5548bf6SLawrence Stewart.Nm 439a5548bf6SLawrence Stewartinserts itself into the stack. 440a5548bf6SLawrence Stewart.Bd -literal -offset indent 441a5548bf6SLawrence Stewart---------------------------------- 442a5548bf6SLawrence Stewart Upper Layers 443a5548bf6SLawrence Stewart---------------------------------- 444a5548bf6SLawrence Stewart ^ | 445a5548bf6SLawrence Stewart | | 446a5548bf6SLawrence Stewart | | 447a5548bf6SLawrence Stewart | v 448a5548bf6SLawrence Stewart TCP in TCP out 449a5548bf6SLawrence Stewart---------------------------------- 450a5548bf6SLawrence Stewart ^ | 451a5548bf6SLawrence Stewart |________ _________| 452a5548bf6SLawrence Stewart | | 453a5548bf6SLawrence Stewart | v 454a5548bf6SLawrence Stewart --------- 455a5548bf6SLawrence Stewart | SIFTR | 456a5548bf6SLawrence Stewart --------- 457a5548bf6SLawrence Stewart ^ | 458a5548bf6SLawrence Stewart ________| |__________ 459a5548bf6SLawrence Stewart | | 460a5548bf6SLawrence Stewart | v 461a5548bf6SLawrence StewartIPv{4/6} in IPv{4/6} out 462a5548bf6SLawrence Stewart---------------------------------- 463a5548bf6SLawrence Stewart ^ | 464a5548bf6SLawrence Stewart | | 465a5548bf6SLawrence Stewart | v 466a5548bf6SLawrence StewartLayer 2 in Layer 2 out 467a5548bf6SLawrence Stewart---------------------------------- 468a5548bf6SLawrence Stewart Physical Layer 469a5548bf6SLawrence Stewart---------------------------------- 470a5548bf6SLawrence Stewart.Ed 471a5548bf6SLawrence Stewart.Pp 472a5548bf6SLawrence Stewart.Nm 473a5548bf6SLawrence Stewartuses the 474a5548bf6SLawrence Stewart.Xr alq 9 475a5548bf6SLawrence Stewartinterface to manage writing data to disk. 476a5548bf6SLawrence Stewart.Pp 477a5548bf6SLawrence StewartAt first glance, you might mistakenly think that 478a5548bf6SLawrence Stewart.Nm 479a5548bf6SLawrence Stewartextracts information from 480a5548bf6SLawrence Stewartindividual TCP packets. 481a5548bf6SLawrence StewartThis is not the case. 482a5548bf6SLawrence Stewart.Nm 483a5548bf6SLawrence Stewartuses TCP packet events (inbound and outbound) for each TCP flow originating from 484a5548bf6SLawrence Stewartthe system to trigger a dump of the state of the TCP control block for that 485a5548bf6SLawrence Stewartflow. 486a5548bf6SLawrence StewartWith the PPL set to 1, we are in effect sampling each TCP flow's control block 487a5548bf6SLawrence Stewartstate as frequently as flow packets enter/leave the system. 4886f5baf29SGlen BarberFor example, setting PPL to 2 halves the sampling rate i.e., every second flow 489a5548bf6SLawrence Stewartpacket (inbound OR outbound) causes a dump of the control block state. 490a5548bf6SLawrence Stewart.Pp 4916f5baf29SGlen BarberThe distinction between interrogating individual packets versus interrogating the 492a5548bf6SLawrence Stewartcontrol block is important, because 493a5548bf6SLawrence Stewart.Nm 494a5548bf6SLawrence Stewartdoes not remove the need for packet capturing tools like 495a5548bf6SLawrence Stewart.Xr tcpdump 1 . 496a5548bf6SLawrence Stewart.Nm 497a5548bf6SLawrence Stewartallows you to correlate and observe the cause-and-affect relationship between 498a5548bf6SLawrence Stewartwhat you see on the wire (captured using a tool like 499a5548bf6SLawrence Stewart.Xr tcpdump 1 Ns ) 500a5548bf6SLawrence Stewartand changes in the TCP control block corresponding to the flow of interest. 501a5548bf6SLawrence StewartIt is therefore useful to use 502a5548bf6SLawrence Stewart.Nm 503a5548bf6SLawrence Stewartand a tool like 504a5548bf6SLawrence Stewart.Xr tcpdump 1 505a5548bf6SLawrence Stewartto gather the necessary data to piece together the complete picture. 506a5548bf6SLawrence StewartUse of either tool on its own will not be able to provide all of the necessary 507a5548bf6SLawrence Stewartdata. 508a5548bf6SLawrence Stewart.Pp 509a5548bf6SLawrence StewartAs a result of needing to interrogate the TCP control block, certain packets 510a5548bf6SLawrence Stewartduring the lifecycle of a connection are unable to trigger a 511a5548bf6SLawrence Stewart.Nm 512a5548bf6SLawrence Stewartlog message. 513*78914cd6SCheng CuiThe initial handshake takes place without the existence of a control block or 514*78914cd6SCheng Cuithe complete initialization of the control block, and the final ACK is 515*78914cd6SCheng Cuiexchanged when the connection is in the TIMEWAIT state. 516a5548bf6SLawrence Stewart.Pp 517a5548bf6SLawrence Stewart.Nm 518a5548bf6SLawrence Stewartwas designed to minimise the delay introduced to packets traversing the network 519a5548bf6SLawrence Stewartstack. 520a5548bf6SLawrence StewartThis design called for a highly optimised and minimal hook function that 521a5548bf6SLawrence Stewartextracted the minimal details necessary whilst holding the packet up, and 522a5548bf6SLawrence Stewartpassing these details to another thread for actual processing and logging. 523a5548bf6SLawrence Stewart.Pp 524a5548bf6SLawrence StewartThis multithreaded design does introduce some contention issues when accessing 525a5548bf6SLawrence Stewartthe data structure shared between the threads of operation. 526a5548bf6SLawrence StewartWhen the hook function tries to place details in the structure, it must first 527a5548bf6SLawrence Stewartacquire an exclusive lock. 528a5548bf6SLawrence StewartLikewise, when the processing thread tries to read details from the structure, 529a5548bf6SLawrence Stewartit must also acquire an exclusive lock to do so. 530a5548bf6SLawrence StewartIf one thread holds the lock, the other must wait before it can obtain it. 531a5548bf6SLawrence StewartThis does introduce some additional bounded delay into the kernel's packet 532a5548bf6SLawrence Stewartprocessing code path. 533a5548bf6SLawrence Stewart.Pp 5346f5baf29SGlen BarberIn some cases (e.g., low memory, connection termination), TCP packets that enter 535a5548bf6SLawrence Stewartthe 536a5548bf6SLawrence Stewart.Nm 537a5548bf6SLawrence Stewart.Xr pfil 9 538a5548bf6SLawrence Stewarthook function will not trigger a log message to be generated. 539a5548bf6SLawrence Stewart.Nm 540a5548bf6SLawrence Stewartrefers to this outcome as a 541a5548bf6SLawrence Stewart.Qq skipped packet . 542a5548bf6SLawrence StewartNote that 543a5548bf6SLawrence Stewart.Nm 544a5548bf6SLawrence Stewartalways ensures that packets are allowed to continue through the stack, even if 545a5548bf6SLawrence Stewartthey could not successfully trigger a data log message. 546a5548bf6SLawrence Stewart.Nm 547a5548bf6SLawrence Stewartwill therefore not introduce any packet loss for TCP/IP packets traversing the 548a5548bf6SLawrence Stewartnetwork stack. 549a5548bf6SLawrence Stewart.Ss Important Behaviours 550a5548bf6SLawrence StewartThe behaviour of a log file path change whilst the module is enabled is as 551a5548bf6SLawrence Stewartfollows: 552a5548bf6SLawrence Stewart.Bl -enum 553a5548bf6SLawrence Stewart.It 554a5548bf6SLawrence StewartAttempt to open the new file path for writing. 555a5548bf6SLawrence StewartIf this fails, the path change will fail and the existing path will continue to 556a5548bf6SLawrence Stewartbe used. 557a5548bf6SLawrence Stewart.It 558a5548bf6SLawrence StewartAssuming the new path is valid and opened successfully: 559a5548bf6SLawrence Stewart.Bl -dash 560a5548bf6SLawrence Stewart.It 561a5548bf6SLawrence StewartFlush all pending log messages to the old file path. 562a5548bf6SLawrence Stewart.It 563a5548bf6SLawrence StewartClose the old file path. 564a5548bf6SLawrence Stewart.It 565a5548bf6SLawrence StewartSwitch the active log file pointer to point at the new file path. 566a5548bf6SLawrence Stewart.It 567a5548bf6SLawrence StewartCommence logging to the new file. 568a5548bf6SLawrence Stewart.El 569a5548bf6SLawrence Stewart.El 570a5548bf6SLawrence Stewart.Pp 571a5548bf6SLawrence StewartDuring the time between the flush of pending log messages to the old file and 572a5548bf6SLawrence Stewartcommencing logging to the new file, new log messages will still be generated and 573a5548bf6SLawrence Stewartbuffered. 574a5548bf6SLawrence StewartAs soon as the new file path is ready for writing, the accumulated log messages 575a5548bf6SLawrence Stewartwill be written out to the file. 576a5548bf6SLawrence Stewart.Sh EXAMPLES 577a5548bf6SLawrence StewartTo enable the module's operations, run the following command as root: 578a5548bf6SLawrence Stewartsysctl net.inet.siftr.enabled=1 579a5548bf6SLawrence Stewart.Pp 580a5548bf6SLawrence StewartTo change the granularity of log messages such that 1 log message is 581a5548bf6SLawrence Stewartgenerated for every 10 TCP packets per connection, run the following 582a5548bf6SLawrence Stewartcommand as root: 583a5548bf6SLawrence Stewartsysctl net.inet.siftr.ppl=10 584a5548bf6SLawrence Stewart.Pp 585a5548bf6SLawrence StewartTo change the log file location to /tmp/siftr.log, run the following 586a5548bf6SLawrence Stewartcommand as root: 587a5548bf6SLawrence Stewartsysctl net.inet.siftr.logfile=/tmp/siftr.log 588a5548bf6SLawrence Stewart.Sh SEE ALSO 589d9550d02SMaxim Konovalov.Xr tcpdump 1 , 590d9550d02SMaxim Konovalov.Xr tcp 4 , 591d9550d02SMaxim Konovalov.Xr sysctl 8 , 592a5548bf6SLawrence Stewart.Xr alq 9 , 593a5548bf6SLawrence Stewart.Xr pfil 9 594a5548bf6SLawrence Stewart.Sh ACKNOWLEDGEMENTS 595a5548bf6SLawrence StewartDevelopment of this software was made possible in part by grants from the 596a5548bf6SLawrence StewartCisco University Research Program Fund at Community Foundation Silicon Valley, 597a5548bf6SLawrence Stewartand the FreeBSD Foundation. 598a5548bf6SLawrence Stewart.Sh HISTORY 599a5548bf6SLawrence Stewart.Nm 600a5548bf6SLawrence Stewartfirst appeared in 601d25e560aSLawrence Stewart.Fx 7.4 602d25e560aSLawrence Stewartand 603d25e560aSLawrence Stewart.Fx 8.2 . 604a5548bf6SLawrence Stewart.Pp 605a5548bf6SLawrence Stewart.Nm 606a5548bf6SLawrence Stewartwas first released in 2007 by Lawrence Stewart and James Healy whilst working on 607891b8ed4SLawrence Stewartthe NewTCP research project at Swinburne University of Technology's Centre for 608891b8ed4SLawrence StewartAdvanced Internet Architectures, Melbourne, Australia, which was made possible 609891b8ed4SLawrence Stewartin part by a grant from the Cisco University Research Program Fund at Community 610891b8ed4SLawrence StewartFoundation Silicon Valley. 611a5548bf6SLawrence StewartMore details are available at: 612a5548bf6SLawrence Stewart.Pp 613a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/urp/newtcp/ 614a5548bf6SLawrence Stewart.Pp 615a5548bf6SLawrence StewartWork on 616a5548bf6SLawrence Stewart.Nm 617a5548bf6SLawrence Stewartv1.2.x was sponsored by the FreeBSD Foundation as part of 618a5548bf6SLawrence Stewartthe 619a5548bf6SLawrence Stewart.Qq Enhancing the FreeBSD TCP Implementation 620a5548bf6SLawrence Stewartproject 2008-2009. 621a5548bf6SLawrence StewartMore details are available at: 622a5548bf6SLawrence Stewart.Pp 623a9fd00a8SWolfram Schneiderhttps://www.freebsdfoundation.org/ 624a5548bf6SLawrence Stewart.Pp 625a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/freebsd/etcp09/ 626a5548bf6SLawrence Stewart.Sh AUTHORS 627a5548bf6SLawrence Stewart.An -nosplit 628a5548bf6SLawrence Stewart.Nm 629a5548bf6SLawrence Stewartwas written by 6306c899950SBaptiste Daroussin.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org 631a5548bf6SLawrence Stewartand 6326c899950SBaptiste Daroussin.An James Healy Aq Mt jimmy@deefa.com . 633a5548bf6SLawrence Stewart.Pp 634a5548bf6SLawrence StewartThis manual page was written by 6356c899950SBaptiste Daroussin.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . 636a5548bf6SLawrence Stewart.Sh BUGS 637a5548bf6SLawrence StewartCurrent known limitations and any relevant workarounds are outlined below: 638a5548bf6SLawrence Stewart.Bl -dash 639a5548bf6SLawrence Stewart.It 640a5548bf6SLawrence StewartThe internal queue used to pass information between the threads of operation is 641a5548bf6SLawrence Stewartcurrently unbounded. 642a5548bf6SLawrence StewartThis allows 643a5548bf6SLawrence Stewart.Nm 644a5548bf6SLawrence Stewartto cope with bursty network traffic, but sustained high packet-per-second 645a5548bf6SLawrence Stewarttraffic can cause exhaustion of kernel memory if the processing thread cannot 646a5548bf6SLawrence Stewartkeep up with the packet rate. 647a5548bf6SLawrence Stewart.It 648a5548bf6SLawrence StewartIf using 649a5548bf6SLawrence Stewart.Nm 650a5548bf6SLawrence Stewarton a machine that is also running other modules utilising the 651a5548bf6SLawrence Stewart.Xr pfil 9 652a5548bf6SLawrence Stewartframework e.g. 653a5548bf6SLawrence Stewart.Xr dummynet 4 , 654a5548bf6SLawrence Stewart.Xr ipfw 8 , 655a5548bf6SLawrence Stewart.Xr pf 4 Ns , 656a5548bf6SLawrence Stewartthe order in which you load the modules is important. 657a5548bf6SLawrence StewartYou should kldload the other modules first, as this will ensure TCP packets 658a5548bf6SLawrence Stewartundergo any necessary manipulations before 659a5548bf6SLawrence Stewart.Nm 660a5548bf6SLawrence Stewart.Qq sees 661a5548bf6SLawrence Stewartand processes them. 662a5548bf6SLawrence Stewart.It 663a5548bf6SLawrence StewartThere is a known, harmless lock order reversal warning between the 664a5548bf6SLawrence Stewart.Xr pfil 9 665a5548bf6SLawrence Stewartmutex and tcbinfo TCP lock reported by 666a5548bf6SLawrence Stewart.Xr witness 4 667a5548bf6SLawrence Stewartwhen 668a5548bf6SLawrence Stewart.Nm 669a5548bf6SLawrence Stewartis enabled in a kernel compiled with 670a5548bf6SLawrence Stewart.Xr witness 4 671a5548bf6SLawrence Stewartsupport. 672a5548bf6SLawrence Stewart.It 673a5548bf6SLawrence StewartThere is no way to filter which TCP flows you wish to capture data for. 674a5548bf6SLawrence StewartPost processing is required to separate out data belonging to particular flows 675a5548bf6SLawrence Stewartof interest. 676a5548bf6SLawrence Stewart.It 677a5548bf6SLawrence StewartThe module does not detect deletion of the log file path. 678a5548bf6SLawrence StewartNew log messages will simply be lost if the log file being used by 679a5548bf6SLawrence Stewart.Nm 680a5548bf6SLawrence Stewartis deleted whilst the module is set to use the file. 681a5548bf6SLawrence StewartSwitching to a new log file using the 682a5548bf6SLawrence Stewart.Em net.inet.siftr.logfile 683a5548bf6SLawrence Stewartvariable will create the new file and allow log messages to begin being written 684a5548bf6SLawrence Stewartto disk again. 685a5548bf6SLawrence StewartThe new log file path must differ from the path to the deleted file. 686a5548bf6SLawrence Stewart.It 68725972509SEdward Tomasz NapieralaThe hash table used within the code is sized to hold 65536 flows. 68825972509SEdward Tomasz NapieralaThis is not a 689a5548bf6SLawrence Stewarthard limit, because chaining is used to handle collisions within the hash table 690a5548bf6SLawrence Stewartstructure. 691a5548bf6SLawrence StewartHowever, we suspect (based on analogies with other hash table performance data) 692a5548bf6SLawrence Stewartthat the hash table look up performance (and therefore the module's packet 693a5548bf6SLawrence Stewartprocessing performance) will degrade in an exponential manner as the number of 694a5548bf6SLawrence Stewartunique flows handled in a module enable/disable cycle approaches and surpasses 695a5548bf6SLawrence Stewart65536. 696a5548bf6SLawrence Stewart.It 697a5548bf6SLawrence StewartThere is no garbage collection performed on the flow hash table. 698a5548bf6SLawrence StewartThe only way currently to flush it is to disable 699a5548bf6SLawrence Stewart.Nm . 700a5548bf6SLawrence Stewart.It 701a5548bf6SLawrence StewartThe PPL variable applies to packets that make it into the processing thread, 702a5548bf6SLawrence Stewartnot total packets received in the hook function. 703a5548bf6SLawrence StewartPackets are skipped before the PPL variable is applied, which means there may be 704a5548bf6SLawrence Stewarta slight discrepancy in the triggering of log messages. 705a5548bf6SLawrence StewartFor example, if PPL was set to 10, and the 8th packet since the last log message 706a5548bf6SLawrence Stewartis skipped, the 11th packet will actually trigger the log message to be 707a5548bf6SLawrence Stewartgenerated. 708a5548bf6SLawrence StewartThis is discussed in greater depth in CAIA technical report 070824A. 709a5548bf6SLawrence Stewart.It 710a5548bf6SLawrence StewartAt the time of writing, there was no simple way to hook into the TCP layer 711a5548bf6SLawrence Stewartto intercept packets. 712a5548bf6SLawrence Stewart.Nm Ap s 713a5548bf6SLawrence Stewartuse of IP layer hook points means all IP 714a5548bf6SLawrence Stewarttraffic will be processed by the 715a5548bf6SLawrence Stewart.Nm 716a5548bf6SLawrence Stewart.Xr pfil 9 717a5548bf6SLawrence Stewarthook function, which introduces minor, but nonetheless unnecessary packet delay 718a5548bf6SLawrence Stewartand processing overhead on the system for non-TCP packets as well. 719a5548bf6SLawrence StewartHooking in at the IP layer is also not ideal from the data gathering point of 720a5548bf6SLawrence Stewartview. 721a5548bf6SLawrence StewartPackets traversing up the stack will be intercepted and cause a log message 722a5548bf6SLawrence Stewartgeneration BEFORE they have been processed by the TCP layer, which means we 723a5548bf6SLawrence Stewartcannot observe the cause-and-affect relationship between inbound events and the 724a5548bf6SLawrence Stewartcorresponding TCP control block as precisely as could be. 725a5548bf6SLawrence StewartIdeally, 726a5548bf6SLawrence Stewart.Nm 727a5548bf6SLawrence Stewartshould intercept packets after they have been processed by the TCP layer i.e. 728a5548bf6SLawrence Stewartintercept packets coming up the stack after they have been processed by 7291adc28f5SChristian Brueffer.Fn tcp_input , 7301adc28f5SChristian Bruefferand intercept packets coming down the stack after they have been 7311adc28f5SChristian Bruefferprocessed by 7321adc28f5SChristian Brueffer.Fn tcp_output . 733a5548bf6SLawrence StewartThe current code still gives satisfactory granularity though, as inbound events 734a5548bf6SLawrence Stewarttend to trigger outbound events, allowing the cause-and-effect to be observed 735a5548bf6SLawrence Stewartindirectly by capturing the state on outbound events as well. 736a5548bf6SLawrence Stewart.It 737a5548bf6SLawrence StewartThe 738a5548bf6SLawrence Stewart.Qq inflight bytes 739a5548bf6SLawrence Stewartvalue logged by 740a5548bf6SLawrence Stewart.Nm 741a5548bf6SLawrence Stewartdoes not take into account bytes that have been 742a5548bf6SLawrence Stewart.No SACK Ap ed 743a5548bf6SLawrence Stewartby the receiving host. 744a5548bf6SLawrence Stewart.El 745