]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Save the host-byte-order values for the rule number and sub rule number
authorguy <guy>
Fri, 2 Apr 2004 06:48:10 +0000 (06:48 +0000)
committerguy <guy>
Fri, 2 Apr 2004 06:48:10 +0000 (06:48 +0000)
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.

print-pflog.c

index 869716dc99e8c2be2dc52b7b9a248bf39f608a44..463cd18bbd011f13de1cbed7903ff3370b4f2011 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.11 2004-03-29 21:58:53 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.12 2004-04-02 06:48:10 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),