From 198fdaeda195bde1aeb10527fcae43e092f7f91f Mon Sep 17 00:00:00 2001 From: Tom Jones Date: Tue, 19 Feb 2019 19:57:55 +0000 Subject: [PATCH] When dropping a fragment queue count the number of fragments in the queue When dropping a fragment queue, account for the number of fragments in the queue. This improves accounting between the number of fragments received and the number of fragments dropped. Reviewed by: jtl, bz, transport Approved by: jtl (mentor), bz (mentor) Differential Revision: https://review.freebsd.org/D17521 --- sys/netinet6/frag6.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index bbdbf448f7cb..715c7d0c042d 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -593,7 +593,7 @@ insert: af6 = af6->ip6af_down) { if (af6->ip6af_off != next) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { - IP6STAT_INC(ip6s_fragdropped); + IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); frag6_freef(q6, hash); } IP6Q_UNLOCK(hash); @@ -603,7 +603,7 @@ insert: } if (af6->ip6af_up->ip6af_mff) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { - IP6STAT_INC(ip6s_fragdropped); + IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); frag6_freef(q6, hash); } IP6Q_UNLOCK(hash); @@ -861,7 +861,8 @@ frag6_slowtimo(void) --q6->ip6q_ttl; q6 = q6->ip6q_next; if (q6->ip6q_prev->ip6q_ttl == 0) { - IP6STAT_INC(ip6s_fragtimeout); + IP6STAT_ADD(ip6s_fragtimeout, + q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(q6->ip6q_prev, i); } @@ -879,7 +880,8 @@ frag6_slowtimo(void) (V_ip6_maxfragpackets > 0 && V_ip6q[i].count > V_ip6_maxfragbucketsize)) && head->ip6q_prev != head) { - IP6STAT_INC(ip6s_fragoverflow); + IP6STAT_ADD(ip6s_fragoverflow, + q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(head->ip6q_prev, i); } @@ -896,7 +898,8 @@ frag6_slowtimo(void) IP6Q_LOCK(i); head = IP6Q_HEAD(i); if (head->ip6q_prev != head) { - IP6STAT_INC(ip6s_fragoverflow); + IP6STAT_ADD(ip6s_fragoverflow, + q6->ip6q_prev->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ frag6_freef(head->ip6q_prev, i); }