Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jul 2010 18:27:52 -0400
From:      Jim <stapleton.41@gmail.com>
To:        Anonymous <swell.k@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sockets stuck in use
Message-ID:  <AANLkTim2OhPH5eMOmSnbrRzgOmcHFfcBb5q3F4LP27aJ@mail.gmail.com>
In-Reply-To: <86r5izft8b.fsf@gmail.com>
References:  <AANLkTinsL3oGBdO7dqv0Iwamlpp89lzwUcJFgspPLhFq@mail.gmail.com> <86r5izft8b.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 19, 2010 at 10:20 AM, Anonymous <swell.k@gmail.com> wrote:
> Jim <stapleton.41@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim2OhPH5eMOmSnbrRzgOmcHFfcBb5q3F4LP27aJ>