From nobody Mon Nov 25 17:50:54 2024 X-Original-To: dev-commits-src-main@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 4XxtXt3rL5z5dxRm; Mon, 25 Nov 2024 17:50:54 +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 4XxtXt3H2Rz4P5k; Mon, 25 Nov 2024 17:50:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732557054; 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=RzKtJD665psmBevxwntojUF0Za9YqHEhPjC+bhml90Q=; b=gpd2Z8rRmfuBFAT5V9RdKc0YY7m8GOH3LHpLV/LqM3ts0g48T49evw6v0Go5A1ho+0+4Tv GwC66+RTYt8gXi2PWID3Zmj3ogKleudJ3Xxlh+4wDxHuKzrhmHRKj2frYFtRSJRzwhM4+G 9fnaXIzrpEfsr21xmBKWjFMvs6zkxDpogRvqNtd70DiP9p8NHpjE2d7UT4Ooydj1dk6SXg qFGL6fmcf1A8XpdJP1QYbqOHuZ+HLo4yNPSpxUTFBevaEb0N+sjUfxvkbP8fJa0O5fm++E npSLLDdPIih4zWUB3lwkyjf4FgTfJnheO6R73uxSt3KH2yWuhcmXKfHUKSRqEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732557054; 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=RzKtJD665psmBevxwntojUF0Za9YqHEhPjC+bhml90Q=; b=Udmca5BoVUSwPlhOtl5VvMbXhiTJJP23+ny0LtdITOcTiRqq+PlekVcWNqUfB/ANmTwEMj og28jNIrZ8OwI0WYYrrzRFtD/CmlrrV+4Qlp0rfckgQSANpTxU4sgmUeyr2/mkz50vftE9 IKAMHAine1iWksXqFjcSepG+mlS/TGvcyDHFgy+tL89tzoxZWJH+dSr9XpoDW9NuNwWIH6 TeXsVHHa5imdGVh7aCSUyySUIXLtJV4Jg2fOGMA9vdakF1E15SWNznTAt52UO2scy0VbL9 7QV7K3QVQ7raOXU88PHoW8fAhoS/uwDT34SUtDCeC+bqnvmolF1Em5UbYEAFGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732557054; a=rsa-sha256; cv=none; b=CelTvC5XjGrsS1pBk5TzPEcVL4Tvc5KU2XejTXr3TgCYIS88FrFQRffA0cwZkvK6QaIvZd c2uV2NNexkwSHi1m66NU8EvUvn/FM5pHKYm9dwhj3PV5Z7b6RDKfS11X8lZDfdW4AYZr/f b2uxLxm/ftfr97lG6L7EZhxDAMep98zYu02K4o4fr75YCgBoLbxQXSeFqOr+Kg4LJYYOjw ERrAhg7y0f8Pcvo8lpL56YQa6ub9g9wrMG/BZpWjib6oLWfFysGjsDZbgUGh1abepLZmz9 f/WfiuNJXRF81Da6VqCmKIziSVQ5lJaZ3XKwuHiHwe0H81YCdY3m8HtrtWwOBw== 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 4XxtXt2v6CzqDW; Mon, 25 Nov 2024 17:50:54 +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 4APHoseL046936; Mon, 25 Nov 2024 17:50:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4APHosvm046933; Mon, 25 Nov 2024 17:50:54 GMT (envelope-from git) Date: Mon, 25 Nov 2024 17:50:54 GMT Message-Id: <202411251750.4APHosvm046933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: c94d6389e428 - main - ipsec: fix IPv6 over IPv4 tunneling. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c94d6389e428fac55946bfcdbbc3162c06a9278e Auto-Submitted: auto-generated The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=c94d6389e428fac55946bfcdbbc3162c06a9278e commit c94d6389e428fac55946bfcdbbc3162c06a9278e Author: Andrey V. Elsukov AuthorDate: 2024-11-25 17:42:00 +0000 Commit: Andrey V. Elsukov CommitDate: 2024-11-25 17:42:00 +0000 ipsec: fix IPv6 over IPv4 tunneling. Properly initialize setdf variable in ipsec_encap(). It is used for AF_INET6 case when IPv6 datagram is going to be encapsulated into IPv4 datagram. PR: 282535 Fixes: 4046178557e1 MFC after: 1 week --- sys/netipsec/ipsec_output.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 10f1728f72ac..73a32c71fffc 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -1112,7 +1112,7 @@ ipsec_encap(struct mbuf **mp, struct secasindex *saidx) #endif struct ip *ip; #ifdef INET - int setdf; + int setdf = V_ip4_ipsec_dfbit == 1 ? 1: 0; #endif uint8_t itos, proto; @@ -1122,17 +1122,11 @@ ipsec_encap(struct mbuf **mp, struct secasindex *saidx) case IPVERSION: proto = IPPROTO_IPIP; /* - * Collect IP_DF state from the inner header - * and honor system-wide control of how to handle it. + * Copy IP_DF flag from the inner header if + * system-wide control variable is greater than 1. */ - switch (V_ip4_ipsec_dfbit) { - case 0: /* clear in outer header */ - case 1: /* set in outer header */ - setdf = V_ip4_ipsec_dfbit; - break; - default:/* propagate to outer header */ + if (V_ip4_ipsec_dfbit > 1) setdf = (ip->ip_off & htons(IP_DF)) != 0; - } itos = ip->ip_tos; break; #endif