From patchwork Fri Mar 15 12:25:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Brunner X-Patchwork-Id: 13593407 X-Patchwork-Delegate: kuba@kernel.org Received: from mail.codelabs.ch (mail.codelabs.ch [109.202.192.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D81051A38E1 for ; Fri, 15 Mar 2024 12:33:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.202.192.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710505999; cv=none; b=dw86GyVbeGolI8q6z+JjTr1Vso+3wdjA6k+AfaYRUciCASV2JnZtSq+GMuIXsqhzkqoT9lfrYxi27xher/GFjMumVcXGvtMiGmG3+BL7EZvHV/dWpYwuRJAast3eKAUeTX/aBruPdkJebCJXoaEPtd31dIanDykOVajHk3ki5Ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710505999; c=relaxed/simple; bh=TeThsepKwcYMzi6vRV1ofdWBdRt+ego0RAk4qLIWwN0=; h=Message-ID:Date:MIME-Version:From:To:Cc:Subject:Content-Type; b=cC4nCp4iTKvDX6DCZkAzSB2h2ANebK8H3mX77kaIf5YDRbz7djtHbhhdA3OJ3e7aNq8SsMfdGUmT6f3YL1e65oOP/SiQRpCUBdKmvOVTkod6HWwAZEzzV27eA16ud1XSnAzkuQlcnfWczAAkVLUC+h2B2g4xl6bF+L9LLUvCGvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=strongswan.org; spf=pass smtp.mailfrom=strongswan.org; dkim=pass (2048-bit key) header.d=strongswan.org header.i=@strongswan.org header.b=KGhPZOUK; arc=none smtp.client-ip=109.202.192.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=strongswan.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strongswan.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=strongswan.org header.i=@strongswan.org header.b="KGhPZOUK" Received: from localhost (localhost [127.0.0.1]) by mail.codelabs.ch (Postfix) with ESMTP id F3EDB633E5; Fri, 15 Mar 2024 13:25:50 +0100 (CET) Received: from mail.codelabs.ch ([127.0.0.1]) by localhost (fenrir.codelabs.ch [127.0.0.1]) (amavis, port 10024) with ESMTP id ZWz9QZs-HPlc; Fri, 15 Mar 2024 13:25:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=strongswan.org; s=default; t=1710505548; bh=TeThsepKwcYMzi6vRV1ofdWBdRt+ego0RAk4qLIWwN0=; h=Date:From:To:Cc:Subject:From; b=KGhPZOUKGvRwOgLWn/bd4hah0kusbO8tVLmdsGB/POHKsa40gmdW4Ujpkb+iD1npZ /YTvysdW3nbhHOwmkJeouODXZkFtmYJLpj+Whgelrr8V2ElcHg4y4UmXITjsYqbrHm nw2DYjIxtdQdsImSMcqXyZFip3HrnIFaW1BtmEp3EJ5wqHAiYsCoFGtqpK7pKEW+dJ zu5TSff/N7/D/yk++pq5GC7xMzq/NrLdIjsade2LiRLOxN9kWY8eBgZWUGOVRWLD6n d85P0bjpwT9Vq0yrQb4tbpXUzz4cK1+AnrUfrK/ei2762OPrB6A+zeu+DT4wb3cDgu Q6MS0yjF3idUw== Received: from [IPV6:2a01:8b81:5400:f500:d47c:2824:818f:c8a] (unknown [IPv6:2a01:8b81:5400:f500:d47c:2824:818f:c8a]) by mail.codelabs.ch (Postfix) with ESMTPSA id 556A7633CC; Fri, 15 Mar 2024 13:25:48 +0100 (CET) Message-ID: <4f0d0955-8bfc-486e-a44f-0e12af8a403f@strongswan.org> Date: Fri, 15 Mar 2024 13:25:48 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US, de-CH-frami From: Tobias Brunner To: "David S. Miller" , David Ahern Cc: netdev@vger.kernel.org, Steffen Klassert , Herbert Xu Autocrypt: addr=tobias@strongswan.org; keydata= xsFNBFNaX0kBEADIwotwcpW3abWt4CK9QbxUuPZMoiV7UXvdgIksGA1132Z6dICEaPPn1SRd BnkFBms+I2mNPhZCSz409xRJffO41/S+/mYCrpxlSbCOjuG3S13ubuHdcQ3SmDF5brsOobyx etA5QR4arov3abanFJYhis+FTUScVrJp1eyxwdmQpk3hmstgD/8QGheSahXj8v0SYmc1705R fjUxmV5lTl1Fbszjyx7Er7Wt+pl+Bl9ReqtDnfBixFvDaFu4/HnGtGZ7KOeiaElRzytU24Hm rlW7vkWxtaHf94Qc2d2rIvTwbeAan1Hha1s2ndA6Vk7uUElT571j7OB2+j1c0VY7/wiSvYgv jXyS5C2tKZvJ6gI/9vALBpqypNnSfwuzKWFH37F/gww8O2cB6KwqZX5IRkhiSpBB4wtBC2/m IDs5VPIcYMCpMIGxinHfl7efv3+BJ1KFNEXtKjmDimu2ViIFhtOkSYeqoEcU+V0GQfn3RzGL 0blCFfLmmVfZ4lfLDWRPVfCP8pDifd3L2NUgekWX4Mmc5R2p91unjs6MiqFPb2V9eVcTf6In Dk5HfCzZKeopmz5+Ewwt+0zS1UmC3+6thTY3h66rB/asK6jQefa7l5xDg+IzBNIczuW6/YtV LrycjEvW98HTO4EMxqxyKAVpt33oNbNfYTEdoJH2EzGYRkyIVQARAQABzSZUb2JpYXMgQnJ1 bm5lciA8dG9iaWFzQHN0cm9uZ3N3YW4ub3JnPsLBkQQTAQgAOwIbAwULCQgHAwUVCgkICwUW AgMBAAIeAQIXgBYhBBJTj49om18fFfB74XZf4mxrRnWEBQJgm9DNAhkBAAoJEHZf4mxrRnWE rtoP+gMKaOxLKnNME/+D645LUncp4Pd6OvIuZQ/vmdH3TKgOqOC+XH74sEfVO8Ic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ZKIlLeHSofVlJrXh/y80ajxjVRjniPaTUzYihq2J974xA7Dt9ZFsFtbpZVqK/hy8 Lw186K40a+g2BVEJkYsJsGGkc5VxqUQS6CCNXc8ItmbFgxfugVF8SrjYZPreOQApYNBr8vjh olopOsrO788JvQ9W5K+v84OAQbHYR+8VvSlriRfSJrjvOQRblEZZ2CBMLiID1Lwi5vO5knbn w8JdxW4iA2g/kr28LwARAQABwsFfBBgBCAAJBQJTWl9JAhsMAAoJEHZf4mxrRnWERz4P/R2a RSewNNoM9YiggNtNJMx2AFcS4HXRrO8D26kkDlYtuozcQs0fxRnJGfQZ5YPZhxlq7cUdwHRN IWKRoCppbRNW8G/LcdaPZJGw3MtWjxNL8dANjHdAspoRACdwniR1KFX5ocqjk0+mNPpyeR9C 7h8cOzwIBketoKE5PcCODb/BO802fFDC1BYncZeQIRnMWilECp8Lb8tLxXAmq9L3R4c7CzID wMWWfOMmMqZnhnVEAiH9E4O94kwHZ4HWC4AYQizqgeRuYQUWWwoSBAzGzzagHg57ys6rJiwN tvIC3j+rtuqY9Ii8ehtliHlXMokOAXPgeJus0EHg7mMFN7GbmvrdTMdGhdHdd9+qbzhuCJBM ijszT5xoxLlqKxYH93zsx0SHKZp68ZyZJQwni63ZqN5P/4ox098M00eVpky1PLp9l5EBpsQH 9QlGq+ZLOB5zxTFFTuvC9PC/M3OpFUXdLr7yc83FyXh5YbGVNIxR49Qv58T1ZmKc9H34H31Z 6KRJPGmCzyQxHYSbP9KDT4S5/Dx/+iaMDb1G9fduSBrPxIIT5GEk3BKkH/SoAEFs7xxkljlo ggXfJu2a/qBTDPNzticcsvXz5XNnXRiZIrbpNkJ8hE0Huq2gdzHC+0hWMyoBNId9c2o38y5E tvkh7XWO2ycrW1UlzUzM4KV3SDLIhfOU Subject: [PATCH net] ipv4: raw: Fix sending packets from raw sockets via IPsec tunnels X-Patchwork-Delegate: kuba@kernel.org Since the referenced commit, the xfrm_inner_extract_output() function uses the skb's protocol field to determine the address family. So not setting it for IPv4 raw sockets meant that such packets couldn't be tunneled via IPsec anymore. IPv6 raw sockets are not affected as they already set the protocol since 9c9c9ad5fae7 ("ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs"). Fixes: 5f24f41e8ea6 ("xfrm: Remove inner/outer modes from input path") Signed-off-by: Tobias Brunner Reviewed-by: David Ahern --- net/ipv4/raw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 42ac434cfcfa..322e389021c3 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -357,6 +357,7 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4, goto error; skb_reserve(skb, hlen); + skb->protocol = htons(ETH_P_IP); skb->priority = READ_ONCE(sk->sk_priority); skb->mark = sockc->mark; skb->tstamp = sockc->transmit_time;