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.\" 30a5548bf6SLawrence Stewart.\" $FreeBSD$ 31a5548bf6SLawrence Stewart.\" 32*aa61cff4SCheng Cui.Dd May 27, 2023 33a5548bf6SLawrence Stewart.Dt SIFTR 4 34a5548bf6SLawrence Stewart.Os 35a5548bf6SLawrence Stewart.Sh NAME 36a5548bf6SLawrence Stewart.Nm SIFTR 37a5548bf6SLawrence Stewart.Nd Statistical Information For TCP Research 38a5548bf6SLawrence Stewart.Sh SYNOPSIS 39a5548bf6SLawrence StewartTo load 407646a841SJoel Dahlthe driver 41a5548bf6SLawrence Stewartas a module at run-time, run the following command as root: 42a5548bf6SLawrence Stewart.Bd -literal -offset indent 43a5548bf6SLawrence Stewartkldload siftr 44a5548bf6SLawrence Stewart.Ed 45a5548bf6SLawrence Stewart.Pp 46a5548bf6SLawrence StewartAlternatively, to load 477646a841SJoel Dahlthe driver 48a5548bf6SLawrence Stewartas a module at boot time, add the following line into the 49a5548bf6SLawrence Stewart.Xr loader.conf 5 50a5548bf6SLawrence Stewartfile: 51a5548bf6SLawrence Stewart.Bd -literal -offset indent 52a5548bf6SLawrence Stewartsiftr_load="YES" 53a5548bf6SLawrence Stewart.Ed 54a5548bf6SLawrence Stewart.Sh DESCRIPTION 557646a841SJoel DahlThe 56a5548bf6SLawrence Stewart.Nm 577646a841SJoel Dahl.Po 587646a841SJoel Dahl.Em S Ns tatistical 59a5548bf6SLawrence Stewart.Em I Ns nformation 60a5548bf6SLawrence Stewart.Em F Ns or 61a5548bf6SLawrence Stewart.Em T Ns CP 627646a841SJoel Dahl.Em R Ns esearch 637646a841SJoel Dahl.Pc 647646a841SJoel Dahlkernel module logs a range of statistics on active TCP connections to 65a5548bf6SLawrence Stewarta log file. 66a5548bf6SLawrence StewartIt provides the ability to make highly granular measurements of TCP connection 67a5548bf6SLawrence Stewartstate, aimed at system administrators, developers and researchers. 68a5548bf6SLawrence Stewart.Ss Compile-time Configuration 69a5548bf6SLawrence StewartThe default operation of 70a5548bf6SLawrence Stewart.Nm 71a5548bf6SLawrence Stewartis to capture IPv4 TCP/IP packets. 72a5548bf6SLawrence Stewart.Nm 73a5548bf6SLawrence Stewartcan be configured to support IPv4 and IPv6 by uncommenting: 74a5548bf6SLawrence Stewart.Bd -literal -offset indent 75a5548bf6SLawrence StewartCFLAGS+=-DSIFTR_IPV6 76a5548bf6SLawrence Stewart.Ed 77a5548bf6SLawrence Stewart.Pp 78a5548bf6SLawrence Stewartin 79a5548bf6SLawrence Stewart.Aq sys/modules/siftr/Makefile 80a5548bf6SLawrence Stewartand recompiling. 81a5548bf6SLawrence Stewart.Pp 82a5548bf6SLawrence StewartIn the IPv4-only (default) mode, standard dotted decimal notation (e.g. 83a5548bf6SLawrence Stewart"136.186.229.95") is used to format IPv4 addresses for logging. 84a5548bf6SLawrence StewartIn IPv6 mode, standard dotted decimal notation is used to format IPv4 addresses, 85a5548bf6SLawrence Stewartand standard colon-separated hex notation (see RFC 4291) is used to format IPv6 86*aa61cff4SCheng Cuiaddresses (e.g. "fd00::2") for logging. 87a5548bf6SLawrence Stewart.Ss Run-time Configuration 88a5548bf6SLawrence Stewart.Nm 89a5548bf6SLawrence Stewartutilises the 90a5548bf6SLawrence Stewart.Xr sysctl 8 91a5548bf6SLawrence Stewartinterface to export its configuration variables to user-space. 92a5548bf6SLawrence StewartThe following variables are available: 936f5baf29SGlen Barber.Bl -tag -offset indent -width Va 94a5548bf6SLawrence Stewart.It Va net.inet.siftr.enabled 95a5548bf6SLawrence Stewartcontrols whether the module performs its 96a5548bf6SLawrence Stewartmeasurements or not. 97a5548bf6SLawrence StewartBy default, the value is set to 0, which means the module 98a5548bf6SLawrence Stewartwill not be taking any measurements. 99a5548bf6SLawrence StewartHaving the module loaded with 100a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled 101a5548bf6SLawrence Stewartset to 0 will have no impact on the performance of the network stack, as the 102a5548bf6SLawrence Stewartpacket filtering hooks are only inserted when 103a5548bf6SLawrence Stewart.Va net.inet.siftr.enabled 104a5548bf6SLawrence Stewartis set to 1. 105a5548bf6SLawrence Stewart.El 1066f5baf29SGlen Barber.Bl -tag -offset indent -width Va 107a5548bf6SLawrence Stewart.It Va net.inet.siftr.ppl 108a5548bf6SLawrence Stewartcontrols how many inbound/outbound packets for a given TCP connection will cause 109a5548bf6SLawrence Stewarta log message to be generated for the connection. 110a5548bf6SLawrence StewartBy default, the value is set to 1, which means the module will log a message for 111a5548bf6SLawrence Stewartevery packet of every TCP connection. 112a5548bf6SLawrence StewartThe value can be set to any integer in the range [1,2^32], and can be changed at 113a5548bf6SLawrence Stewartany time, even while the module is enabled. 114a5548bf6SLawrence Stewart.El 1156f5baf29SGlen Barber.Bl -tag -offset indent -width Va 116a5548bf6SLawrence Stewart.It Va net.inet.siftr.logfile 117a5548bf6SLawrence Stewartcontrols the path to the file that the module writes its log messages to. 118a5548bf6SLawrence StewartBy default, the file /var/log/siftr.log is used. 119a5548bf6SLawrence StewartThe path can be changed at any time, even while the module is enabled. 120a5548bf6SLawrence Stewart.El 1216f5baf29SGlen Barber.Bl -tag -offset indent -width Va 122746c7ae5SMichael Tuexen.It Va net.inet.siftr.port_filter 123746c7ae5SMichael Tuexencontrols on which source or destination port siftr should capture 124746c7ae5SMichael Tuexen.Nm . 125746c7ae5SMichael TuexenBy default, the value is set to 0, which means all ports are eligible for logging. 126746c7ae5SMichael TuexenSet to any other value, only packets where either the source or destination 127746c7ae5SMichael Tuexenport is equal to this number are logged. 128746c7ae5SMichael Tuexen.El 129a5548bf6SLawrence Stewart.Ss Log Format 130a5548bf6SLawrence StewartA typical 131a5548bf6SLawrence Stewart.Nm 132a5548bf6SLawrence Stewartlog file will contain 3 different types of log message. 133a5548bf6SLawrence StewartAll messages are written in plain ASCII text. 134a5548bf6SLawrence Stewart.Pp 135a5548bf6SLawrence StewartNote: The 136a5548bf6SLawrence Stewart.Qq \e 137a5548bf6SLawrence Stewartpresent in the example log messages in this section indicates a 13850d922a0SGlen Barberline continuation and is not part of the actual log message. 139a5548bf6SLawrence Stewart.Pp 140a5548bf6SLawrence StewartThe first type of log message is written to the file when the module is 14125972509SEdward Tomasz Napieralaenabled and starts collecting data from the running kernel. 14225972509SEdward Tomasz NapieralaThe text below shows an example module enable log. 14325972509SEdward Tomasz NapieralaThe fields are tab delimited key-value 144a5548bf6SLawrence Stewartpairs which describe some basic information about the system. 145a5548bf6SLawrence Stewart.Bd -literal -offset indent 146a5548bf6SLawrence Stewartenable_time_secs=1238556193 enable_time_usecs=462104 \\ 147a5548bf6SLawrence Stewartsiftrver=1.2.2 hz=1000 tcp_rtt_scale=32 \\ 148a5548bf6SLawrence Stewartsysname=FreeBSD sysver=604000 ipmode=4 149a5548bf6SLawrence Stewart.Ed 150a5548bf6SLawrence Stewart.Pp 151a5548bf6SLawrence StewartField descriptions are as follows: 1526f5baf29SGlen Barber.Bl -tag -offset indent -width Va 153a5548bf6SLawrence Stewart.It Va enable_time_secs 154a5548bf6SLawrence Stewarttime at which the module was enabled, in seconds since the UNIX epoch. 155a5548bf6SLawrence Stewart.El 1566f5baf29SGlen Barber.Bl -tag -offset indent -width Va 157a5548bf6SLawrence Stewart.It Va enable_time_usecs 158a5548bf6SLawrence Stewarttime at which the module was enabled, in microseconds since enable_time_secs. 159a5548bf6SLawrence Stewart.El 1606f5baf29SGlen Barber.Bl -tag -offset indent -width Va 161a5548bf6SLawrence Stewart.It Va siftrver 162a5548bf6SLawrence Stewartversion of 163a5548bf6SLawrence Stewart.Nm . 164a5548bf6SLawrence Stewart.El 1656f5baf29SGlen Barber.Bl -tag -offset indent -width Va 166a5548bf6SLawrence Stewart.It Va sysname 16750d922a0SGlen Barberoperating system name. 168a5548bf6SLawrence Stewart.El 1696f5baf29SGlen Barber.Bl -tag -offset indent -width Va 170a5548bf6SLawrence Stewart.It Va sysver 17150d922a0SGlen Barberoperating system version. 172a5548bf6SLawrence Stewart.El 1736f5baf29SGlen Barber.Bl -tag -offset indent -width Va 174a5548bf6SLawrence Stewart.It Va ipmode 175a5548bf6SLawrence StewartIP mode as defined at compile time. 176a5548bf6SLawrence StewartAn ipmode of "4" means IPv6 is not supported and IP addresses are logged in 177a5548bf6SLawrence Stewartregular dotted quad format. 178a5548bf6SLawrence StewartAn ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted 179a5548bf6SLawrence Stewartquad or hex format, as described in the 180a5548bf6SLawrence Stewart.Qq Compile-time Configuration 181a5548bf6SLawrence Stewartsubsection. 182a5548bf6SLawrence Stewart.El 183a5548bf6SLawrence Stewart.Pp 184a5548bf6SLawrence StewartThe second type of log message is written to the file when a data log message 185a5548bf6SLawrence Stewartis generated. 186a5548bf6SLawrence StewartThe text below shows an example data log triggered by an IPv4 187a5548bf6SLawrence StewartTCP/IP packet. 188a5548bf6SLawrence StewartThe data is CSV formatted. 189a5548bf6SLawrence Stewart.Bd -literal -offset indent 190a5548bf6SLawrence Stewarto,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ 1911241e8e7STom Jones1073725440,172312,34,66560,66608,8,1,4,1448,936,1,996,255, \\ 192d4d3e218SLawrence Stewart33304,208,66608,0,208,0 193a5548bf6SLawrence Stewart.Ed 194a5548bf6SLawrence Stewart.Pp 195a5548bf6SLawrence StewartField descriptions are as follows: 1966f5baf29SGlen Barber.Bl -tag -offset indent -width Va 197a5548bf6SLawrence Stewart.It Va 1 198a5548bf6SLawrence StewartDirection of packet that triggered the log message. 199a5548bf6SLawrence StewartEither 200a5548bf6SLawrence Stewart.Qq i 201a5548bf6SLawrence Stewartfor in, or 202a5548bf6SLawrence Stewart.Qq o 203a5548bf6SLawrence Stewartfor out. 204a5548bf6SLawrence Stewart.El 2056f5baf29SGlen Barber.Bl -tag -offset indent -width Va 206a5548bf6SLawrence Stewart.It Va 2 207a5548bf6SLawrence StewartTime at which the packet that triggered the log message was processed by 208a5548bf6SLawrence Stewartthe 209a5548bf6SLawrence Stewart.Xr pfil 9 210a5548bf6SLawrence Stewarthook function, in seconds and microseconds since the UNIX epoch. 211a5548bf6SLawrence Stewart.El 2126f5baf29SGlen Barber.Bl -tag -offset indent -width Va 21360167184SCheng Cui.It Va 3 214a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet) 215a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation. 216a5548bf6SLawrence Stewart.El 2176f5baf29SGlen Barber.Bl -tag -offset indent -width Va 21860167184SCheng Cui.It Va 4 219a5548bf6SLawrence StewartThe TCP port that the local host is communicating via. 220a5548bf6SLawrence Stewart.El 2216f5baf29SGlen Barber.Bl -tag -offset indent -width Va 22260167184SCheng Cui.It Va 5 223a5548bf6SLawrence StewartThe IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet) 224a5548bf6SLawrence Stewartor colon-separated hex (IPv6 packet) notation. 225a5548bf6SLawrence Stewart.El 2266f5baf29SGlen Barber.Bl -tag -offset indent -width Va 22760167184SCheng Cui.It Va 6 228a5548bf6SLawrence StewartThe TCP port that the foreign host is communicating via. 229a5548bf6SLawrence Stewart.El 2306f5baf29SGlen Barber.Bl -tag -offset indent -width Va 23160167184SCheng Cui.It Va 7 232a5548bf6SLawrence StewartThe slow start threshold for the flow, in bytes. 233a5548bf6SLawrence Stewart.El 2346f5baf29SGlen Barber.Bl -tag -offset indent -width Va 23560167184SCheng Cui.It Va 8 236a5548bf6SLawrence StewartThe current congestion window for the flow, in bytes. 237a5548bf6SLawrence Stewart.El 2386f5baf29SGlen Barber.Bl -tag -offset indent -width Va 23960167184SCheng Cui.It Va 9 2401241e8e7STom JonesThe current state of the t_flags2 field for the flow. 241a5548bf6SLawrence Stewart.El 2426f5baf29SGlen Barber.Bl -tag -offset indent -width Va 24360167184SCheng Cui.It Va 10 244a5548bf6SLawrence StewartThe current sending window for the flow, in bytes. 245a5548bf6SLawrence StewartThe post scaled value is reported, except during the initial handshake (first 246a5548bf6SLawrence Stewartfew packets), during which time the unscaled value is reported. 247a5548bf6SLawrence Stewart.El 2486f5baf29SGlen Barber.Bl -tag -offset indent -width Va 24960167184SCheng Cui.It Va 11 250a5548bf6SLawrence StewartThe current receive window for the flow, in bytes. 251a5548bf6SLawrence StewartThe post scaled value is always reported. 252a5548bf6SLawrence Stewart.El 2536f5baf29SGlen Barber.Bl -tag -offset indent -width Va 25460167184SCheng Cui.It Va 12 255a5548bf6SLawrence StewartThe current window scaling factor for the sending window. 256a5548bf6SLawrence Stewart.El 2576f5baf29SGlen Barber.Bl -tag -offset indent -width Va 25860167184SCheng Cui.It Va 13 259a5548bf6SLawrence StewartThe current window scaling factor for the receiving window. 260a5548bf6SLawrence Stewart.El 2616f5baf29SGlen Barber.Bl -tag -offset indent -width Va 26260167184SCheng Cui.It Va 14 263a5548bf6SLawrence StewartThe current state of the TCP finite state machine, as defined 264a5548bf6SLawrence Stewartin 265a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_fsm.h . 266a5548bf6SLawrence Stewart.El 2676f5baf29SGlen Barber.Bl -tag -offset indent -width Va 26860167184SCheng Cui.It Va 15 269a5548bf6SLawrence StewartThe maximum segment size for the flow, in bytes. 270a5548bf6SLawrence Stewart.El 2716f5baf29SGlen Barber.Bl -tag -offset indent -width Va 27260167184SCheng Cui.It Va 16 273d090464eSCheng CuiThe current smoothed RTT estimate for the flow, in units of microsecond. 274a5548bf6SLawrence Stewart.El 2756f5baf29SGlen Barber.Bl -tag -offset indent -width Va 27660167184SCheng Cui.It Va 17 277a5548bf6SLawrence StewartSACK enabled indicator. 1 if SACK enabled, 0 otherwise. 278a5548bf6SLawrence Stewart.El 2796f5baf29SGlen Barber.Bl -tag -offset indent -width Va 28060167184SCheng Cui.It Va 18 281a5548bf6SLawrence StewartThe current state of the TCP flags for the flow. 282a5548bf6SLawrence StewartSee 283a5548bf6SLawrence Stewart.Aq Pa netinet/tcp_var.h 284a5548bf6SLawrence Stewartfor information about the various flags. 285a5548bf6SLawrence Stewart.El 2866f5baf29SGlen Barber.Bl -tag -offset indent -width Va 28760167184SCheng Cui.It Va 19 288d090464eSCheng CuiThe current retransmission timeout length for the flow, in units microsecond. 289a5548bf6SLawrence Stewart.El 2906f5baf29SGlen Barber.Bl -tag -offset indent -width Va 29160167184SCheng Cui.It Va 20 292a5548bf6SLawrence StewartThe current size of the socket send buffer in bytes. 293a5548bf6SLawrence Stewart.El 2946f5baf29SGlen Barber.Bl -tag -offset indent -width Va 29560167184SCheng Cui.It Va 21 296a5548bf6SLawrence StewartThe current number of bytes in the socket send buffer. 297a5548bf6SLawrence Stewart.El 2986f5baf29SGlen Barber.Bl -tag -offset indent -width Va 29960167184SCheng Cui.It Va 22 300a5548bf6SLawrence StewartThe current size of the socket receive buffer in bytes. 301a5548bf6SLawrence Stewart.El 3026f5baf29SGlen Barber.Bl -tag -offset indent -width Va 30360167184SCheng Cui.It Va 23 304a5548bf6SLawrence StewartThe current number of bytes in the socket receive buffer. 305a5548bf6SLawrence Stewart.El 3066f5baf29SGlen Barber.Bl -tag -offset indent -width Va 30760167184SCheng Cui.It Va 24 308a5548bf6SLawrence StewartThe current number of unacknowledged bytes in-flight. 309a5548bf6SLawrence StewartBytes acknowledged via SACK are not excluded from this count. 310a5548bf6SLawrence Stewart.El 3116f5baf29SGlen Barber.Bl -tag -offset indent -width Va 31260167184SCheng Cui.It Va 25 313d4d3e218SLawrence StewartThe current number of segments in the reassembly queue. 314d4d3e218SLawrence Stewart.El 315a025fd14SHiren Panchasara.Bl -tag -offset indent -width Va 31660167184SCheng Cui.It Va 26 317a025fd14SHiren PanchasaraFlowid for the connection. 318a025fd14SHiren PanchasaraA caveat: Zero '0' either represents a valid flowid or a default value when it's 31925972509SEdward Tomasz Napieralanot being set. 32025972509SEdward Tomasz NapieralaThere is no easy way to differentiate without looking at actual 321a025fd14SHiren Panchasaranetwork interface card and drivers being used. 322a025fd14SHiren Panchasara.El 323d0a8b2a5SHiren Panchasara.Bl -tag -offset indent -width Va 32460167184SCheng Cui.It Va 27 325d0a8b2a5SHiren PanchasaraFlow type for the connection. 326d0a8b2a5SHiren PanchasaraFlowtype defines which protocol fields are hashed to produce the flowid. 327d0a8b2a5SHiren PanchasaraA complete listing is available in 328d0a8b2a5SHiren Panchasara.Pa sys/mbuf.h 329d0a8b2a5SHiren Panchasaraunder 330d0a8b2a5SHiren Panchasara.Dv M_HASHTYPE_* . 331d0a8b2a5SHiren Panchasara.El 332a5548bf6SLawrence Stewart.Pp 333a5548bf6SLawrence StewartThe third type of log message is written to the file when the module is disabled 334a5548bf6SLawrence Stewartand ceases collecting data from the running kernel. 335a5548bf6SLawrence StewartThe text below shows an example module disable log. 336a5548bf6SLawrence StewartThe fields are tab delimited key-value pairs which provide statistics about 337a5548bf6SLawrence Stewartoperations since the module was most recently enabled. 338a5548bf6SLawrence Stewart.Bd -literal -offset indent 339a5548bf6SLawrence Stewartdisable_time_secs=1238556197 disable_time_usecs=933607 \\ 340a5548bf6SLawrence Stewartnum_inbound_tcp_pkts=356 num_outbound_tcp_pkts=627 \\ 341a5548bf6SLawrence Stewarttotal_tcp_pkts=983 num_inbound_skipped_pkts_malloc=0 \\ 3421f782fccSCheng Cuinum_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_tcb=0 \\ 343a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_tcb=0 num_inbound_skipped_pkts_icb=0 \\ 344a5548bf6SLawrence Stewartnum_outbound_skipped_pkts_icb=0 total_skipped_tcp_pkts=0 \\ 345a5548bf6SLawrence Stewartflow_list=172.16.7.28;22-172.16.2.5;55931, 346a5548bf6SLawrence Stewart.Ed 347a5548bf6SLawrence Stewart.Pp 348a5548bf6SLawrence StewartField descriptions are as follows: 3496f5baf29SGlen Barber.Bl -tag -offset indent -width Va 350a5548bf6SLawrence Stewart.It Va disable_time_secs 351a5548bf6SLawrence StewartTime at which the module was disabled, in seconds since the UNIX epoch. 352a5548bf6SLawrence Stewart.El 3536f5baf29SGlen Barber.Bl -tag -offset indent -width Va 354a5548bf6SLawrence Stewart.It Va disable_time_usecs 355a5548bf6SLawrence StewartTime at which the module was disabled, in microseconds since disable_time_secs. 356a5548bf6SLawrence Stewart.El 3576f5baf29SGlen Barber.Bl -tag -offset indent -width Va 358a5548bf6SLawrence Stewart.It Va num_inbound_tcp_pkts 359a5548bf6SLawrence StewartNumber of TCP packets that traversed up the network stack. 360a5548bf6SLawrence StewartThis only includes inbound TCP packets during the periods when 361a5548bf6SLawrence Stewart.Nm 362a5548bf6SLawrence Stewartwas enabled. 363a5548bf6SLawrence Stewart.El 3646f5baf29SGlen Barber.Bl -tag -offset indent -width Va 365a5548bf6SLawrence Stewart.It Va num_outbound_tcp_pkts 366a5548bf6SLawrence StewartNumber of TCP packets that traversed down the network stack. 367a5548bf6SLawrence StewartThis only includes outbound TCP packets during the periods when 368a5548bf6SLawrence Stewart.Nm 369a5548bf6SLawrence Stewartwas enabled. 370a5548bf6SLawrence Stewart.El 3716f5baf29SGlen Barber.Bl -tag -offset indent -width Va 372a5548bf6SLawrence Stewart.It Va total_tcp_pkts 373a5548bf6SLawrence StewartThe summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts. 374a5548bf6SLawrence Stewart.El 3756f5baf29SGlen Barber.Bl -tag -offset indent -width Va 376a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_malloc 3771adc28f5SChristian BruefferNumber of inbound packets that were not processed because of failed 3781adc28f5SChristian Brueffer.Fn malloc 3791adc28f5SChristian Brueffercalls. 380a5548bf6SLawrence Stewart.El 3816f5baf29SGlen Barber.Bl -tag -offset indent -width Va 382a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_malloc 3831adc28f5SChristian BruefferNumber of outbound packets that were not processed because of failed 3841adc28f5SChristian Brueffer.Fn malloc 3851adc28f5SChristian Brueffercalls. 386a5548bf6SLawrence Stewart.El 3876f5baf29SGlen Barber.Bl -tag -offset indent -width Va 388a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_tcb 389a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the 390a5548bf6SLawrence StewartTCP control block associated with the packet. 391a5548bf6SLawrence Stewart.El 3926f5baf29SGlen Barber.Bl -tag -offset indent -width Va 393a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_tcb 394a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find 395a5548bf6SLawrence Stewartthe TCP control block associated with the packet. 396a5548bf6SLawrence Stewart.El 3976f5baf29SGlen Barber.Bl -tag -offset indent -width Va 398a5548bf6SLawrence Stewart.It Va num_inbound_skipped_pkts_icb 399a5548bf6SLawrence StewartNumber of inbound packets that were not processed because of failure to find the 400a5548bf6SLawrence StewartIP control block associated with the packet. 401a5548bf6SLawrence Stewart.El 4026f5baf29SGlen Barber.Bl -tag -offset indent -width Va 403a5548bf6SLawrence Stewart.It Va num_outbound_skipped_pkts_icb 404a5548bf6SLawrence StewartNumber of outbound packets that were not processed because of failure to find 405a5548bf6SLawrence Stewartthe IP control block associated with the packet. 406a5548bf6SLawrence Stewart.El 4076f5baf29SGlen Barber.Bl -tag -offset indent -width Va 408a5548bf6SLawrence Stewart.It Va total_skipped_tcp_pkts 409a5548bf6SLawrence StewartThe summation of all skipped packet counters. 410a5548bf6SLawrence Stewart.El 4116f5baf29SGlen Barber.Bl -tag -offset indent -width Va 412a5548bf6SLawrence Stewart.It Va flow_list 413a5548bf6SLawrence StewartA CSV list of TCP flows that triggered data log messages to be generated since 414a5548bf6SLawrence Stewartthe module was loaded. 415a5548bf6SLawrence StewartEach flow entry in the CSV list is 416a5548bf6SLawrence Stewartformatted as 417a5548bf6SLawrence Stewart.Qq local_ip;local_port-foreign_ip;foreign_port . 4186f5baf29SGlen BarberIf there are no entries in the list (i.e., no data log messages were generated), 419a5548bf6SLawrence Stewartthe value will be blank. 420a5548bf6SLawrence StewartIf there is at least one entry in the list, a trailing comma will always be 421a5548bf6SLawrence Stewartpresent. 422a5548bf6SLawrence Stewart.El 423a5548bf6SLawrence Stewart.Pp 424a5548bf6SLawrence StewartThe total number of data log messages found in the log file for a module 425a5548bf6SLawrence Stewartenable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts. 426a5548bf6SLawrence Stewart.Sh IMPLEMENTATION NOTES 427a5548bf6SLawrence Stewart.Nm 428a5548bf6SLawrence Stewarthooks into the network stack using the 429a5548bf6SLawrence Stewart.Xr pfil 9 430a5548bf6SLawrence Stewartinterface. 431a5548bf6SLawrence StewartIn its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6) 432a5548bf6SLawrence Stewart.Xr pfil 9 433a5548bf6SLawrence Stewartfiltering points, which means it sees packets at the IP layer of the network 434a5548bf6SLawrence Stewartstack. 435a5548bf6SLawrence StewartThis means that TCP packets inbound to the stack are intercepted before 436a5548bf6SLawrence Stewartthey have been processed by the TCP layer. 437a5548bf6SLawrence StewartPackets outbound from the stack are intercepted after they have been processed 438a5548bf6SLawrence Stewartby the TCP layer. 439a5548bf6SLawrence Stewart.Pp 440a5548bf6SLawrence StewartThe diagram below illustrates how 441a5548bf6SLawrence Stewart.Nm 442a5548bf6SLawrence Stewartinserts itself into the stack. 443a5548bf6SLawrence Stewart.Bd -literal -offset indent 444a5548bf6SLawrence Stewart---------------------------------- 445a5548bf6SLawrence Stewart Upper Layers 446a5548bf6SLawrence Stewart---------------------------------- 447a5548bf6SLawrence Stewart ^ | 448a5548bf6SLawrence Stewart | | 449a5548bf6SLawrence Stewart | | 450a5548bf6SLawrence Stewart | v 451a5548bf6SLawrence Stewart TCP in TCP out 452a5548bf6SLawrence Stewart---------------------------------- 453a5548bf6SLawrence Stewart ^ | 454a5548bf6SLawrence Stewart |________ _________| 455a5548bf6SLawrence Stewart | | 456a5548bf6SLawrence Stewart | v 457a5548bf6SLawrence Stewart --------- 458a5548bf6SLawrence Stewart | SIFTR | 459a5548bf6SLawrence Stewart --------- 460a5548bf6SLawrence Stewart ^ | 461a5548bf6SLawrence Stewart ________| |__________ 462a5548bf6SLawrence Stewart | | 463a5548bf6SLawrence Stewart | v 464a5548bf6SLawrence StewartIPv{4/6} in IPv{4/6} out 465a5548bf6SLawrence Stewart---------------------------------- 466a5548bf6SLawrence Stewart ^ | 467a5548bf6SLawrence Stewart | | 468a5548bf6SLawrence Stewart | v 469a5548bf6SLawrence StewartLayer 2 in Layer 2 out 470a5548bf6SLawrence Stewart---------------------------------- 471a5548bf6SLawrence Stewart Physical Layer 472a5548bf6SLawrence Stewart---------------------------------- 473a5548bf6SLawrence Stewart.Ed 474a5548bf6SLawrence Stewart.Pp 475a5548bf6SLawrence Stewart.Nm 476a5548bf6SLawrence Stewartuses the 477a5548bf6SLawrence Stewart.Xr alq 9 478a5548bf6SLawrence Stewartinterface to manage writing data to disk. 479a5548bf6SLawrence Stewart.Pp 480a5548bf6SLawrence StewartAt first glance, you might mistakenly think that 481a5548bf6SLawrence Stewart.Nm 482a5548bf6SLawrence Stewartextracts information from 483a5548bf6SLawrence Stewartindividual TCP packets. 484a5548bf6SLawrence StewartThis is not the case. 485a5548bf6SLawrence Stewart.Nm 486a5548bf6SLawrence Stewartuses TCP packet events (inbound and outbound) for each TCP flow originating from 487a5548bf6SLawrence Stewartthe system to trigger a dump of the state of the TCP control block for that 488a5548bf6SLawrence Stewartflow. 489a5548bf6SLawrence StewartWith the PPL set to 1, we are in effect sampling each TCP flow's control block 490a5548bf6SLawrence Stewartstate as frequently as flow packets enter/leave the system. 4916f5baf29SGlen BarberFor example, setting PPL to 2 halves the sampling rate i.e., every second flow 492a5548bf6SLawrence Stewartpacket (inbound OR outbound) causes a dump of the control block state. 493a5548bf6SLawrence Stewart.Pp 4946f5baf29SGlen BarberThe distinction between interrogating individual packets versus interrogating the 495a5548bf6SLawrence Stewartcontrol block is important, because 496a5548bf6SLawrence Stewart.Nm 497a5548bf6SLawrence Stewartdoes not remove the need for packet capturing tools like 498a5548bf6SLawrence Stewart.Xr tcpdump 1 . 499a5548bf6SLawrence Stewart.Nm 500a5548bf6SLawrence Stewartallows you to correlate and observe the cause-and-affect relationship between 501a5548bf6SLawrence Stewartwhat you see on the wire (captured using a tool like 502a5548bf6SLawrence Stewart.Xr tcpdump 1 Ns ) 503a5548bf6SLawrence Stewartand changes in the TCP control block corresponding to the flow of interest. 504a5548bf6SLawrence StewartIt is therefore useful to use 505a5548bf6SLawrence Stewart.Nm 506a5548bf6SLawrence Stewartand a tool like 507a5548bf6SLawrence Stewart.Xr tcpdump 1 508a5548bf6SLawrence Stewartto gather the necessary data to piece together the complete picture. 509a5548bf6SLawrence StewartUse of either tool on its own will not be able to provide all of the necessary 510a5548bf6SLawrence Stewartdata. 511a5548bf6SLawrence Stewart.Pp 512a5548bf6SLawrence StewartAs a result of needing to interrogate the TCP control block, certain packets 513a5548bf6SLawrence Stewartduring the lifecycle of a connection are unable to trigger a 514a5548bf6SLawrence Stewart.Nm 515a5548bf6SLawrence Stewartlog message. 516a5548bf6SLawrence StewartThe initial handshake takes place without the existence of a control block and 517a5548bf6SLawrence Stewartthe final ACK is exchanged when the connection is in the TIMEWAIT state. 518a5548bf6SLawrence Stewart.Pp 519a5548bf6SLawrence Stewart.Nm 520a5548bf6SLawrence Stewartwas designed to minimise the delay introduced to packets traversing the network 521a5548bf6SLawrence Stewartstack. 522a5548bf6SLawrence StewartThis design called for a highly optimised and minimal hook function that 523a5548bf6SLawrence Stewartextracted the minimal details necessary whilst holding the packet up, and 524a5548bf6SLawrence Stewartpassing these details to another thread for actual processing and logging. 525a5548bf6SLawrence Stewart.Pp 526a5548bf6SLawrence StewartThis multithreaded design does introduce some contention issues when accessing 527a5548bf6SLawrence Stewartthe data structure shared between the threads of operation. 528a5548bf6SLawrence StewartWhen the hook function tries to place details in the structure, it must first 529a5548bf6SLawrence Stewartacquire an exclusive lock. 530a5548bf6SLawrence StewartLikewise, when the processing thread tries to read details from the structure, 531a5548bf6SLawrence Stewartit must also acquire an exclusive lock to do so. 532a5548bf6SLawrence StewartIf one thread holds the lock, the other must wait before it can obtain it. 533a5548bf6SLawrence StewartThis does introduce some additional bounded delay into the kernel's packet 534a5548bf6SLawrence Stewartprocessing code path. 535a5548bf6SLawrence Stewart.Pp 5366f5baf29SGlen BarberIn some cases (e.g., low memory, connection termination), TCP packets that enter 537a5548bf6SLawrence Stewartthe 538a5548bf6SLawrence Stewart.Nm 539a5548bf6SLawrence Stewart.Xr pfil 9 540a5548bf6SLawrence Stewarthook function will not trigger a log message to be generated. 541a5548bf6SLawrence Stewart.Nm 542a5548bf6SLawrence Stewartrefers to this outcome as a 543a5548bf6SLawrence Stewart.Qq skipped packet . 544a5548bf6SLawrence StewartNote that 545a5548bf6SLawrence Stewart.Nm 546a5548bf6SLawrence Stewartalways ensures that packets are allowed to continue through the stack, even if 547a5548bf6SLawrence Stewartthey could not successfully trigger a data log message. 548a5548bf6SLawrence Stewart.Nm 549a5548bf6SLawrence Stewartwill therefore not introduce any packet loss for TCP/IP packets traversing the 550a5548bf6SLawrence Stewartnetwork stack. 551a5548bf6SLawrence Stewart.Ss Important Behaviours 552a5548bf6SLawrence StewartThe behaviour of a log file path change whilst the module is enabled is as 553a5548bf6SLawrence Stewartfollows: 554a5548bf6SLawrence Stewart.Bl -enum 555a5548bf6SLawrence Stewart.It 556a5548bf6SLawrence StewartAttempt to open the new file path for writing. 557a5548bf6SLawrence StewartIf this fails, the path change will fail and the existing path will continue to 558a5548bf6SLawrence Stewartbe used. 559a5548bf6SLawrence Stewart.It 560a5548bf6SLawrence StewartAssuming the new path is valid and opened successfully: 561a5548bf6SLawrence Stewart.Bl -dash 562a5548bf6SLawrence Stewart.It 563a5548bf6SLawrence StewartFlush all pending log messages to the old file path. 564a5548bf6SLawrence Stewart.It 565a5548bf6SLawrence StewartClose the old file path. 566a5548bf6SLawrence Stewart.It 567a5548bf6SLawrence StewartSwitch the active log file pointer to point at the new file path. 568a5548bf6SLawrence Stewart.It 569a5548bf6SLawrence StewartCommence logging to the new file. 570a5548bf6SLawrence Stewart.El 571a5548bf6SLawrence Stewart.El 572a5548bf6SLawrence Stewart.Pp 573a5548bf6SLawrence StewartDuring the time between the flush of pending log messages to the old file and 574a5548bf6SLawrence Stewartcommencing logging to the new file, new log messages will still be generated and 575a5548bf6SLawrence Stewartbuffered. 576a5548bf6SLawrence StewartAs soon as the new file path is ready for writing, the accumulated log messages 577a5548bf6SLawrence Stewartwill be written out to the file. 578a5548bf6SLawrence Stewart.Sh EXAMPLES 579a5548bf6SLawrence StewartTo enable the module's operations, run the following command as root: 580a5548bf6SLawrence Stewartsysctl net.inet.siftr.enabled=1 581a5548bf6SLawrence Stewart.Pp 582a5548bf6SLawrence StewartTo change the granularity of log messages such that 1 log message is 583a5548bf6SLawrence Stewartgenerated for every 10 TCP packets per connection, run the following 584a5548bf6SLawrence Stewartcommand as root: 585a5548bf6SLawrence Stewartsysctl net.inet.siftr.ppl=10 586a5548bf6SLawrence Stewart.Pp 587a5548bf6SLawrence StewartTo change the log file location to /tmp/siftr.log, run the following 588a5548bf6SLawrence Stewartcommand as root: 589a5548bf6SLawrence Stewartsysctl net.inet.siftr.logfile=/tmp/siftr.log 590a5548bf6SLawrence Stewart.Sh SEE ALSO 591d9550d02SMaxim Konovalov.Xr tcpdump 1 , 592d9550d02SMaxim Konovalov.Xr tcp 4 , 593d9550d02SMaxim Konovalov.Xr sysctl 8 , 594a5548bf6SLawrence Stewart.Xr alq 9 , 595a5548bf6SLawrence Stewart.Xr pfil 9 596a5548bf6SLawrence Stewart.Sh ACKNOWLEDGEMENTS 597a5548bf6SLawrence StewartDevelopment of this software was made possible in part by grants from the 598a5548bf6SLawrence StewartCisco University Research Program Fund at Community Foundation Silicon Valley, 599a5548bf6SLawrence Stewartand the FreeBSD Foundation. 600a5548bf6SLawrence Stewart.Sh HISTORY 601a5548bf6SLawrence Stewart.Nm 602a5548bf6SLawrence Stewartfirst appeared in 603d25e560aSLawrence Stewart.Fx 7.4 604d25e560aSLawrence Stewartand 605d25e560aSLawrence Stewart.Fx 8.2 . 606a5548bf6SLawrence Stewart.Pp 607a5548bf6SLawrence Stewart.Nm 608a5548bf6SLawrence Stewartwas first released in 2007 by Lawrence Stewart and James Healy whilst working on 609891b8ed4SLawrence Stewartthe NewTCP research project at Swinburne University of Technology's Centre for 610891b8ed4SLawrence StewartAdvanced Internet Architectures, Melbourne, Australia, which was made possible 611891b8ed4SLawrence Stewartin part by a grant from the Cisco University Research Program Fund at Community 612891b8ed4SLawrence StewartFoundation Silicon Valley. 613a5548bf6SLawrence StewartMore details are available at: 614a5548bf6SLawrence Stewart.Pp 615a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/urp/newtcp/ 616a5548bf6SLawrence Stewart.Pp 617a5548bf6SLawrence StewartWork on 618a5548bf6SLawrence Stewart.Nm 619a5548bf6SLawrence Stewartv1.2.x was sponsored by the FreeBSD Foundation as part of 620a5548bf6SLawrence Stewartthe 621a5548bf6SLawrence Stewart.Qq Enhancing the FreeBSD TCP Implementation 622a5548bf6SLawrence Stewartproject 2008-2009. 623a5548bf6SLawrence StewartMore details are available at: 624a5548bf6SLawrence Stewart.Pp 625a9fd00a8SWolfram Schneiderhttps://www.freebsdfoundation.org/ 626a5548bf6SLawrence Stewart.Pp 627a5548bf6SLawrence Stewarthttp://caia.swin.edu.au/freebsd/etcp09/ 628a5548bf6SLawrence Stewart.Sh AUTHORS 629a5548bf6SLawrence Stewart.An -nosplit 630a5548bf6SLawrence Stewart.Nm 631a5548bf6SLawrence Stewartwas written by 6326c899950SBaptiste Daroussin.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org 633a5548bf6SLawrence Stewartand 6346c899950SBaptiste Daroussin.An James Healy Aq Mt jimmy@deefa.com . 635a5548bf6SLawrence Stewart.Pp 636a5548bf6SLawrence StewartThis manual page was written by 6376c899950SBaptiste Daroussin.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org . 638a5548bf6SLawrence Stewart.Sh BUGS 639a5548bf6SLawrence StewartCurrent known limitations and any relevant workarounds are outlined below: 640a5548bf6SLawrence Stewart.Bl -dash 641a5548bf6SLawrence Stewart.It 642a5548bf6SLawrence StewartThe internal queue used to pass information between the threads of operation is 643a5548bf6SLawrence Stewartcurrently unbounded. 644a5548bf6SLawrence StewartThis allows 645a5548bf6SLawrence Stewart.Nm 646a5548bf6SLawrence Stewartto cope with bursty network traffic, but sustained high packet-per-second 647a5548bf6SLawrence Stewarttraffic can cause exhaustion of kernel memory if the processing thread cannot 648a5548bf6SLawrence Stewartkeep up with the packet rate. 649a5548bf6SLawrence Stewart.It 650a5548bf6SLawrence StewartIf using 651a5548bf6SLawrence Stewart.Nm 652a5548bf6SLawrence Stewarton a machine that is also running other modules utilising the 653a5548bf6SLawrence Stewart.Xr pfil 9 654a5548bf6SLawrence Stewartframework e.g. 655a5548bf6SLawrence Stewart.Xr dummynet 4 , 656a5548bf6SLawrence Stewart.Xr ipfw 8 , 657a5548bf6SLawrence Stewart.Xr pf 4 Ns , 658a5548bf6SLawrence Stewartthe order in which you load the modules is important. 659a5548bf6SLawrence StewartYou should kldload the other modules first, as this will ensure TCP packets 660a5548bf6SLawrence Stewartundergo any necessary manipulations before 661a5548bf6SLawrence Stewart.Nm 662a5548bf6SLawrence Stewart.Qq sees 663a5548bf6SLawrence Stewartand processes them. 664a5548bf6SLawrence Stewart.It 665a5548bf6SLawrence StewartThere is a known, harmless lock order reversal warning between the 666a5548bf6SLawrence Stewart.Xr pfil 9 667a5548bf6SLawrence Stewartmutex and tcbinfo TCP lock reported by 668a5548bf6SLawrence Stewart.Xr witness 4 669a5548bf6SLawrence Stewartwhen 670a5548bf6SLawrence Stewart.Nm 671a5548bf6SLawrence Stewartis enabled in a kernel compiled with 672a5548bf6SLawrence Stewart.Xr witness 4 673a5548bf6SLawrence Stewartsupport. 674a5548bf6SLawrence Stewart.It 675a5548bf6SLawrence StewartThere is no way to filter which TCP flows you wish to capture data for. 676a5548bf6SLawrence StewartPost processing is required to separate out data belonging to particular flows 677a5548bf6SLawrence Stewartof interest. 678a5548bf6SLawrence Stewart.It 679a5548bf6SLawrence StewartThe module does not detect deletion of the log file path. 680a5548bf6SLawrence StewartNew log messages will simply be lost if the log file being used by 681a5548bf6SLawrence Stewart.Nm 682a5548bf6SLawrence Stewartis deleted whilst the module is set to use the file. 683a5548bf6SLawrence StewartSwitching to a new log file using the 684a5548bf6SLawrence Stewart.Em net.inet.siftr.logfile 685a5548bf6SLawrence Stewartvariable will create the new file and allow log messages to begin being written 686a5548bf6SLawrence Stewartto disk again. 687a5548bf6SLawrence StewartThe new log file path must differ from the path to the deleted file. 688a5548bf6SLawrence Stewart.It 68925972509SEdward Tomasz NapieralaThe hash table used within the code is sized to hold 65536 flows. 69025972509SEdward Tomasz NapieralaThis is not a 691a5548bf6SLawrence Stewarthard limit, because chaining is used to handle collisions within the hash table 692a5548bf6SLawrence Stewartstructure. 693a5548bf6SLawrence StewartHowever, we suspect (based on analogies with other hash table performance data) 694a5548bf6SLawrence Stewartthat the hash table look up performance (and therefore the module's packet 695a5548bf6SLawrence Stewartprocessing performance) will degrade in an exponential manner as the number of 696a5548bf6SLawrence Stewartunique flows handled in a module enable/disable cycle approaches and surpasses 697a5548bf6SLawrence Stewart65536. 698a5548bf6SLawrence Stewart.It 699a5548bf6SLawrence StewartThere is no garbage collection performed on the flow hash table. 700a5548bf6SLawrence StewartThe only way currently to flush it is to disable 701a5548bf6SLawrence Stewart.Nm . 702a5548bf6SLawrence Stewart.It 703a5548bf6SLawrence StewartThe PPL variable applies to packets that make it into the processing thread, 704a5548bf6SLawrence Stewartnot total packets received in the hook function. 705a5548bf6SLawrence StewartPackets are skipped before the PPL variable is applied, which means there may be 706a5548bf6SLawrence Stewarta slight discrepancy in the triggering of log messages. 707a5548bf6SLawrence StewartFor example, if PPL was set to 10, and the 8th packet since the last log message 708a5548bf6SLawrence Stewartis skipped, the 11th packet will actually trigger the log message to be 709a5548bf6SLawrence Stewartgenerated. 710a5548bf6SLawrence StewartThis is discussed in greater depth in CAIA technical report 070824A. 711a5548bf6SLawrence Stewart.It 712a5548bf6SLawrence StewartAt the time of writing, there was no simple way to hook into the TCP layer 713a5548bf6SLawrence Stewartto intercept packets. 714a5548bf6SLawrence Stewart.Nm Ap s 715a5548bf6SLawrence Stewartuse of IP layer hook points means all IP 716a5548bf6SLawrence Stewarttraffic will be processed by the 717a5548bf6SLawrence Stewart.Nm 718a5548bf6SLawrence Stewart.Xr pfil 9 719a5548bf6SLawrence Stewarthook function, which introduces minor, but nonetheless unnecessary packet delay 720a5548bf6SLawrence Stewartand processing overhead on the system for non-TCP packets as well. 721a5548bf6SLawrence StewartHooking in at the IP layer is also not ideal from the data gathering point of 722a5548bf6SLawrence Stewartview. 723a5548bf6SLawrence StewartPackets traversing up the stack will be intercepted and cause a log message 724a5548bf6SLawrence Stewartgeneration BEFORE they have been processed by the TCP layer, which means we 725a5548bf6SLawrence Stewartcannot observe the cause-and-affect relationship between inbound events and the 726a5548bf6SLawrence Stewartcorresponding TCP control block as precisely as could be. 727a5548bf6SLawrence StewartIdeally, 728a5548bf6SLawrence Stewart.Nm 729a5548bf6SLawrence Stewartshould intercept packets after they have been processed by the TCP layer i.e. 730a5548bf6SLawrence Stewartintercept packets coming up the stack after they have been processed by 7311adc28f5SChristian Brueffer.Fn tcp_input , 7321adc28f5SChristian Bruefferand intercept packets coming down the stack after they have been 7331adc28f5SChristian Bruefferprocessed by 7341adc28f5SChristian Brueffer.Fn tcp_output . 735a5548bf6SLawrence StewartThe current code still gives satisfactory granularity though, as inbound events 736a5548bf6SLawrence Stewarttend to trigger outbound events, allowing the cause-and-effect to be observed 737a5548bf6SLawrence Stewartindirectly by capturing the state on outbound events as well. 738a5548bf6SLawrence Stewart.It 739a5548bf6SLawrence StewartThe 740a5548bf6SLawrence Stewart.Qq inflight bytes 741a5548bf6SLawrence Stewartvalue logged by 742a5548bf6SLawrence Stewart.Nm 743a5548bf6SLawrence Stewartdoes not take into account bytes that have been 744a5548bf6SLawrence Stewart.No SACK Ap ed 745a5548bf6SLawrence Stewartby the receiving host. 746a5548bf6SLawrence Stewart.El 747