From nobody Wed Apr 19 16:54:15 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q1n1z30HPz46C38; Wed, 19 Apr 2023 16:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q1n1z2RFTz3jRc; Wed, 19 Apr 2023 16:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681923255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6ZiVtEBXYM+cKiHZPc2XnfM+5Qo3My2YZQmLXOfAu9Y=; b=h/VjqLMEjeqJDZ6oI8WUz+iPE7GWHVkLv/2LUhEEIH077x1zTJqg3vq5boOZSb9F1YmbPa v7nnhvBfVq3dK0tq+2r1Xu0voNOsU2jF9R3Oo2s6J8LLFxbudglamR2/a+FltjeapRdTRo y8QpwEboOvf9MuTqZTwsSCFf1zghajnxVFy6gmk2j2Y7HVUKfU5WvGr3j4nx3kP0b0HSHt CLTX+SKuGYH+eeyDq5xjMdUR2dJNM4w9SCxaVkorHuUS2MxRDjOR/XpBYWBEmnu5bOWUJE uVUH3dQUKkJp+8E/GJP4nGYtzfcna4yM0iq2Q6+cmxdLjwhQu8RvKyaGSYIywg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681923255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6ZiVtEBXYM+cKiHZPc2XnfM+5Qo3My2YZQmLXOfAu9Y=; b=Oh7/qSFAvqJP5Xa130ZKyhsrx1Ai6LwAJDPPbOiZOnbvjDRtINIF+IVCd34Qm7zwUCQibZ HwqJZKxtArTx69TOCYGnD1apwEkyWpVw2HXsJ+zSP5G4xSFQHSLIwQZ58BhnrrOcYJtk1w Ukg4qPQ0NeHTjrLs4E8X+/JtlCcYxmSTm0TZsQsbqiJiYJlIP3JylJH8gJJbld3gEhwXKZ y0ViTw0xSoJ5WVspO/XpkzfWv1SqPsUvHoJII6UERJekKp48H5KDCdBhy/4aE8dMJ4gHYF 8bxvSGok9Z84DQ6CWr1hrTOUo/CWxZ2R+HpJn+zT6dWne3yn+B7laHlr5ARw9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681923255; a=rsa-sha256; cv=none; b=KeGs7Xlbi2OJeEONQ0ulRga6MI8U54A2rgwtFISwjoSE4hvXYyO8oZopl/IduBZN0Z9aXf VZKn/R/GaUW4NiwviVDijBSSrm5goW3VnayfD2w8beTuER8TMiCLCpf6hN89WEus/FwVtH ebkITchtbh+XQjT2oK/j80r/pTvhYI79QTUZMkXaByUDjMy7ODbjjCUgYf8OzYr2js+xw6 RCBTbXd0ZChE2fYg2KLqyMbQbux/HUHwrUsSoEp6jXqzQFx7JG+sYHvDZhxKMAam+9cG1i jhop71h1BbkUe6fbK4lZUSxDNXHDHRlUjqsMcuA88mlXgGjUuGyhVvb2BiXROw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Q1n1z1PnWz12wy; Wed, 19 Apr 2023 16:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33JGsFR4039043; Wed, 19 Apr 2023 16:54:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33JGsFaI039042; Wed, 19 Apr 2023 16:54:15 GMT (envelope-from git) Date: Wed, 19 Apr 2023 16:54:15 GMT Message-Id: <202304191654.33JGsFaI039042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 303246dcdf44 - main - We have a TCP_LOG_CONNEND log that should come out at the very last log of every connection. This holds some nice stats about why/how the connection ended. Though with the current code it does not come out without accounting due to the placement of the ifdefs. Also we need to make sure the stacks fini has ran before calling in from tcp_subr so we get all logs the stack may make at its ending. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 303246dcdf445e5bcc19c1a2410b2aa47b0e304f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=303246dcdf445e5bcc19c1a2410b2aa47b0e304f commit 303246dcdf445e5bcc19c1a2410b2aa47b0e304f Author: Randall Stewart AuthorDate: 2023-04-19 16:54:25 +0000 Commit: Randall Stewart CommitDate: 2023-04-19 16:54:25 +0000 We have a TCP_LOG_CONNEND log that should come out at the very last log of every connection. This holds some nice stats about why/how the connection ended. Though with the current code it does not come out without accounting due to the placement of the ifdefs. Also we need to make sure the stacks fini has ran before calling in from tcp_subr so we get all logs the stack may make at its ending. Reviewed by: rscheff Sponsored by: Netflix Inc Differential Revision:https://reviews.freebsd.org/D39693 --- sys/netinet/tcp_log_buf.c | 18 +++++++++--------- sys/netinet/tcp_subr.c | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/netinet/tcp_log_buf.c b/sys/netinet/tcp_log_buf.c index c533f8329fbe..fb8cb4453136 100644 --- a/sys/netinet/tcp_log_buf.c +++ b/sys/netinet/tcp_log_buf.c @@ -1432,11 +1432,11 @@ tcp_log_tcpcbfini(struct tcpcb *tp) INP_WLOCK_ASSERT(tptoinpcb(tp)); -#ifdef TCP_ACCOUNTING if (tp->_t_logstate) { - struct tcp_log_buffer *lgb; union tcp_log_stackspecific log; struct timeval tv; +#ifdef TCP_ACCOUNTING + struct tcp_log_buffer *lgb; int i; memset(&log, 0, sizeof(log)); @@ -1468,15 +1468,15 @@ tcp_log_tcpcbfini(struct tcpcb *tp) } } skip_out: +#endif log.u_bbr.timeStamp = tcp_get_usecs(&tv); log.u_bbr.cur_del_rate = tp->t_end_info; - TCP_LOG_EVENTP(tp, NULL, - NULL, - NULL, - TCP_LOG_CONNEND, 0, - 0, &log, false, &tv); + (void)tcp_log_event(tp, NULL, + NULL, + NULL, + TCP_LOG_CONNEND, 0, + 0, &log, false, NULL, NULL, 0, &tv); } -#endif /* * If we were gathering packets to be automatically dumped, try to do * it now. If this succeeds, the log information in the TCPCB will be @@ -2910,7 +2910,7 @@ tcp_log_sendfile(struct socket *so, off_t offset, size_t nbytes, int flags) continue; } /* If we reach here its a allocated closed end request */ - if ((ent->start == offset) || + if ((ent->start == offset) || ((offset > ent->start) && (offset < ent->end))){ /* Its within this request?? */ fnd = 1; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index d88fc48fc021..db0c71fdbfff 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2423,13 +2423,13 @@ tcp_discardcb(struct tcpcb *tp) CC_ALGO(tp) = NULL; -#ifdef TCP_BLACKBOX - tcp_log_tcpcbfini(tp); -#endif TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); +#ifdef TCP_BLACKBOX + tcp_log_tcpcbfini(tp); +#endif MPASS(STAILQ_EMPTY(&tp->t_inqueue)); /*