From owner-freebsd-net@FreeBSD.ORG Tue Jan 29 23:17:06 2013 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 18794B73; Tue, 29 Jan 2013 23:17:06 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by mx1.freebsd.org (Postfix) with ESMTP id 34FD4E8E; Tue, 29 Jan 2013 23:17:04 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id hj13so986052wib.13 for ; Tue, 29 Jan 2013 15:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FBa61QuaNXq1cxWD+G3Uw7dDhqqcPLXBP7xMDSYFHqM=; b=UYXnAFgQAemm9BsubGOUYk82ZZnanzZEVjilNhJHtvdf35EvkTU3krPRx/nbi4mn+a AIS688o6/nfsHdNGIduMTPNSoA0hqHlmxtpVbTGiO+OClkaNfCTeD4iL8PDHhekW6h7W TaonMDCJ2xmMy+h0d3OO4El/f1E++nWG9s12sR1quBNkF3lQBP+5+HavwA2R8lA4aWMf IBoglxc3rWhAiEcx3c0DYfMLUdLjmTHewfy/N7RxN42wbCuVueahmJmP6HESm0riRU37 77PeA/c6WRi5744r0LAIyk4lR7ttHATpfUucuXU/7BU7c+U9OvQwl7IyoLHxwjuS/Wyk Nuig== MIME-Version: 1.0 X-Received: by 10.180.24.9 with SMTP id q9mr5366290wif.14.1359501423709; Tue, 29 Jan 2013 15:17:03 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.194.47.236 with HTTP; Tue, 29 Jan 2013 15:17:03 -0800 (PST) In-Reply-To: <5108572D.1090905@freebsd.org> References: <201301291205.41301.jhb@freebsd.org> <5108572D.1090905@freebsd.org> Date: Tue, 29 Jan 2013 15:17:03 -0800 X-Google-Sender-Auth: 9ksglsMJoDJdyT24D98g1WD-778 Message-ID: Subject: Re: [PATCH] Allow tcpdrop to use non-space separators From: Luigi Rizzo To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: John Baldwin , "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 23:17:06 -0000 On Tue, Jan 29, 2013 at 3:11 PM, Andre Oppermann 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 > >>