git: d366b4931519 - stable/14 - icmp: allow zero value for ICMP limits

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Wed, 26 Jun 2024 04:50:28 UTC
The branch stable/14 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=d366b4931519acf90a8e76d95356b0e4140aaf40

commit d366b4931519acf90a8e76d95356b0e4140aaf40
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-03-25 02:52:03 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-26 04:48:44 +0000

    icmp: allow zero value for ICMP limits
    
    Zero means limit is disabled, so the value doesn't need to be checked
    against jitter value.
    
    Fixes:  ac44739fd834f51cacb26485a4140fd482e20150
    Fixes:  a03aff88a14448c3084a0384082ec996d7213897
    (cherry picked from commit 4399e055ea610cdefa1470ad1ee614dd81ba5e56)
---
 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 dcf387aa3c1c..67fb56dcdfa2 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1137,7 +1137,7 @@ sysctl_icmplim_and_jitter(SYSCTL_HANDLER_ARGS)
 	error = sysctl_handle_int(oidp, &new, 0, req);
 	if (error == 0 && req->newptr) {
 		if (lim) {
-			if (new <= V_icmplim_jitter)
+			if (new != 0 && new <= V_icmplim_jitter)
 				error = EINVAL;
 			else
 				V_icmplim = new;
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 4bce366c7ed4..c03c90e566c3 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2806,7 +2806,7 @@ sysctl_icmp6lim_and_jitter(SYSCTL_HANDLER_ARGS)
 	error = sysctl_handle_int(oidp, &new, 0, req);
 	if (error == 0 && req->newptr) {
 		if (lim) {
-			if (new <= V_icmp6lim_jitter)
+			if (new != 0 && new <= V_icmp6lim_jitter)
 				error = EINVAL;
 			else
 				V_icmp6errppslim = new;