git: 6b8b1047276e - stable/14 - icmp: improve INVARIANTS check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Feb 2025 18:44:31 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=6b8b1047276eb451b88711536e001fad6d3d9c57
commit 6b8b1047276eb451b88711536e001fad6d3d9c57
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-12-12 14:40:49 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-02-05 07:58:54 +0000
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
(cherry picked from commit c9febea3dc8ac8e308e8fc5a2e74dd0313fdc5d2)
---
sys/netinet/ip_icmp.c | 2 +-
sys/netinet6/icmp6.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 5ad1b2a664db..24a14c4d4879 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1150,7 +1150,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 d6e47a29eede..138a7ce71bbc 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2819,7 +2819,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);
}