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
This commit is contained in:
Tom Jones 2019-02-19 19:57:55 +00:00
parent 625bdc784e
commit 198fdaeda1

View File

@ -593,7 +593,7 @@ insert:
af6 = af6->ip6af_down) { af6 = af6->ip6af_down) {
if (af6->ip6af_off != next) { if (af6->ip6af_off != next) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
IP6STAT_INC(ip6s_fragdropped); IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
frag6_freef(q6, hash); frag6_freef(q6, hash);
} }
IP6Q_UNLOCK(hash); IP6Q_UNLOCK(hash);
@ -603,7 +603,7 @@ insert:
} }
if (af6->ip6af_up->ip6af_mff) { if (af6->ip6af_up->ip6af_mff) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
IP6STAT_INC(ip6s_fragdropped); IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
frag6_freef(q6, hash); frag6_freef(q6, hash);
} }
IP6Q_UNLOCK(hash); IP6Q_UNLOCK(hash);
@ -861,7 +861,8 @@ frag6_slowtimo(void)
--q6->ip6q_ttl; --q6->ip6q_ttl;
q6 = q6->ip6q_next; q6 = q6->ip6q_next;
if (q6->ip6q_prev->ip6q_ttl == 0) { 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) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(q6->ip6q_prev, i); frag6_freef(q6->ip6q_prev, i);
} }
@ -879,7 +880,8 @@ frag6_slowtimo(void)
(V_ip6_maxfragpackets > 0 && (V_ip6_maxfragpackets > 0 &&
V_ip6q[i].count > V_ip6_maxfragbucketsize)) && V_ip6q[i].count > V_ip6_maxfragbucketsize)) &&
head->ip6q_prev != head) { 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) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(head->ip6q_prev, i); frag6_freef(head->ip6q_prev, i);
} }
@ -896,7 +898,8 @@ frag6_slowtimo(void)
IP6Q_LOCK(i); IP6Q_LOCK(i);
head = IP6Q_HEAD(i); head = IP6Q_HEAD(i);
if (head->ip6q_prev != head) { 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) */ /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
frag6_freef(head->ip6q_prev, i); frag6_freef(head->ip6q_prev, i);
} }