14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#!/usr/sbin/dtrace -Cqs
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * or http://www.opensolaris.org/os/licensing.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D option dynvarsize=64m
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define TH_RST 0x04
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define MAX_RECORDS 10
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define M_CTL 0x0d
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define PRINT_MAIN_HEADER() \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (printf("\n%-25s %-6s %-25s %-6s %-10s %-10s %8s %8s\n", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "LADDR", "LPORT", "RADDR", "RPORT", "ISS", "IRS", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "SND_CNT", "RCV_CNT"))
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define PRINT_RECORD_HEADER() \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (printf("%-20s %-20s %-3s %15s %15s %8s %8s %5s\n", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "PROBENAME", "TIME", "S/R", "SEQ", "ACK", "DATALEN", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync "WND", "FLAGS"))
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define PRINT_MAIN_HEADER_VALUES() \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (printf("%-25s %-6d %-25s %-6d %-10d %-10d %8d %8d\n", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync laddr[self->conn_id], lport[self->conn_id], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync faddr[self->conn_id], fport[self->conn_id], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync iss[self->conn_id], irs[self->conn_id], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send_count[self->conn_id], recv_count[self->conn_id]))
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define PRINT_HEADER() \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_MAIN_HEADER(); PRINT_MAIN_HEADER_VALUES(); \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD_HEADER()
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define PRINT_RECORD(i) \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (printf("%-20s %-20Y %-3s %15d %15d %8d %8d %2x\n", \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync probe_name[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync conn_time[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send_recv[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync seqno[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ack[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync datalen[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync wnd[self->conn_id, i], \
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync flags[self->conn_id, i]))
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* extract connection details */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->mp = (mblk_t *)arg0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->mp = (this->mp->b_datap->db_type == M_CTL?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->mp->b_cont : this->mp);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->tcpp = (tcp_t *)arg1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->connp = (conn_t *)self->tcpp->tcp_connp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->iph = (ipha_t *)this->mp->b_rptr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->iph_length =
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (int)(((ipha_t *)self->iph)->ipha_version_and_hdr_length
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync & 0xF) << 2;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->tcph = (tcpha_t *)((char *)self->iph + this->iph_length);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->tcph_length =
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (((tcph_t *)self->tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* ports */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i_lport = ntohs(this->connp->u_port.tcpu_ports.tcpu_lport);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i_fport = ntohs(this->connp->u_port.tcpu_ports.tcpu_fport);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* IP addresses */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->i_fad = (in6_addr_t *)&this->connp->connua_v6addr.connua_faddr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->i_lad = (in6_addr_t *)&this->connp->connua_v6addr.connua_laddr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* the address would either be IPv6 or IPv4-mapped-IPv6 */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i_faddr = inet_ntop(AF_INET6, (void *)this->i_fad);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i_laddr = inet_ntop(AF_INET6, (void *)this->i_lad);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* create connection identifier, so we can track packets by conn */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->conn_id = (uint64_t)self->tcpp->tcp_connp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/first[self->conn_id] == 0/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* initialize counters - this is the first packet for this connection */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pcount[self->conn_id] = -1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync rollover[self->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync end_ptr[self->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync first[self->conn_id] = 1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* connection info */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync laddr[self->conn_id] = self->i_laddr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync faddr[self->conn_id] = self->i_faddr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync lport[self->conn_id] = self->i_lport;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fport[self->conn_id] = self->i_fport;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync iss[self->conn_id] = self->tcpp->tcp_iss;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync irs[self->conn_id] = self->tcpp->tcp_irs;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* counters, to keep track of how much info to dump */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pcount[self->conn_id]++;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync rollover[self->conn_id] |= pcount[self->conn_id]/MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pcount[self->conn_id] = pcount[self->conn_id]%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->pcount = pcount[self->conn_id];
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync end_ptr[self->conn_id] = self->pcount;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id] = (rollover[self->conn_id]?
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync MAX_RECORDS : pcount[self->conn_id] + 1);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync conn_time[self->conn_id, self->pcount] = walltimestamp;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* tcp state info */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync seqno[self->conn_id, self->pcount] = ntohl(self->tcph->tha_seq);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ack[self->conn_id, self->pcount] = ntohl(self->tcph->tha_ack);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync datalen[self->conn_id, self->pcount] = ntohs(self->iph->ipha_length);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync wnd[self->conn_id, self->pcount] = ntohs(self->tcph->tha_win);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync probe_name[self->conn_id, self->pcount] = probename;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* flag 0x04 indicates a RST packet */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync flags[self->conn_id, self->pcount] = self->tcph->tha_flags;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->flags = self->tcph->tha_flags;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-send
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send_count[self->conn_id]++;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send_recv[self->conn_id, self->pcount] = "S";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-recv
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync recv_count[self->conn_id]++;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send_recv[self->conn_id, self->pcount] = "R";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_HEADER();
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (end_ptr[self->conn_id] + MAX_RECORDS - num[self->conn_id]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 10)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 9)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 8)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 7)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 6)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 5)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 4)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 3)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 2)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/(self->flags & TH_RST) && (num[self->conn_id] >= 1)/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync PRINT_RECORD(self->i);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->i = (self->i + 1)%MAX_RECORDS;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->conn_id]--;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->reset = self->conn_id;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctcp-trace-*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/self->reset/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pcount[self->reset] = -1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync rollover[self->reset] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync end_ptr[self->reset] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[self->reset] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync self->reset = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncconn-destroy
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync{
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* clear old connection state */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync this->conn_id = (uint64_t)arg0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pcount[this->conn_id] = -1;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync rollover[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync end_ptr[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync num[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync first[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync laddr[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync faddr[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync lport[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync fport[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync iss[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync irs[this->conn_id] = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}