diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index b8ac3fc7b09..ba66e18b652 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -343,10 +343,8 @@ icmp6_error(struct mbuf *m, int type, int code, int param) } /* Finally, do rate limitation check. */ - if (icmp6_ratelimit(&oip6->ip6_src, type, code)) { - ICMP6STAT_INC(icp6s_toofreq); + if (icmp6_ratelimit(&oip6->ip6_src, type, code)) goto freeit; - } /* * OK, ICMP6 can be generated. @@ -2746,6 +2744,7 @@ icmp6_ratelimit(const struct in6_addr *dst, const int type, V_icmp6errppslim)) { /* The packet is subject to rate limit */ ret++; + ICMP6STAT_INC(icp6s_toofreq); } return ret;