diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1997-07-14 08:48:48 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1997-07-14 08:48:48 +0000 |
commit | c3a2298d51e059cd301992f6b91d3f3997af4f97 (patch) | |
tree | adb96418b6e9ecbf80d1e69c6ab9cbb935d25e67 | |
parent | af2f31378b24787947acccc4300ac8f758a21a6a (diff) |
global byte counters.
-rw-r--r-- | sys/netinet/ip_ah.h | 4 | ||||
-rw-r--r-- | sys/netinet/ip_ah_new.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_ah_old.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_esp.h | 4 | ||||
-rw-r--r-- | sys/netinet/ip_esp_old.c | 12 | ||||
-rw-r--r-- | sys/netinet/ip_ip4.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_ip4.h | 4 |
7 files changed, 30 insertions, 8 deletions
diff --git a/sys/netinet/ip_ah.h b/sys/netinet/ip_ah.h index 4781fbd6eaa..f6ca28ba85b 100644 --- a/sys/netinet/ip_ah.h +++ b/sys/netinet/ip_ah.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.h,v 1.8 1997/07/11 23:37:54 provos Exp $ */ +/* $OpenBSD: ip_ah.h,v 1.9 1997/07/14 08:48:44 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -62,6 +62,8 @@ struct ahstat u_int32_t ahs_input; /* Input AH packets */ u_int32_t ahs_output; /* Output AH packets */ u_int32_t ahs_invalid; /* Trying to use an invalid TDB */ + u_int64_t ahs_ibytes; /* input bytes */ + u_int64_t ahs_obytes; /* output bytes */ }; #define AH_HMAC_HASHLEN 12 /* 96 bits of authenticator */ diff --git a/sys/netinet/ip_ah_new.c b/sys/netinet/ip_ah_new.c index 34a7f723dc2..f9a76b03b92 100644 --- a/sys/netinet/ip_ah_new.c +++ b/sys/netinet/ip_ah_new.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah_new.c,v 1.2 1997/07/12 14:57:01 provos Exp $ */ +/* $OpenBSD: ip_ah_new.c,v 1.3 1997/07/14 08:48:45 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -587,6 +587,7 @@ ah_new_input(struct mbuf *m, struct tdb *tdb) /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += ntohs(ip->ip_len) - (ip->ip_hl << 2); + ahstat.ahs_ibytes += ntohs(ip->ip_len) - (ip->ip_hl << 2); return m; } @@ -889,6 +890,7 @@ ah_new_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += ip->ip_len - (ip->ip_hl << 2) - AH_NEW_FLENGTH; + ahstat.ahs_obytes += ip->ip_len - (ip->ip_hl << 2) - AH_NEW_FLENGTH; return 0; } diff --git a/sys/netinet/ip_ah_old.c b/sys/netinet/ip_ah_old.c index 0cf653c62b1..08a443e081e 100644 --- a/sys/netinet/ip_ah_old.c +++ b/sys/netinet/ip_ah_old.c @@ -481,6 +481,7 @@ ah_old_input(struct mbuf *m, struct tdb *tdb) /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += ntohs(ip->ip_len) - (ip->ip_hl << 2); + ahstat.ahs_ibytes += ntohs(ip->ip_len) - (ip->ip_hl << 2); return m; } @@ -773,6 +774,7 @@ ah_old_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += ip->ip_len - (ip->ip_hl << 2) - AH_OLD_FLENGTH - alen; + ahstat.ahs_obytes += ip->ip_len - (ip->ip_hl << 2) - AH_OLD_FLENGTH - alen; return 0; } diff --git a/sys/netinet/ip_esp.h b/sys/netinet/ip_esp.h index 02122fa2fe7..ceb335693b1 100644 --- a/sys/netinet/ip_esp.h +++ b/sys/netinet/ip_esp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.h,v 1.8 1997/07/11 23:37:56 provos Exp $ */ +/* $OpenBSD: ip_esp.h,v 1.9 1997/07/14 08:48:46 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -69,6 +69,8 @@ struct espstat u_int32_t esps_input; /* Input ESP packets */ u_int32_t esps_output; /* Output ESP packets */ u_int32_t esps_invalid; /* Trying to use an invalid TDB */ + u_int64_t esps_ibytes; /* input bytes */ + u_int64_t esps_obytes; /* output bytes */ }; struct esp_old_xdata diff --git a/sys/netinet/ip_esp_old.c b/sys/netinet/ip_esp_old.c index dc1ffb1dd81..363b8b45b23 100644 --- a/sys/netinet/ip_esp_old.c +++ b/sys/netinet/ip_esp_old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp_old.c,v 1.1 1997/07/11 23:37:57 provos Exp $ */ +/* $OpenBSD: ip_esp_old.c,v 1.2 1997/07/14 08:48:46 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -480,6 +480,7 @@ esp_old_input(struct mbuf *m, struct tdb *tdb) /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += ntohs(ip->ip_len) - (ip->ip_hl << 2) + blk[6] + 2; + espstat.esps_ibytes += ntohs(ip->ip_len) - (ip->ip_hl << 2) + blk[6] + 2; return m; } @@ -726,6 +727,7 @@ esp_old_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, /* Update the counters */ tdb->tdb_cur_packets++; tdb->tdb_cur_bytes += rlen + padding; + espstat.esps_obytes += rlen + padding; return 0; } @@ -748,7 +750,13 @@ m_pad(struct mbuf *m, int n) u_int8_t dat; if (n <= 0) /* no stupid arguments */ - return NULL; + { +#ifdef ENCDEBUG + if (encdebug) + printf("m_pad(): pad length invalid (%d)\n", n); +#endif /* ENCDEBUG */ + return NULL; + } len = m->m_pkthdr.len; pad = n; diff --git a/sys/netinet/ip_ip4.c b/sys/netinet/ip_ip4.c index 6416a159f92..ac9331a7439 100644 --- a/sys/netinet/ip_ip4.c +++ b/sys/netinet/ip_ip4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ip4.c,v 1.11 1997/07/11 23:37:58 provos Exp $ */ +/* $OpenBSD: ip_ip4.c,v 1.12 1997/07/14 08:48:47 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -120,7 +120,9 @@ ip4_input(register struct mbuf *m, int iphlen) } ipi = (struct ip *) ((caddr_t) ipo + iphlen); - + + ip4stat.ip4s_ibytes += ntohs(ipi->ip_len); + /* * RFC 1853 specifies that the inner TTL should not be touched on * decapsulation. There's no reason this comment should be here, but @@ -238,6 +240,8 @@ ipe4_output(struct mbuf *m, struct sockaddr_encap *gw, struct tdb *tdb, tdb->tdb_cur_bytes += ntohs(ipo->ip_len) - (ipo->ip_hl << 2); } + ip4stat.ip4s_obytes += ntohs(ipo->ip_len) - (ipo->ip_hl << 2); + return 0; /* return ip_output(m, NULL, NULL, IP_ENCAPSULATED, NULL); */ diff --git a/sys/netinet/ip_ip4.h b/sys/netinet/ip_ip4.h index fd9d3d40070..ca5162b1c4c 100644 --- a/sys/netinet/ip_ip4.h +++ b/sys/netinet/ip_ip4.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ip4.h,v 1.7 1997/07/01 22:12:50 provos Exp $ */ +/* $OpenBSD: ip_ip4.h,v 1.8 1997/07/14 08:48:47 provos Exp $ */ /* * The author of this code is John Ioannidis, ji@tla.org, @@ -36,6 +36,8 @@ struct ip4stat u_int32_t ip4s_badlen; u_int32_t ip4s_notip4; u_int32_t ip4s_qfull; + u_int64_t ip4s_ibytes; + u_int64_t ip4s_obytes; }; #define IP4_DEFAULT_TTL 0 |