[PATCH] Allow tcpdrop to use non-space separators

Luigi Rizzo rizzo at iet.unipi.it
Tue Jan 29 23:17:06 UTC 2013


On Tue, Jan 29, 2013 at 3:11 PM, Andre Oppermann <andre at freebsd.org> wrote:

> On 29.01.2013 18:05, John Baldwin wrote:
>
>> A common use case I have at work is to find a busted connection using
>> netstat
>> -n or sockstat and then want to tcpdrop it.  However, tcpdrop requires
>> spaces
>> between the address and port so I can't simply cut and paste from one
>> terminal
>> window into another to generate the tcpdrop command.  This patch adds
>> support
>> for having a decimal (netstat output) or colon (sockstat output) between
>> the
>> address and port instead of a space.  It is careful to look for the last
>> of
>> these tokens to avoid parsing part of the address as the port.
>>
>
> Excellent.  Can netstat be changed from decimal to colon output as well?
> The decimal output is completely outdated and probably from a time when
> not even dinosaurs were [created|evolved] yet.  Colon output for port
> numbers is *the* standard all around.


i was going to say i'd really love to have the parsing code in some kind of
library function. I find myself writing this code again and again (and
presumably
i am not the only one) each time with new bugs and features...

i know that non-standard library functions are a pain when porting software
(see humanize_* stuff) but better than duplication.

cheers
luigi

>
>>


More information about the freebsd-net mailing list