Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp716440imj; Wed, 13 Feb 2019 16:23:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IavLXdcX32Ij055QL3Ka9DRvo9TrUoQOuMVkGT5z/LaRiOKg6LYnpsB/foy3ZQhNvjotrsx X-Received: by 2002:a62:170b:: with SMTP id 11mr948944pfx.47.1550103827975; Wed, 13 Feb 2019 16:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103827; cv=none; d=google.com; s=arc-20160816; b=ADwPc62mFUnRZ2d97lWG3EAFiIqzexqvxC3Ov3WY7q1VVnPgm39XxhwqQ+ZYEWDHAj vokS+q25bx95GNNqFt2xVMi76hcv3h4+Eu5WTlf65vvRu1tGSYl30jv2HikKuEM9uAQS ZikSdfxtM6eaBAXxciHm92amSLdR9IHffzeTp6+HhNbywUMlKmxzAxLHfieHmge0PLSN vKGACXXRUX5rhTF/l60Psh05cmvgCYxm1P4npNAtLbZbJbuWwuhzAl/DkD72klCTzkkw IpyGvWy88hag2JGQb/ntxpN13cQWEA01Cl2wvVeqM8Am4Wj3PNr8UwcujbRTUmtSVMpo QcRA== 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=DMncy8WbiDlGoPrTl31nmfRGLKlfLBA2FI6q3b6CUw4=; b=O251kZJGefLjAzb/dF8QsEZctiV3IMNOjOCCLCx8fS86EJMFyyCQmSg6vVW0MOAJyG K5RCYLYOhYBWPuMXWFoPAAjDTkM0XFkI4yq3CeXV6Qrl+6rxgh/Mxts+MUzqTlM/z043 RX206/G7FihWeQ8PYVeoE78VuUB/BfoxKtSxUp63aUyua9C11zLIgwV2fzHXZ71mqzr5 ygF+STKKNYiYGST2KEqxzwfe5/oKxwWdGvrItjdL+O6bcNFmN2YpBEEB6gDxFSFbCOxd W6lFXz0AmfYa1rLQELNuyL+A6jxUiMad7mT3ZpfpQBDTq5vHoSu9Gn+FB7mrBDzYZjdU ZaHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Khg7uGr9; 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 d2si759187pfe.159.2019.02.13.16.23.32; Wed, 13 Feb 2019 16:23:47 -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=Khg7uGr9; 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 S1730555AbfBMSur (ORCPT + 99 others); Wed, 13 Feb 2019 13:50:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:42634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406007AbfBMSoC (ORCPT ); Wed, 13 Feb 2019 13:44:02 -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 8929220675; Wed, 13 Feb 2019 18:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083441; bh=UroE3V9aw2KQMUVGiwkqHsyvoOPGrnNEPJ5OPltkrbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Khg7uGr9how4aMIY/IUpKL0S9qhKWArbN8V6MXFAq4oc3lPbc7qaIJEViRwUot0WU ypcIaKlPvPI2BlFLsPkAxgQAVro9NnEOdqgf49wq8Pnu0aMLRYMK9+7/83puSVcRG2 4SSJSruuhzlVabv5vfWTkLWN9dyBDANqmeV2MWHc= 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.19 37/44] xfrm: Make set-mark default behavior backward compatible Date: Wed, 13 Feb 2019 19:38:38 +0100 Message-Id: <20190213183654.904785611@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183651.648060257@linuxfoundation.org> References: <20190213183651.648060257@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.19-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,