From owner-cvs-all@FreeBSD.ORG Fri May 18 19:58:38 2007 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2015616A401; Fri, 18 May 2007 19:58:38 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 0D01E13C43E; Fri, 18 May 2007 19:58:38 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l4IJwbQ7044946; Fri, 18 May 2007 19:58:37 GMT (envelope-from andre@repoman.freebsd.org) Received: (from andre@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l4IJwbOb044945; Fri, 18 May 2007 19:58:37 GMT (envelope-from andre) Message-Id: <200705181958.l4IJwbOb044945@repoman.freebsd.org> From: Andre Oppermann Date: Fri, 18 May 2007 19:58:37 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/netinet tcp.h tcp_input.c tcp_subr.c tcp_var.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2007 19:58:38 -0000 andre 2007-05-18 19:58:37 UTC FreeBSD src repository Modified files: sys/netinet tcp.h tcp_input.c tcp_subr.c tcp_var.h Log: Add tcp_log_addrs() function to generate and standardized TCP log line for use thoughout the tcp subsystem. It is IPv4 and IPv6 aware creates a line in the following format: "TCP: [1.2.3.4]:50332 to [1.2.3.4]:80 tcpflags " A "\n" is not included at the end. The caller is supposed to add further information after the standard tcp log header. The function returns a NUL terminated string which the caller has to free(s, M_TCPLOG) after use. All memory allocation is done with M_NOWAIT and the return value may be NULL in memory shortage situations. Either struct in_conninfo || (struct tcphdr && (struct ip || struct ip6_hdr) have to be supplied. Due to ip[6].h header inclusion limitations and ordering issues the struct ip and struct ip6_hdr parameters have to be casted and passed as void * pointers. tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr, void *ip6hdr) Usage example: struct ip *ip; char *tcplog; if (tcplog = tcp_log_addrs(NULL, th, (void *)ip, NULL)) { log(LOG_DEBUG, "%s; %s: Connection attempt to closed port\n", tcplog, __func__); free(s, M_TCPLOG); } Revision Changes Path 1.38 +1 -0 src/sys/netinet/tcp.h 1.352 +8 -22 src/sys/netinet/tcp_input.c 1.284 +89 -0 src/sys/netinet/tcp_subr.c 1.151 +3 -0 src/sys/netinet/tcp_var.h