From owner-freebsd-net@FreeBSD.ORG Mon Dec 29 23:51:48 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EFFE59E3 for ; Mon, 29 Dec 2014 23:51:47 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A1F372E5C for ; Mon, 29 Dec 2014 23:51:47 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5BBC225D3891; Mon, 29 Dec 2014 23:51:44 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 4CDA8C7709D; Mon, 29 Dec 2014 23:51:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 1RQm9EGcCQgb; Mon, 29 Dec 2014 23:51:41 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:8080:1cb9:8dcd:f166] (unknown [IPv6:fde9:577b:c1a9:4410:8080:1cb9:8dcd:f166]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6AE7DC7706F; Mon, 29 Dec 2014 23:51:40 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: setfib and RSTs From: "Bjoern A. Zeeb" In-Reply-To: Date: Mon, 29 Dec 2014 23:51:08 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <81C17F4A-B0AA-48C9-ABFB-6B14B7223643@lists.zabbadoz.net> References: <54A0FDD9.4090009@freebsd.org> To: Nikolay Denev X-Mailer: Apple Mail (2.1993) Cc: "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2014 23:51:48 -0000 > On 29 Dec 2014, at 21:03 , Nikolay Denev wrote: >=20 > No, no PR yet, but I will file one. I wanted to collect some more data > first. >=20 > So, I've did some dtrace digging : >=20 > [20:54][root@nas:~]#cat reset.d > #!/usr/sbin/dtrace -s >=20 > fbt:kernel:tcp_dropwithreset:entry > { > printf("reason %d fib %d src_port %d dst_port %d", args[4], args[2] = ? > args[2]->t_inpcb->inp_inc.inc_fibnum : -1, ntohs(args[1]->th_sport), > ntohs(args[1]->th_dport)); > /* stack(); */ > } > =E2=80=A6 > The port numbers here match RST packets that I'm seeing with tcpdump = in > another window. > reason 3 is BANDLIM_RST_CLOSEDPORT (from icmp_var.h) > Looking at tcp_input.c I see that there are cases where the INPCB does = not > exists, and from what I see this is how the FIB gets determined. > Also here I see that tcp_dropwithreset() is called with tcpcb set to = NULL, > so probably this is why the FIB is not found. >=20 > Why this is happening, I have no idea yet. Could you also check for the mbuf *m and the fibnum from the pkthdr = there? It might be even more interesting to see this for tcp_respond and the = following ip_output as well, in case you want to keep state in the d = script; otherwise just tcp_dropwithreset and/or tcp_respond should be = fine. Usually I would expect for the tcp_dropwithreset case that inp will be = NULL in tcp_respond, the mbuf *m and th will be valid and thus the FIB = number from the incoming mbuf would be re-used as the mbuf will be = re-used, but for that the mbuf needs to be properly tagged on receive. /bz =E2=80=94=20 Bjoern A. Zeeb Charles Haddon Spurgeon: "Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend."