Fix ipmon problems on 64-bit platforms (PR#17403 and PR#17404).

This commit is contained in:
martti 2002-09-25 06:43:17 +00:00
parent 5031fe3837
commit 15e6ca78da
3 changed files with 23 additions and 17 deletions

20
dist/ipf/ipmon.c vendored
View File

@ -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);

View File

@ -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];

View File

@ -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
/*