Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp713397imj; Wed, 13 Feb 2019 16:19:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZyAoPs5ArZXPlu4kDZ7helapgcPhUfMfyDth1O9mbR4EcGYK4HgbAcuuDQqJL62mbag+an X-Received: by 2002:aa7:8286:: with SMTP id s6mr934685pfm.63.1550103573988; Wed, 13 Feb 2019 16:19:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103573; cv=none; d=google.com; s=arc-20160816; b=mPCw7GTHi10BmRybH9J50XKLSxpVXauaTmH7SgxAQpfhb5RNpxC/Iat8M72Q4qNdj5 QupcWExSqqTLPUSR/6aZKe1FaKztECJhEphuEEBHKcInoKddARkQETzrersszXI1OGgS AmhydxhbBX+K0qfQC40aFutvmk4MERLFjhsgXFNilsu6hGDlH9Apf3pMGaK1CD6AxQVB ustTDrl0mxJwVP0AdTFVZjOa7FgC7TcggE4kHz1BB08hW9ieJm8tkuLGU3za1eVN8sVw YibDL+uVF5EplsFoN/OCnyg4z6MTP0y1fHUYDjszX4C2paNY7EtgLVlK3Is8dHDB5puA Fd4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m1gbE41Sq/NPoLSL8ZC/paOJnirvv9wQiOBppZjmksE=; b=zv+KoKl+yiu9p9zEG4VaPrKhvRfLponpnnEvgJysj465FnwMpkr+C5N8qbiaS29A1o wVq4VgJ7aho/XDyZ+bLDcAa+kl/uD/3pWTnpisMaeuJfQwKFtD4Sxli0MVez7CQnyMnR lUNRcT1w09gLYMRJIGoKIC07EXlVjJYTrO6xfahePIFXjHHQTvTVAa9Ge1Y/XhFIeD6n mcprHHX+KuKWpkS7lN7jg/qKqtm/QSZA69hhmiwAatrqPTI7wnKKDGQA69dhxXe6kDPX Z2qs/Cwz90i+OLS3m1BcWZ4p4Moo8CixkcpLkr7MR86m8jo8orXc5We1bPAzNBxhW4XL DVlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MVL25ECv; 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 r12si777344pgl.350.2019.02.13.16.19.18; Wed, 13 Feb 2019 16:19:33 -0800 (PST) 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=@kernel.org header.s=default header.b=MVL25ECv; 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 S2406536AbfBMSqu (ORCPT + 99 others); Wed, 13 Feb 2019 13:46:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:45184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406486AbfBMSqi (ORCPT ); Wed, 13 Feb 2019 13:46:38 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2ED8F20811; Wed, 13 Feb 2019 18:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083597; bh=gzVnmnmzdM/kzCjwvKbx+hK6zO61rF2m5sxJBh30GcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVL25ECvrJVOVDO1Gexl5W0ArVi2w+HudoeWlGMJssRQk8QsCSEhzpDnFA6ENzykc WXzbGo53GpGYvmM8CknF9LxNqIUExvUBZKA1UW9v1M0Gg85GYFvBNouq4Mpbn7PmML AxpSbcawKOimUBYAeuUGPCRa4YS8+GkmgHTjfwPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benedict Wong , Steffen Klassert Subject: [PATCH 4.20 44/50] xfrm: Make set-mark default behavior backward compatible Date: Wed, 13 Feb 2019 19:38:49 +0100 Message-Id: <20190213183659.167323266@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benedict Wong commit e2612cd496e7b465711d219ea6118893d7253f52 upstream. Fixes 9b42c1f179a6, which changed the default route lookup behavior for tunnel mode SAs in the outbound direction to use the skb mark, whereas previously mark=0 was used if the output mark was unspecified. In mark-based routing schemes such as Android’s, this change in default behavior causes routing loops or lookup failures. This patch restores the default behavior of using a 0 mark while still incorporating the skb mark if the SET_MARK (and SET_MARK_MASK) is specified. Tested with additions to Android's kernel unit test suite: https://android-review.googlesource.com/c/kernel/tests/+/860150 Fixes: 9b42c1f179a6 ("xfrm: Extend the output_mark to support input direction and masking") Signed-off-by: Benedict Wong Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_policy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1628,7 +1628,10 @@ static struct dst_entry *xfrm_bundle_cre dst_copy_metrics(dst1, dst); if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { - __u32 mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); + __u32 mark = 0; + + if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) + mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); family = xfrm[i]->props.family; dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif,