Date: Mon, 16 Jun 2003 06:50:39 -0700 From: "Jacob S. Barrett" <jbarrett@amduat.net> To: freebsd-ipfw@freebsd.org Subject: ipfw2 timestamp patch Message-ID: <3EEDCB2F.6080107@amduat.net>
next in thread | raw e-mail | index | archive | help
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."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EEDCB2F.6080107>