From nobody Mon Dec 02 10:25:00 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 4Y20K86Rj1z5fWNf; Mon, 02 Dec 2024 10:25:00 +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 4Y20K85yzBz4Nd1; Mon, 2 Dec 2024 10:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733135100; 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=bNPAqS/h0inUB1t4Qv20LzXyyx8gXPlG6EKII/wX630=; b=FJ0lxbIG22cvJ36Ujw9ykw287t+ZS/4P/R7jYC01pR7x6p2ofMBkblZysAAkgAldisOAxQ gPbeIAy2GKIhJmrrG8nx8LAn5QIX+bYoPqITMgtj7TCsD7FuTqqHdXku6AfopN6Ek/ufDJ GRveO9DXryP+RtZ0jEIWEk6k4UJkTuZnM2hxVzuB4hkRVEpwpYgn3VpD2c8iY7zEEMS7bM fJlDoUKIlnTJoMZ7AX4RALEweONIMKmP9N/hwL/J8NlVPQGZJhQj29kOij3LHqp6FvmIgx drZXn96wFIpbmah8iRbL/fPbDKNxkEv1VNbaZFMRCQ8HzaSWEjC9HzE1iVCDyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733135100; 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=bNPAqS/h0inUB1t4Qv20LzXyyx8gXPlG6EKII/wX630=; b=pQXebMhlNsk8m4KNoWSk6phiABiQPZJ2fMZo5G6f7TDTjIIXxQMLV5B9lbFWZrK9zyHLQs +TrvR1S+el5K2XSmDzsrtntAyvYBgha2VUytS1KVFse3U2qnh4cK/xXdxDllE18wphjnS9 HEqaWDQcfzyY9Pbhky94x3qbjKfkAsnDd2On5kSmSd0EpxUg7v2BbsIYNtJBIOIxtfeR0R Qk34t9f4JKvCsZujZymBz97b6XBuOW2pkr0nsNoIFCqlzqVJxKnVQLqWPg9JsXh94W5i+e cc/bZRxOEWI7jccUzbK9gOcTm7uI7bB9Akr3A7L6o/5aQu9QxuGw3bSQl3ERgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733135100; a=rsa-sha256; cv=none; b=w7bv1Ut+tSBnszCMZs7rlVqlAiXeI9etAfY5XtpV+3qzgKNzPzUFGtqOlODVHXmFjPqKaI Tb7Qfj8uLkypKwwvXIx+apHQPjRhWXTka5VxKsAdz29s0GQZOkPaYU2egZzHhk32tTPDbN hNHx25MipnWlzCPm6JCSWtjEJowBm3RLt3eLrxEHtBlszy2oXMwGTWwbVuQOccm+hpVHGO 8tYFe96m4P7pZp4RKsDG1DIcnVWuZbTHcGbj1uYsqEy24mkVFHlt5nmZ2zNWlqmwKWeoTz 2VLycJtvUF7OzEhPLaDCdWun1NhaL5jhN2GvRyeBRV54/0T6FgmJ/mG2RTtUKQ== 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 4Y20K85THXzZ49; Mon, 2 Dec 2024 10:25:00 +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 4B2AP0uQ096576; Mon, 2 Dec 2024 10:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B2AP0Qg096573; Mon, 2 Dec 2024 10:25:00 GMT (envelope-from git) Date: Mon, 2 Dec 2024 10:25:00 GMT Message-Id: <202412021025.4B2AP0Qg096573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 628e76a986b9 - stable/14 - ipsec: fix IPv6 over IPv4 tunneling. 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: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 628e76a986b9621199e77730eebfdb8e0e43c945 Auto-Submitted: auto-generated The branch stable/14 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=628e76a986b9621199e77730eebfdb8e0e43c945 commit 628e76a986b9621199e77730eebfdb8e0e43c945 Author: Andrey V. Elsukov AuthorDate: 2024-11-25 17:42:00 +0000 Commit: Andrey V. Elsukov CommitDate: 2024-12-02 10:24:03 +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 (cherry picked from commit c94d6389e428fac55946bfcdbbc3162c06a9278e) --- 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 caf3c3f74433..ebff5ee5adc7 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -1083,7 +1083,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; @@ -1093,17 +1093,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