Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1425030imm; Thu, 5 Jul 2018 23:11:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdIuJoq89pL3rDX8A9FswKLPvpIT6UWFFZFWrE4QCSOaC78kAiYOQoh1D4xSR3Eh0XkEFFT X-Received: by 2002:a63:9b19:: with SMTP id r25-v6mr7989407pgd.197.1530857510673; Thu, 05 Jul 2018 23:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857510; cv=none; d=google.com; s=arc-20160816; b=wFGFpOXJbBFEU1xBMjKDred17r2/WYwe2FWvf1kUA0/469ZLdklXn5N10JBKqmsAPB So+JgAeFpAh55vwUPhtSf30FSLnhyhGiVi8xbig3OrX6MUYSU230vKanDXysJGFm4iTa yqsUlSrbajDbKOFqHNVY1O7Bx7nt/0Z/U3EtA8JjYodGxYISTYM+aLzQvkWd/JlFSkeA RIjfw/hBOo2bz6JT4FfjL/v3Gep/GBauHd1ZLdoNt9vck04jlKcIOkQmYXbf3jhmG4Bq G4veDFvYIEaCd5GCQJWSrTpF4eMQUSwVw3aV0XrcejtOeWwUw9rKMJb14XHQbnz8DlXt pa2w== 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=u0m9a2tMO7lzIsHMaHUwoKzIRiMNbnrzJ4GVSAIYS8k=; b=G3ejIKUXrfrJ2u/Xm87J74ppElEA5FLEDfQfWwuwaunT568JTf//wk05yVCbXltfDO VWT/BPLHEMjYv3qi7haSPNLY8USbB8zH3JSiNxjWBdwm/s+CB+5VqpqYb+aMp7qdYsQ1 8vPDf7AmzuH2jGi/ekBMiK8ZeKI84wIsjpoqnEDGvLJCA9S8pnyrbfKYexlx2tg2Jxy+ HYtSNmsRkeeKU5yDxE6zy7kV/hhYwNxEhu0uCFHVj2+KIKu8GHITNa6ED5/Mar85/QnT Hw8Yzd7241dp/igONUaYGJb7ZMfhRJ6n2/QVQi1Cv8H/zvmJJq1T0iqn/Fhk8o1f8FkA pqVQ== 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 t85-v6si8060092pfj.231.2018.07.05.23.11.35; Thu, 05 Jul 2018 23:11:50 -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 S933390AbeGFFtG (ORCPT + 99 others); Fri, 6 Jul 2018 01:49:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60190 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932439AbeGFFtE (ORCPT ); Fri, 6 Jul 2018 01:49:04 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 47352BD8; Fri, 6 Jul 2018 05:49:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Bernat , Pablo Neira Ayuso Subject: [PATCH 4.17 41/46] netfilter: ip6t_rpfilter: provide input interface for route lookup Date: Fri, 6 Jul 2018 07:47:02 +0200 Message-Id: <20180706054526.554686187@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@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.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vincent Bernat commit cede24d1b21d68d84ac5a36c44f7d37daadcc258 upstream. In commit 47b7e7f82802, this bit was removed at the same time the RT6_LOOKUP_F_IFACE flag was removed. However, it is needed when link-local addresses are used, which is a very common case: when packets are routed, neighbor solicitations are done using link-local addresses. For example, the following neighbor solicitation is not matched by "-m rpfilter": IP6 fe80::5254:33ff:fe00:1 > ff02::1:ff00:3: ICMP6, neighbor solicitation, who has 2001:db8::5254:33ff:fe00:3, length 32 Commit 47b7e7f82802 doesn't quite explain why we shouldn't use RT6_LOOKUP_F_IFACE in the rpfilter case. I suppose the interface check later in the function would make it redundant. However, the remaining of the routing code is using RT6_LOOKUP_F_IFACE when there is no source address (which matches rpfilter's case with a non-unicast destination, like with neighbor solicitation). Signed-off-by: Vincent Bernat Fixes: 47b7e7f82802 ("netfilter: don't set F_IFACE on ipv6 fib lookups") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/ipv6/netfilter/ip6t_rpfilter.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ipv6/netfilter/ip6t_rpfilter.c +++ b/net/ipv6/netfilter/ip6t_rpfilter.c @@ -48,6 +48,8 @@ static bool rpfilter_lookup_reverse6(str } fl6.flowi6_mark = flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; + if ((flags & XT_RPFILTER_LOOSE) == 0) + fl6.flowi6_oif = dev->ifindex; rt = (void *)ip6_route_lookup(net, &fl6, skb, lookup_flags); if (rt->dst.error)