Received: by 10.192.165.156 with SMTP id m28csp75721imm; Tue, 10 Apr 2018 16:46:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49TQJ9WHGbvPHvyP+hXjoTaEjjx4INTUHfuM/oY0y33Ly2lUTlasaXOJnqRjsJrL6v/Ov5r X-Received: by 10.101.89.6 with SMTP id f6mr1684250pgu.178.1523403996740; Tue, 10 Apr 2018 16:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403996; cv=none; d=google.com; s=arc-20160816; b=BkLI5k6hIzYICttDwQv0LxuCmrrac3IVdmQ+ykXYB8VxxiOytzzxFprBHox1r6vHT8 R/a2AJjgEESXb6I5nJLlMU3gbV7Sc3tGDtJOgsAeuVQfWEuSP5ihLR9dQ87NzajMqgAC 2px+7EYCLWThgzSWloQm49XcF90h9cYELLxy/2pNXf+J4Vp/iiu8zczEcVUAr54amWxQ tYWmEOzGZKjnAXgiEJnfOfI1RfEoLmW4A0aBimypFmCC+UuIIogIH/JGH1N0XbcdY1xb uV420oxctv6PAizq/weoFAiD6agbwQIJCSgqqvt8hRawsyyB8/hphoVKOx/VFfOKC+kz O1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sW316FLomJkUk+i/sOFG9Sao4fzBExtnsBoOK7R/dZU=; b=A9pAZ2mWA/A4Ofl5wnNNjshFPMuXH/MMYOWBBAWhfgmI9IAiRpWlUzoB20O2pg/e4J z1I++X//yd4UWdLgPQ/fH+wXYRa1IqGEZoHz1IxiiT0yCJU4BV0fFAQVk8a0qVoeKi0m lo9DQlPYuZ5I91GMmjRqwLqYeauWzczwBZIa/C1pb6KtPA3psYWDrKB21TpLIBE8MV1w ua4gFBuYdnVbc0h8eAoV6B2YZQq9jZXI7fy8HDj6vaEfb9fkNQCjI24mg9KjtZg8GqlJ 8weYlV6Cbfypqx/Mr8BId1XqEaa6WeEJStq2/2Hs2ALYKWCf+lvjF/lZHpF56Y64e12P bQnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11-v6si3511717plo.243.2018.04.10.16.45.59; Tue, 10 Apr 2018 16:46:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754225AbeDJXlm (ORCPT + 99 others); Tue, 10 Apr 2018 19:41:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37134 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753072AbeDJW0S (ORCPT ); Tue, 10 Apr 2018 18:26:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 86F38D0B; Tue, 10 Apr 2018 22:26:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tobias Brunner , Steffen Klassert , "David S. Miller" , Sasha Levin Subject: [PATCH 4.15 007/168] ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT Date: Wed, 11 Apr 2018 00:22:29 +0200 Message-Id: <20180410212800.540615075@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tobias Brunner [ Upstream commit 09ee9dba9611cd382fd360a99ad1c2fa23bfdca8 ] If SNAT modifies the source address the resulting packet might match an IPsec policy, reinject the packet if that's the case. The exact same thing is already done for IPv4. Signed-off-by: Tobias Brunner Acked-by: Steffen Klassert Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_output.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -138,6 +138,14 @@ static int ip6_finish_output(struct net return ret; } +#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) + /* Policy lookup after SNAT yielded a new policy */ + if (skb_dst(skb)->xfrm) { + IPCB(skb)->flags |= IPSKB_REROUTED; + return dst_output(net, sk, skb); + } +#endif + if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || dst_allfrag(skb_dst(skb)) || (IP6CB(skb)->frag_max_size && skb->len > IP6CB(skb)->frag_max_size))