Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp737743ybc; Sat, 16 Nov 2019 07:50:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwFnAcOMTAX749KOU/mLCjw+MjMBmjuDsN+54Edw6Kv+ZxXCRfYSmZog+hYcrfYjoRURzcm X-Received: by 2002:a17:906:4bcb:: with SMTP id x11mr10998662ejv.100.1573919429700; Sat, 16 Nov 2019 07:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919429; cv=none; d=google.com; s=arc-20160816; b=CmcVllT/m56/vMWa5LhVhgt+ix9F25c+2Wv0/bmhrqylgJ+OKz13OARd8GmAmRJpGc hagLFJwhuHvvGfCESPtiheVeD+r3R2hF4jedSQUWxz5wKtDQhcoB7+OZXEtGcbJd8nxf 3J7UEz5DKnbUPR1zSYlToRMAUEwxxWXpTwAmaKUiWVeFy+VUL+GNYM04ZwG138917/3S g4SY3Nr2seNfl4mBbmf+lmp2LR8U4EOYsQ4KrNhAi1m1TGudBrsHcnXxfYEr7AWKSYDF mfTA4jM72yIZK+cfBRAHRXJdu/QlOG+Fm9HkwZ89mQ641WIjd/SPEFpD7nZ2bpAX+fw9 o2bQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ITgLNAMhFi9tuyrWeJsUDKYiTdvpTXGAIcFrzxyhtX8=; b=sQiobQSffv8v5hZPZILZcHKGwJFyOJTLr4zN1c4qvev1RgapZdhvlkrgibSCbOJHHg XyBS4BmoOMILfz7TWp/WOjI9s5mWVG/rpd2h2QbaDr6D0lSFrnaeyfXes1ooM2Rq/nlY z8UtI6YU1TA8purwfVa4Ia3BZyhvZKlhsGA9nUCYUsTObK/4j6s9XxJl0ewvhC04gofA DbbCtBfdqBIcut9oSMKGDOp+CQWbYdOv4BG8xGFlmsFosqATFq6ew+XwGZ0ZTZKk6U58 LaChJjmMERBagDqQLZ0S1JhsfHQXHeCTh0HiaKtlTox/qr0mOVtmT7gUU0MWDLh1EgjV h59A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L1vuHA5i; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si9730713edm.399.2019.11.16.07.50.05; Sat, 16 Nov 2019 07:50:29 -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=L1vuHA5i; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729822AbfKPPrt (ORCPT + 99 others); Sat, 16 Nov 2019 10:47:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:53854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728873AbfKPPrL (ORCPT ); Sat, 16 Nov 2019 10:47:11 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DB672084F; Sat, 16 Nov 2019 15:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919231; bh=AiDrupa0ElEL9BkwztZdJMc2ifNPMRDNGjY+TvtGWtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1vuHA5iGl2VusWw1xB2iY7A6eR7ZR5Jt7GQNm9jwmvwg8z+jRdHQW23oyTkECq9i 6B5KVnBrejixsfqFlmCTG9OlSOT5wEGVnRIvY5vBf3weIEd7oof1ri8Jskm3wqciZQ NqkDxMVePrNWM7BkkEuVmI57DH0DbR7bYR8vMIDM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Ahern , Donald Sharp , Mike Manning , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 236/237] ipv6: Fix handling of LLA with VRF and sockets bound to VRF Date: Sat, 16 Nov 2019 10:41:11 -0500 Message-Id: <20191116154113.7417-236-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Ahern [ Upstream commit c2027d1e17582903e368abf5d4838b22a98f2b7b ] A recent commit allows sockets bound to a VRF to receive ipv6 link local packets. However, it only works for UDP and worse TCP connection attempts to the LLA with the only listener bound to the VRF just hang where as before the client gets a reset and connection refused. Fix by adjusting ir_iif for LL addresses and packets received through a device enslaved to a VRF. Fixes: 6f12fa775530 ("vrf: mark skb for multicast or link-local as enslaved to VRF") Reported-by: Donald Sharp Cc: Mike Manning Signed-off-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/tcp_ipv6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index e7cdfa92c3820..9a117a79af659 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -734,6 +734,7 @@ static void tcp_v6_init_req(struct request_sock *req, const struct sock *sk_listener, struct sk_buff *skb) { + bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags); struct inet_request_sock *ireq = inet_rsk(req); const struct ipv6_pinfo *np = inet6_sk(sk_listener); @@ -741,7 +742,7 @@ static void tcp_v6_init_req(struct request_sock *req, ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; /* So that link locals have meaning */ - if (!sk_listener->sk_bound_dev_if && + if ((!sk_listener->sk_bound_dev_if || l3_slave) && ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL) ireq->ir_iif = tcp_v6_iif(skb); -- 2.20.1