Received: by 10.213.65.68 with SMTP id h4csp1866247imn; Mon, 19 Mar 2018 15:42:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELtnQd2Mu2x5BJ4CercOF2U39DDXm5aTI4nCM6U9M7Ubo/eBERlmq6LX8kaEwnl9U65Yy/lv X-Received: by 2002:a17:902:7201:: with SMTP id ba1-v6mr2261810plb.0.1521499361698; Mon, 19 Mar 2018 15:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521499361; cv=none; d=google.com; s=arc-20160816; b=MFqIwxTScJvtxtu7cd5HL9RK/RVnVwvxvbTjli36pbD5goYmzvbApsuwHPtJQgD5sI j7J2eURl7ofonn9g7N5niWd2G0CaDEh0E4Fv8MqnoYHr/TJAUu8DKg5MOyKGuqCP2XKM AhXw6+7CwfVTY4uXedH+nJNAqnZcOCaHt5MsWmGlyhZ7I/XVFa7K7ZDwNSAZymIB0R3G JNViR1UjfnCftGpnLxokvlztAFmD/6RoduoFr/1D4AFIk4I6uX7s9l0O1FydqWP4W12g Uv+Nk0C2Zs6Ydcvyrz5ecTtlp1GpZNOacWTC9QPMLcjdPKQQeVnxpYiDBzgJqiKJMdkI UMsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=U4n+GS4z21SUQUO+uuFj5RHpYgajRX1M2CSHlMwUX0k=; b=dA9PPvddv9L2bIquSi+qLuWwDXoMb648EtRl5D8JGM5Cx/QCBY55LU0ws/x8FaaCN4 agotw/PhLb6IxUmVnB+M98V7mSX6AH3dYJsoovuAtF+hSnhY4jdep28zFapkveL0FWMM HWSIOaqmc8/xAOfhcfBHRAi9cvERpPtOX8JMYok2ONGHXszfhTo6aedqOnIAVPIdydFU Y9/IDGFMwvmMf8N5BryyjMxla8lwBn7CYNQr31kqHo/e6sL8ue15qWNtBoXSjw+EGXR8 zSYpl50SS9yfakDmT0IOahzMHpTVg2UnXwfwAUAcTsDGKH9QumAbNkLg/zKGFBvWBEFg 9v1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NFrInjyk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si210835pll.416.2018.03.19.15.42.27; Mon, 19 Mar 2018 15:42:41 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NFrInjyk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933260AbeCSPrZ (ORCPT + 99 others); Mon, 19 Mar 2018 11:47:25 -0400 Received: from mail-by2nam01on0103.outbound.protection.outlook.com ([104.47.34.103]:19764 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755478AbeCSPrJ (ORCPT ); Mon, 19 Mar 2018 11:47:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=U4n+GS4z21SUQUO+uuFj5RHpYgajRX1M2CSHlMwUX0k=; b=NFrInjykCGCqtk1vG0ytum4EFuqUdPTrSKtELwxszW/GP3oUuWPFa7PiNHnsr2x0ufs71vKc6ZoMd2G3FFPcbd+USCmAqe+J+lQ0qHsbgZ07oJddT60WU/wsCMfwa5eCiGqUmRLU1dwQlIuuJi8pStNwZjncYxaswpoTSHbpTWo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:47:04 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:47:04 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Tobias Brunner , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 007/124] ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT Thread-Topic: [PATCH AUTOSEL for 4.15 007/124] ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT Thread-Index: AQHTv5mG4fm8/dMZpkaX7/NaQpFPGg== Date: Mon, 19 Mar 2018 15:47:03 +0000 Message-ID: <20180319154645.11350-7-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1013;7:8W2XUz9QWv7gaWLmWZXyFAGTJZfxapEUt5nOhXCtP+tySc8Lp+dYGi2TZShWrat86jixRoKOtL//mLuL/ZnulCc6c0xlF2uzNPV+oyW8JqV/TCDg6np4DKK/08Bae6h/LsANWhRsLOMBML/HSYLdGIoSH9tz1KMyU7X6mquFFvmDK/17rIJ95Ux6Qrg6GmYR0g0bZ+1oc8Ye4xZn1k7vtBcw6MRp4sySfpB13DY135bsjPQq4sPg81Cs9WUJFnUO;20:FM4o1zN/yir697Mx2qYKsRc2cMqLXV5ps5YPq+uiG0v2grhA5mClkzRDXJiUz0NC9hXGHJACK/GWQda+LtNQkMMKskhbQYWylIxG5w+6S16G6pxiYqx3NW9ePMZ3BgFUq857PuJ/ZIbUJDk8IWzUKTs8XyjbL1WK92/AoexzyS0= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 66d926fd-0f5d-4dfc-ce88-08d58db0a984 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(39380400002)(189003)(199004)(86612001)(316002)(26005)(72206003)(4326008)(25786009)(110136005)(10290500003)(86362001)(54906003)(53936002)(36756003)(107886003)(3280700002)(14454004)(22452003)(6506007)(5660300001)(68736007)(99286004)(186003)(478600001)(76176011)(2950100002)(10090500001)(102836004)(6116002)(5250100002)(2501003)(97736004)(3660700001)(106356001)(81156014)(81166006)(8676002)(8936002)(7736002)(305945005)(2900100001)(105586002)(3846002)(1076002)(66066001)(6436002)(2906002)(6512007)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: YlfhaepwWeF7LFOeJpS30Uzsu4moNqj1PQVR0GdNeMazHQtprs0oNj1nqlZ8SwAom3/l/c2hcBIrSQnHXdNHowVO+ysLIE37OLXsKqDJbgUa3bcGIzr4d7UCD6tJns71q1bcF2sj1a5EgOsRO6rqpNxHAgyf0V134QtwYOJatRKzU3rxqJWr7uywvWp9D3qt1Hwxz5ruuDGodF5oqheq+uHiE2Qz3UQ2DjudqFuDxzqug8LZZ3yk6DQ9/31Y7Me1pmx9NuLiakMVOPzE+x9L+g+czCr4aKrKZEidT7MM5/2HsqfB5zby24ZWCdZUvdEUy5IHmeS9DFAQh4fwExQTyQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66d926fd-0f5d-4dfc-ce88-08d58db0a984 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:03.8585 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/ipv6/ip6_output.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 3763dc01e374..0f874b48c1b5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -138,6 +138,14 @@ static int ip6_finish_output(struct net *net, struct s= ock *sk, struct sk_buff *s return ret; } =20 +#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) + /* Policy lookup after SNAT yielded a new policy */ + if (skb_dst(skb)->xfrm) { + IPCB(skb)->flags |=3D 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)) --=20 2.14.1