Add a '-T' flag to print the timestamp as numeric value instead
of converting it with ctime(). This is a lot more convenient for postprocessing. Submitted by: "Jacob S. Barrett" <jbarrett@amduat.net>
This commit is contained in:
parent
2ff553eb9e
commit
1b43a426de
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117472
@ -13,7 +13,7 @@
|
|||||||
.Cm add
|
.Cm add
|
||||||
.Ar rule
|
.Ar rule
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl acdeftnNS
|
.Op Fl acdefnNStT
|
||||||
.Brq Cm list | show
|
.Brq Cm list | show
|
||||||
.Op Ar rule | first-last ...
|
.Op Ar rule | first-last ...
|
||||||
.Nm
|
.Nm
|
||||||
@ -54,7 +54,7 @@
|
|||||||
.Op Ar number ...
|
.Op Ar number ...
|
||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl cNnqS
|
.Op Fl cnNqS
|
||||||
.Oo
|
.Oo
|
||||||
.Fl p Ar preproc
|
.Fl p Ar preproc
|
||||||
.Oo
|
.Oo
|
||||||
@ -261,7 +261,10 @@ listed.
|
|||||||
While listing pipes, sort according to one of the four
|
While listing pipes, sort according to one of the four
|
||||||
counters (total or current packets or bytes).
|
counters (total or current packets or bytes).
|
||||||
.It Fl t
|
.It Fl t
|
||||||
While listing, show last match timestamp.
|
While listing, show last match timestamp (converted with ctime()).
|
||||||
|
.It Fl T
|
||||||
|
While listing, show last match timestamp (as seconds from the epoch).
|
||||||
|
This form can be more convenient for postprocessing by scripts.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
To ease configuration, rules can be put into a file which is
|
To ease configuration, rules can be put into a file which is
|
||||||
|
@ -902,7 +902,9 @@ show_ipfw(struct ip_fw *rule, int pcwidth, int bcwidth)
|
|||||||
printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt),
|
printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt),
|
||||||
bcwidth, align_uint64(&rule->bcnt));
|
bcwidth, align_uint64(&rule->bcnt));
|
||||||
|
|
||||||
if (do_time) {
|
if (do_time == 2)
|
||||||
|
printf("%10u ", rule->timestamp);
|
||||||
|
else if (do_time == 1) {
|
||||||
char timestr[30];
|
char timestr[30];
|
||||||
time_t t = (time_t)0;
|
time_t t = (time_t)0;
|
||||||
|
|
||||||
@ -3667,7 +3669,7 @@ ipfw_main(int oldac, char **oldav)
|
|||||||
save_av = av;
|
save_av = av;
|
||||||
|
|
||||||
optind = optreset = 0;
|
optind = optreset = 0;
|
||||||
while ((ch = getopt(ac, av, "acdefhnNqs:Stv")) != -1)
|
while ((ch = getopt(ac, av, "acdefhnNqs:STtv")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
do_acct = 1;
|
do_acct = 1;
|
||||||
@ -3717,6 +3719,10 @@ ipfw_main(int oldac, char **oldav)
|
|||||||
do_time = 1;
|
do_time = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
do_time = 2; /* numeric timestamp */
|
||||||
|
break;
|
||||||
|
|
||||||
case 'v': /* verbose */
|
case 'v': /* verbose */
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user