From nobody Thu Dec 12 14:45:10 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y8Fcl1kNXz5gMBG; Thu, 12 Dec 2024 14:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y8Fcl14mSz4ZCS; Thu, 12 Dec 2024 14:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734014711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g4SgUsu32jA+FH0LZKutK47lCG16iknjlrmpnJDjwy4=; b=ttBoeQ6tEGyC9bQ3u3tnjsksotcsBLF+PaBNWHW98XEI1xNNyVnRdJXrmVZ1SkDlBfnYTk rxfCB/jPbG06lRhRBUlWqRJSXO11KpSvOoXFIfq+Yu6e4KgOb9T+vLVNCu31+iGhu+SPvQ A4lqvf1NZSs2HzGT3umKpMKIkFXjJpIE+TeF+Ye6bxq+kv7HBjZPv7pfsa9b5tWtrYsYXK 9eL7gvgFJh01V2FCQiivA8x3D7zunTYggdgEC9gsirOb5APyg46x9/oY084s3JmaQsOMgO 5z85rIU0VeLUSkJHg0w7uEXTn81VAIux2As/u1PSTY05UqR4QW25jJixlMP8nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734014711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g4SgUsu32jA+FH0LZKutK47lCG16iknjlrmpnJDjwy4=; b=Q5VBvYeNd1cDbcPIREBh83O9GTBMml868VUOtF02GaQjwJx+sGVmr+yYhD1Aa5adYueYV8 UKKMGaQkD/+RR7jJbXsR0Sf0Sgb9Ut/2sdqZd05RYAwHljK1oX0JmT72jOc2kCeeYDvueE wBqrxFVg/94otuPCBXBMLK3FZbutoT9YoR68cJvgV2xrvqJWgjR8NXE3difl3+Tk+AnsK+ LeNMuwh6bSMFblkZnoF8GzTwoC7SP00IlRBEj+8BIl8MZURO15IzXY7JBJCcrOjuSuYxIk po+rcRqflWdu3fRKIjInmtJ+xJTkthS1NltVibwH6lbvuRTySUana1krBBUagg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734014711; a=rsa-sha256; cv=none; b=ewciEI10VZviYWyJHz8JLJq9DVSw+eQxaRnvQqQYGo6ZUTvfdheWY7orEuHPHW1xpoapDX Rk3pDPrHsNaR8JswF0a3GuSYr/1mg8E3/uOzDe50JOi8LQJvxGwIyaKoVNzQLFejaBsWKw XkqoWXdGikXSJj0cAD9CiAu6sjUnFS6YJtA81YEOgNX7kCnBp6Z2NUZ+Y1ct6S2q1ZrPTr GMEy7ke2fpWoDo2DNNMxb2dn4fkVnhBawjDiWccidLsCRB1Lvh1HiXevGJwUKgu+xp0XFg +ckmWE2NsR+yEysr2VsrqVagbbMqMruUVTvdylN8fGtthsDQt75J7PwZ3E4zNg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y8Fcl0YQGzxKC; Thu, 12 Dec 2024 14:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BCEjAYL002187; Thu, 12 Dec 2024 14:45:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BCEjAQw002184; Thu, 12 Dec 2024 14:45:10 GMT (envelope-from git) Date: Thu, 12 Dec 2024 14:45:10 GMT Message-Id: <202412121445.4BCEjAQw002184@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: c9febea3dc8a - main - icmp: improve INVARIANTS check List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c9febea3dc8ac8e308e8fc5a2e74dd0313fdc5d2 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c9febea3dc8ac8e308e8fc5a2e74dd0313fdc5d2 commit c9febea3dc8ac8e308e8fc5a2e74dd0313fdc5d2 Author: Michael Tuexen AuthorDate: 2024-12-12 14:40:49 +0000 Commit: Michael Tuexen CommitDate: 2024-12-12 14:40:49 +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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D48001 --- 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 1149796c0db3..58484e532fef 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1148,7 +1148,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 e0f642544327..d1c2f2c85142 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2817,7 +2817,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); }