summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1998-01-08 03:03:54 +0000
committeralex <alex@FreeBSD.org>1998-01-08 03:03:54 +0000
commit35f59936c3cbf51c3f961b2cf754a13f5d40359e (patch)
tree4599342babe5d77e88f8834779900be03c908afb /sys/netinet
parent4ff390e7194d0fdda36569ce05d58c4d3aa8fe01 (diff)
downloadFreeBSD-src-35f59936c3cbf51c3f961b2cf754a13f5d40359e.zip
FreeBSD-src-35f59936c3cbf51c3f961b2cf754a13f5d40359e.tar.gz
Bump up packet and byte counters to 64-bit unsigned ints. As a
consequence, ipfw's list command now adjusts its output at runtime based on the largest packet/byte counter values. NOTE: o The ipfw struct has changed requiring a recompile of both kernel and userland ipfw utility. o This probably should not be brought into 2.2. PR: 3738
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_fw.c12
-rw-r--r--sys/netinet/ip_fw.h13
2 files changed, 14 insertions, 11 deletions
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index 5980928..c5174ab 100644
--- a/sys/netinet/ip_fw.c
+++ b/sys/netinet/ip_fw.c
@@ -12,7 +12,7 @@
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
- * $Id: ip_fw.c,v 1.70 1998/01/05 00:14:05 alex Exp $
+ * $Id: ip_fw.c,v 1.71 1998/01/05 00:57:15 alex Exp $
*/
/*
@@ -154,8 +154,8 @@ icmptype_match(struct icmp *icmp, struct ip_fw *f)
type = icmp->icmp_type;
/* check for matching type in the bitmap */
- if (type < IP_FW_ICMPTYPES_DIM * sizeof(unsigned) * 8 &&
- (f->fw_icmptypes[type / (sizeof(unsigned) * 8)] &
+ if (type < IP_FW_ICMPTYPES_MAX &&
+ (f->fw_uar.fw_icmptypes[type / (sizeof(unsigned) * 8)] &
(1U << (type % (8 * sizeof(unsigned))))))
return(1);
@@ -255,7 +255,7 @@ static void
ipfw_report(struct ip_fw *f, struct ip *ip,
struct ifnet *rif, struct ifnet *oif)
{
- static int counter;
+ static u_int64_t counter;
struct tcphdr *const tcp = (struct tcphdr *) ((u_long *) ip+ ip->ip_hl);
struct udphdr *const udp = (struct udphdr *) ((u_long *) ip+ ip->ip_hl);
struct icmp *const icmp = (struct icmp *) ((u_long *) ip + ip->ip_hl);
@@ -469,11 +469,11 @@ ip_fw_chk(struct ip **pip, int hlen,
src_port = ntohs(udp->uh_sport);
dst_port = ntohs(udp->uh_dport);
check_ports:
- if (!port_match(&f->fw_pts[0],
+ if (!port_match(&f->fw_uar.fw_pts[0],
IP_FW_GETNSRCP(f), src_port,
f->fw_flg & IP_FW_F_SRNG))
continue;
- if (!port_match(&f->fw_pts[IP_FW_GETNSRCP(f)],
+ if (!port_match(&f->fw_uar.fw_pts[IP_FW_GETNSRCP(f)],
IP_FW_GETNDSTP(f), dst_port,
f->fw_flg & IP_FW_F_DRNG))
continue;
diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h
index 20e6f3d..6f7deb2 100644
--- a/sys/netinet/ip_fw.h
+++ b/sys/netinet/ip_fw.h
@@ -11,7 +11,7 @@
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
- * $Id: ip_fw.h,v 1.29 1997/09/16 11:43:57 bde Exp $
+ * $Id: ip_fw.h,v 1.30 1997/10/28 15:58:45 bde Exp $
*/
#ifndef _IP_FW_H
@@ -49,17 +49,20 @@ union ip_fw_if {
*/
struct ip_fw {
- u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */
+ u_int64_t fw_pcnt,fw_bcnt; /* Packet and byte counters */
struct in_addr fw_src, fw_dst; /* Source and destination IP addr */
struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */
u_short fw_number; /* Rule number */
u_short fw_flg; /* Flags word */
#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */
- u_short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */
+ union {
+ u_short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */
+#define IP_FW_ICMPTYPES_MAX 128
+#define IP_FW_ICMPTYPES_DIM (IP_FW_ICMPTYPES_MAX / (sizeof(unsigned) * 8))
+ unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */
+ } fw_uar;
u_char fw_ipopt,fw_ipnopt; /* IP options set/unset */
u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */
-#define IP_FW_ICMPTYPES_DIM (32 / (sizeof(unsigned) * 8))
- unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */
long timestamp; /* timestamp (tv_sec) of last match */
union ip_fw_if fw_in_if, fw_out_if; /* Incoming and outgoing interfaces */
union {
OpenPOWER on IntegriCloud