summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartti <martti@NetBSD.org>2002-09-25 06:43:17 +0000
committermartti <martti@NetBSD.org>2002-09-25 06:43:17 +0000
commit15e6ca78da77a575b59a78489bbae4c19ba32b3b (patch)
tree9ebebaee5b1c7a83c76bea993194ce1f9418a17a
parent5031fe3837a9ec72d0e8a7aba2e345be38a8d083 (diff)
Fix ipmon problems on 64-bit platforms (PR#17403 and PR#17404).
-rw-r--r--dist/ipf/ipmon.c20
-rw-r--r--sys/netinet/ip_fil.h6
-rw-r--r--sys/netinet/ip_log.c14
3 files changed, 23 insertions, 17 deletions
diff --git a/dist/ipf/ipmon.c b/dist/ipf/ipmon.c
index f47fc84f107..d3c1700bf29 100644
--- a/dist/ipf/ipmon.c
+++ b/dist/ipf/ipmon.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ipmon.c,v 1.16 2002/09/19 09:03:09 martti Exp $ */
+/* $NetBSD: ipmon.c,v 1.17 2002/09/25 06:43:17 martti Exp $ */
/*
* Copyright (C) 1993-2002 by Darren Reed.
@@ -670,10 +670,12 @@ int blen;
struct tm *tm;
int res, i, len;
char *proto;
+ time_t ipl_time;
nl = (struct natlog *)((char *)ipl + IPLOG_SIZE);
res = (opts & OPT_RESOLVE) ? 1 : 0;
- tm = localtime((time_t *)&ipl->ipl_sec);
+ ipl_time = (time_t) ipl->ipl_time.tv_sec;
+ tm = localtime(&ipl_time);
len = sizeof(line);
if (!(opts & OPT_SYSLOG)) {
(void) strftime(t, len, "%d/%m/%Y ", tm);
@@ -683,7 +685,7 @@ int blen;
}
(void) strftime(t, len, "%T", tm);
t += strlen(t);
- (void) sprintf(t, ".%-.6ld @%hd ", ipl->ipl_usec, nl->nl_rule + 1);
+ (void) sprintf(t, ".%-.6ld @%hd ", ipl->ipl_time.tv_usec, nl->nl_rule + 1);
t += strlen(t);
if (nl->nl_type == NL_NEWMAP)
@@ -744,10 +746,12 @@ int blen;
char *t = line, *proto;
struct tm *tm;
int res, i, len;
+ time_t ipl_time;
sl = (struct ipslog *)((char *)ipl + IPLOG_SIZE);
res = (opts & OPT_RESOLVE) ? 1 : 0;
- tm = localtime((time_t *)&ipl->ipl_sec);
+ ipl_time = (time_t) ipl->ipl_time.tv_sec;
+ tm = localtime(&ipl_time);
len = sizeof(line);
if (!(opts & OPT_SYSLOG)) {
(void) strftime(t, len, "%d/%m/%Y ", tm);
@@ -757,7 +761,7 @@ int blen;
}
(void) strftime(t, len, "%T", tm);
t += strlen(t);
- (void) sprintf(t, ".%-.6ld ", ipl->ipl_usec);
+ (void) sprintf(t, ".%-.6ld ", ipl->ipl_time.tv_usec);
t += strlen(t);
if (sl->isl_type == ISL_NEW)
@@ -893,6 +897,7 @@ int blen;
#ifdef USE_INET6
ip6_t *ip6;
#endif
+ time_t ipl_time;
ipl = (iplog_t *)buf;
ipf = (ipflog_t *)((char *)buf + IPLOG_SIZE);
@@ -901,7 +906,8 @@ int blen;
res = (opts & OPT_RESOLVE) ? 1 : 0;
t = line;
*t = '\0';
- tm = localtime((time_t *)&ipl->ipl_sec);
+ ipl_time = (time_t) ipl->ipl_time.tv_sec;
+ tm = localtime(&ipl_time);
#ifdef linux
if (v == 4)
ip->ip_len = ntohs(ip->ip_len);
@@ -916,7 +922,7 @@ int blen;
}
(void) strftime(t, len, "%T", tm);
t += strlen(t);
- (void) sprintf(t, ".%-.6ld ", ipl->ipl_usec);
+ (void) sprintf(t, ".%-.6ld ", ipl->ipl_time.tv_usec);
t += strlen(t);
if (ipl->ipl_count > 1) {
(void) sprintf(t, "%dx ", ipl->ipl_count);
diff --git a/sys/netinet/ip_fil.h b/sys/netinet/ip_fil.h
index c7ffa6b1ebe..c5e15ca630c 100644
--- a/sys/netinet/ip_fil.h
+++ b/sys/netinet/ip_fil.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_fil.h,v 1.47 2002/09/19 08:12:48 martti Exp $ */
+/* $NetBSD: ip_fil.h,v 1.48 2002/09/25 06:43:20 martti Exp $ */
/*
* Copyright (C) 1993-2002 by Darren Reed.
@@ -416,7 +416,7 @@ typedef struct frgroup {
typedef struct iplog {
u_32_t ipl_magic;
u_int ipl_count;
- u_long ipl_sec;
+ struct timeval ipl_time;
u_long ipl_usec;
size_t ipl_dsize;
struct iplog *ipl_next;
@@ -644,7 +644,7 @@ extern int fr_minttllog;
extern fr_info_t frcache[2];
extern char ipfilter_version[];
extern iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];
-extern size_t iplused[IPL_LOGMAX + 1];
+extern int iplused[IPL_LOGMAX + 1];
extern struct frentry *ipfilter[2][2], *ipacct[2][2];
#ifdef USE_INET6
extern struct frentry *ipfilter6[2][2], *ipacct6[2][2];
diff --git a/sys/netinet/ip_log.c b/sys/netinet/ip_log.c
index 7b2cf6b4c31..945f239492f 100644
--- a/sys/netinet/ip_log.c
+++ b/sys/netinet/ip_log.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_log.c,v 1.22 2002/09/19 08:12:51 martti Exp $ */
+/* $NetBSD: ip_log.c,v 1.23 2002/09/25 06:43:21 martti Exp $ */
/*
* Copyright (C) 1997-2001 by Darren Reed.
@@ -9,7 +9,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_log.c,v 1.22 2002/09/19 08:12:51 martti Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_log.c,v 1.23 2002/09/25 06:43:21 martti Exp $");
#include <sys/param.h>
#if defined(KERNEL) && !defined(_KERNEL)
@@ -133,7 +133,7 @@ extern kcondvar_t iplwait;
# endif
iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1], *ipll[IPL_LOGMAX+1];
-size_t iplused[IPL_LOGMAX+1];
+int iplused[IPL_LOGMAX+1];
static fr_info_t iplcrc[IPL_LOGMAX+1];
@@ -340,15 +340,15 @@ int *types, cnt;
ipl->ipl_dsize = len;
# ifdef _KERNEL
# if SOLARIS || defined(sun)
- uniqtime((struct timeval *)&ipl->ipl_sec);
+ uniqtime(&ipl->ipl_time);
# else
# if BSD >= 199306 || defined(__FreeBSD__) || defined(__sgi)
- microtime((struct timeval *)&ipl->ipl_sec);
+ microtime(&ipl->ipl_time);
# endif
# endif
# else
- ipl->ipl_sec = 0;
- ipl->ipl_usec = 0;
+ ipl->ipl_time.tv_sec = 0;
+ ipl->ipl_time.tv_usec = 0;
# endif
/*