diff options
author | glebius <glebius@FreeBSD.org> | 2012-09-29 16:42:01 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-09-29 16:42:01 +0000 |
commit | a7f869fbc12c7a8560ce1231243042ee05c6b86a (patch) | |
tree | eeb66890ad93d25ea8c93f8314a25f5da60e42da /sbin/pfctl | |
parent | 37727490753b20f0100711ff71807b884abb5a6c (diff) | |
download | FreeBSD-src-a7f869fbc12c7a8560ce1231243042ee05c6b86a.zip FreeBSD-src-a7f869fbc12c7a8560ce1231243042ee05c6b86a.tar.gz |
- Get rid of #ifdef __FreeBSD__.
- Use correct format when printing uint64_t.
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/pf_print_state.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index d6637b4..d4a2c1d 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -35,10 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/socket.h> -#ifdef __FreeBSD__ #include <sys/endian.h> -#define betoh64 be64toh -#endif #include <net/if.h> #define TCPSTATES #include <netinet/tcp_fsm.h> @@ -46,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <arpa/inet.h> #include <netdb.h> +#include <stdint.h> #include <stdio.h> #include <string.h> @@ -318,18 +316,11 @@ print_state(struct pfsync_state *s, int opts) bcopy(s->packets[1], &packets[1], sizeof(u_int64_t)); bcopy(s->bytes[0], &bytes[0], sizeof(u_int64_t)); bcopy(s->bytes[1], &bytes[1], sizeof(u_int64_t)); - printf(", %llu:%llu pkts, %llu:%llu bytes", -#ifdef __FreeBSD__ - (unsigned long long)betoh64(packets[0]), - (unsigned long long)betoh64(packets[1]), - (unsigned long long)betoh64(bytes[0]), - (unsigned long long)betoh64(bytes[1])); -#else - betoh64(packets[0]), - betoh64(packets[1]), - betoh64(bytes[0]), - betoh64(bytes[1])); -#endif + printf(", %ju:%ju pkts, %ju:%ju bytes", + (uintmax_t )be64toh(packets[0]), + (uintmax_t )be64toh(packets[1]), + (uintmax_t )be64toh(bytes[0]), + (uintmax_t )be64toh(bytes[1])); if (ntohl(s->anchor) != -1) printf(", anchor %u", ntohl(s->anchor)); if (ntohl(s->rule) != -1) @@ -346,12 +337,8 @@ print_state(struct pfsync_state *s, int opts) u_int64_t id; bcopy(&s->id, &id, sizeof(u_int64_t)); - printf(" id: %016llx creatorid: %08x", -#ifdef __FreeBSD__ - (unsigned long long)betoh64(id), ntohl(s->creatorid)); -#else - betoh64(id), ntohl(s->creatorid)); -#endif + printf(" id: %016jx creatorid: %08x", + (uintmax_t )be64toh(id), ntohl(s->creatorid)); printf("\n"); } } |