From: guy Date: Fri, 2 Apr 2004 06:49:25 +0000 (+0000) Subject: Save the host-byte-order values for the rule number and sub rule number X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/481f1b16b7de7d8b3ffee7230d25532e2c4a17ab Save the host-byte-order values for the rule number and sub rule number in variables; this means we put them in host byte order only once, and also gets rid of some "int format, long int argument" warnings. --- diff --git a/print-pflog.c b/print-pflog.c index 22f9052a..1e36920c 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.7.2.4 2004-03-29 21:56:26 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.7.2.5 2004-04-02 06:49:25 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -75,11 +75,14 @@ static struct tok pf_directions[] = { static void pflog_print(const struct pfloghdr *hdr) { - if (ntohl(hdr->subrulenr) == (u_int32_t)-1) - printf("rule %u/", ntohl(hdr->rulenr)); + u_int32_t rulenr, subrulenr; + + rulenr = ntohl(hdr->rulenr); + subrulenr = ntohl(hdr->subrulenr); + if (subrulenr == (u_int32_t)-1) + printf("rule %u/", rulenr); else - printf("rule %u.%s.%u/", ntohl(hdr->rulenr), hdr->ruleset, - ntohl(hdr->subrulenr)); + printf("rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr); printf("%s: %s %s on %s: ", tok2str(pf_reasons, "unkn(%u)", hdr->reason),