From 1ade5b1eab73d10a65241fbbd57c9c5fc68012c0 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 29 Oct 2000 01:05:09 +0000 Subject: Count per-address statistics for IP fragments. Requested by: ru Obtained from: BSD/OS --- sys/netinet/ip_output.c | 8 ++++++-- sys/netinet6/ip6_output.c | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 7c166b7..ed3d873 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -934,10 +934,14 @@ sendorfree: for (m = m0; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = 0; - if (error == 0) + if (error == 0) { + /* Record statistics for this interface address. */ + ia->ia_ifa.if_opackets++; + ia->ia_ifa.if_obytes += m->m_pkthdr.len; + error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, ro->ro_rt); - else + } else m_freem(m); } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 4f1bd4c..328e7ea 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1012,6 +1012,12 @@ sendorfree: m0 = m->m_nextpkt; m->m_nextpkt = 0; if (error == 0) { + /* Record statistics for this interface address. */ + if (ia) { + ia->ia_ifa.if_opackets++; + ia->ia_ifa.if_obytes += m->m_pkthdr.len; + } + error = nd6_output(ifp, origifp, m, dst, ro->ro_rt); } else m_freem(m); -- cgit v1.1