From owner-freebsd-ipfw@FreeBSD.ORG Mon Jun 16 06:55:25 2003 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B67E637B401 for ; Mon, 16 Jun 2003 06:55:25 -0700 (PDT) Received: from bes.amduat.net (bes.amduat.net [206.124.149.190]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07CB243FDF for ; Mon, 16 Jun 2003 06:55:25 -0700 (PDT) (envelope-from jbarrett@amduat.net) Received: from amduat.net (osiris.amduat.net [10.0.0.69]) (IDENT: trilluser, AUTH: LOGIN jbarrett) by bes.amduat.net with esmtp; Mon, 16 Jun 2003 06:55:24 -0700 Message-ID: <3EEDCB2F.6080107@amduat.net> Date: Mon, 16 Jun 2003 06:50:39 -0700 From: "Jacob S. Barrett" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-ipfw@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: ipfw2 timestamp patch X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2003 13:55:26 -0000 I have a need for the raw timestamp and have written a patch against ipfw2.c to have it return it. It adds an option 'T' which will display the time stamp value without converting it via ctime. I use this for scripting ipfw output where I need the timestamp. It was just becoming a hassle to covert the string back into a usable value. So I just modified ipfw2.c (I suppose the same can be done with ipfw.c) to not convert it. Anyway, I was hoping maybe this patch could find it's way into the ipfw sources so I don't have to patch it all the time. I think it is pretty useful. This patch was taken against RELENG_4_8. --- ipfw2.c.orig Mon Jun 16 06:21:26 2003 +++ ipfw2.c Mon Jun 16 06:25:14 2003 @@ -58,6 +58,7 @@ do_resolv, /* Would try to resolve all */ do_acct, /* Show packet/byte count */ do_time, /* Show time stamps */ + do_timestamp, /* Show time stamps in seconds*/ do_quiet, /* Be quiet in add and flush */ do_force, /* Don't ask for confirmation */ do_pipe, /* this cmd refers to a pipe */ @@ -824,6 +825,9 @@ if (do_acct) printf("%10qu %10qu ", rule->pcnt, rule->bcnt); + if (do_timestamp) + printf("%10lu ", rule->timestamp); + if (do_time) { char timestr[30]; @@ -3344,7 +3348,7 @@ do_force = !isatty(STDIN_FILENO); optind = optreset = 1; - while ((ch = getopt(ac, av, "hs:acdefNqStv")) != -1) + while ((ch = getopt(ac, av, "hs:acdefNqStTv")) != -1) switch (ch) { case 'h': /* help */ help(); @@ -3379,6 +3383,9 @@ break; case 't': do_time = 1; + break; + case 'T': + do_timestamp = 1; break; case 'v': /* verbose */ verbose++; -- Jacob S. Barrett jbarrett@amduat.net www.amduat.net "I don't suffer from insanity, I enjoy every minute of it."