]> 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:49:25 +0000 (06:49 +0000)
committerguy <guy>
Fri, 2 Apr 2004 06:49:25 +0000 (06:49 +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 22f9052a2b4d97e31041f1cd76baf9b24da1d8b2..1e36920c95562ace96de6d73228c3ea14f598c97 100644 (file)
@@ -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),