aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2024-12-12 14:40:49 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2025-02-13 14:03:55 +0000
commit5f2744d520e914a38770681ef75bee501dd7b49a (patch)
tree679e10f5c8bb1e9d999ed8625f03404d05d5d307
parenta3b66c4bf0e2eec0f86cd4d291158575aef05dfc (diff)
icmp: improve INVARIANTS check
Actually check the conditions that are enforced by the error checking code instead of a condition which is * checking a number to be non-negative instead of positive * depending on a random number Perform the checks consistently for ICMPv4 and ICMPv6. Reviewed by: glebius, rrs, cc Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D48001 Approved by: re (cperciva) (cherry picked from commit c9febea3dc8ac8e308e8fc5a2e74dd0313fdc5d2) (cherry picked from commit bd6a89a6c32a0f5b08182ea06e625a6695f3fbb0)
-rw-r--r--sys/netinet/ip_icmp.c2
-rw-r--r--sys/netinet6/icmp6.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 67adc1245b60..f4b697f30eee 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1142,7 +1142,7 @@ sysctl_icmplim_and_jitter(SYSCTL_HANDLER_ARGS)
}
}
}
- MPASS(V_icmplim + V_icmplim_curr_jitter >= 0);
+ MPASS(V_icmplim == 0 || V_icmplim > V_icmplim_jitter);
return (error);
}
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index a26348640cbc..52430f9146ae 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2856,7 +2856,7 @@ sysctl_icmp6lim_and_jitter(SYSCTL_HANDLER_ARGS)
}
}
}
- MPASS(V_icmp6errppslim + V_icmp6lim_curr_jitter >= 0);
+ MPASS(V_icmp6errppslim == 0 || V_icmp6errppslim > V_icmp6lim_jitter);
return (error);
}