From owner-freebsd-questions@FreeBSD.ORG Mon Jul 19 22:27:56 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 459441065690 for ; Mon, 19 Jul 2010 22:27:56 +0000 (UTC) (envelope-from stapleton.41@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id D3C598FC1C for ; Mon, 19 Jul 2010 22:27:55 +0000 (UTC) Received: by wwb13 with SMTP id 13so733960wwb.31 for ; Mon, 19 Jul 2010 15:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=su8UY5ZlafSrZWxcjgKv8RX1sSsizM1O7DbWeZwwKRc=; b=KafXGG608n9jLdgynYzqo2zLvI9OhIaMvvIDH/UGeNXFWfi/IRBUqrkmj+NHE9DtI2 EE7LZ3tcHCLQN50XHqb3+KfxME6HEZcEerfze3w0HzpQP1rrhmzDLj04ihklYAu1rCXC oyGugYAq4nzQBZkvfEXGRJyQE1YPCOiKw8hL8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=V3sZCtl6bGcWJ/8RdxWAhpK4sa8e3dRq5BT1a4NBriRsKMzkMAXyXEH90fsyfepMrf SG8lUfL9OkK15OQFRXls/lHFvWoZC9AnPNhZGziJlzp66B8c8bmKcRMER+7YwSX4Epyr hNR1MORH+X2pQcBJwHIg/s815TEmTnmbyXw+Y= MIME-Version: 1.0 Received: by 10.216.210.206 with SMTP id u56mr4573320weo.50.1279578472462; Mon, 19 Jul 2010 15:27:52 -0700 (PDT) Received: by 10.216.172.4 with HTTP; Mon, 19 Jul 2010 15:27:52 -0700 (PDT) In-Reply-To: <86r5izft8b.fsf@gmail.com> References: <86r5izft8b.fsf@gmail.com> Date: Mon, 19 Jul 2010 18:27:52 -0400 Message-ID: From: Jim To: Anonymous Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org Subject: Re: sockets stuck in use X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2010 22:27:56 -0000 On Mon, Jul 19, 2010 at 10:20 AM, Anonymous wrote: > Jim writes: > >> I was working on an application I've been developing, and I closed the >> last instance a bit over 12 hours ago, but some of the sockets are >> still stuck in use: >> [sjss@elrond ~/dev/pipe/scripts]$ netstat | grep -e 'tcp' | grep 9612 >> tcp4 =A0 =A0 =A0 0 =A0 =A0 =A00 192.168.1.80.42464 =A0 =A0 192.168.1.2.9= 612 =A0 =A0 =A0 SYN_SENT >> tcp4 =A0 =A0 =A0 0 =A0 =A0 =A00 192.168.1.80.35742 =A0 =A0 192.168.1.2.9= 612 =A0 =A0 =A0 CLOSED >> tcp4 =A0 =A0 =A0 0 =A0 =A0 =A00 192.168.1.80.46116 =A0 =A0 192.168.1.2.9= 612 =A0 =A0 =A0 CLOSED >> tcp4 =A0 =A0 =A0 0 =A0 =A0 =A00 192.168.1.80.36792 =A0 =A0 192.168.1.2.9= 612 =A0 =A0 =A0 CLOSED >> >> >> Is there any way to get rid of them without restarting the machine? I >> was playing with sockopt SO_KEEPALIVE and SO_LINGER when I caused this >> issue.. > > Does tcpdrop(8) help? > No, the result (The first command is what I figured would be correct, given the man page, the second was just to be paranoid - although this machine is both the host and destination, having glommed onto several ports. The .80 IPs are within the web server's jail. I cannot tcpdrop within the jail [sjss@elrond ~/dev/pipe/scripts]$ netstat | grep -e 'tcp' | grep 9612 tcp4 0 0 192.168.1.80.42464 192.168.1.2.9612 SYN_SENT tcp4 0 0 192.168.1.80.35742 192.168.1.2.9612 CLOSED tcp4 0 0 192.168.1.80.46116 192.168.1.2.9612 CLOSED tcp4 0 0 192.168.1.80.36792 192.168.1.2.9612 CLOSED [sjss@elrond ~/dev/pipe/scripts]$ sudo tcpdrop 192.168.1.80 46116 192.168.1.2 9612 tcpdrop: 192.168.1.80 46116 192.168.1.2 9612: No such process [sjss@elrond ~/dev/pipe/scripts]$ sudo tcpdrop 192.168.1.2 9612 192.168.1.80 46116 tcpdrop: 192.168.1.2 9612 192.168.1.80 46116: No such process [sjss@elrond ~/dev/pipe/scripts]$ netstat | grep -e 'tcp' | grep 9612 tcp4 0 0 192.168.1.80.42464 192.168.1.2.9612 SYN_SENT tcp4 0 0 192.168.1.80.35742 192.168.1.2.9612 CLOSED tcp4 0 0 192.168.1.80.46116 192.168.1.2.9612 CLOSED tcp4 0 0 192.168.1.80.36792 192.168.1.2.9612 CLOSED [sjss@elrond ~/dev/pipe/scripts]$ cd /data/jail/ [sjss@elrond /data/jail]$ sudo ./bilbo_web_shell [root@bilbo_web /data/jail]# tcpdrop 192.168.1.80 46116 192.168.1.2 9612 tcpdrop: 192.168.1.80 46116 192.168.1.2 9612: Operation not permitted Thanks, -Jim Stapleton