summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-10-19 23:15:54 +0000
committerjoe <joe@FreeBSD.org>2000-10-19 23:15:54 +0000
commitc6d8349444659c4a281b31a709377e8c71a90ad9 (patch)
tree5b45af51429da655c27059a03f05adb01ed28593 /sys/netinet/ip_input.c
parent8de06f19919021195552d59746e811f20efc29ba (diff)
downloadFreeBSD-src-c6d8349444659c4a281b31a709377e8c71a90ad9.zip
FreeBSD-src-c6d8349444659c4a281b31a709377e8c71a90ad9.tar.gz
Augment the 'ifaddr' structure with a 'struct if_data' to keep
statistics on a per network address basis. Teach the IPv4 and IPv6 input/output routines to log packets/bytes against the network address connected to the flow. Teach netstat to display the per-address stats for IP protocols when 'netstat -i' is evoked, instead of displaying the per-interface stats.
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index a360b4f..6eae653 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -253,7 +253,7 @@ ip_input(struct mbuf *m)
{
struct ip *ip;
struct ipq *fp;
- struct in_ifaddr *ia;
+ struct in_ifaddr *ia = NULL;
int i, hlen, mff;
u_short sum;
u_int16_t divert_cookie; /* firewall cookie */
@@ -585,6 +585,11 @@ pass:
return;
ours:
+ /* Count the packet in the ip address stats */
+ if (ia != NULL) {
+ ia->ia_ifa.if_ipackets++;
+ ia->ia_ifa.if_ibytes += m->m_pkthdr.len;
+ }
/*
* If offset or IP_MF are set, must reassemble.
OpenPOWER on IntegriCloud