From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D8D3C2BCA1 for ; Fri, 7 Jun 2019 23:06:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A7342168B for ; Fri, 7 Jun 2019 23:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559948780; bh=f4AkjFOIn0Gip+XazVZg69WWKUhXLR5+twcGRrKeoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CvdHGdMxT32SBEa9RLD1lNBUhZ0NmLX/dG+FZ1tnkDUk+rnoGtDLf3OZqhHTyJNEs NtDUhJU6NiT9Sb5cSnxvE8aiHdU13cAAavlN32xWIY8Me+9/xPnp3b0yG+YQSdZXqJ XggOzfflMPWvAMu3FovRvfFTgA9NKBkFjyK1nqrw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731459AbfFGXGT (ORCPT ); Fri, 7 Jun 2019 19:06:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:43842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730998AbfFGXGP (ORCPT ); Fri, 7 Jun 2019 19:06:15 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (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 5B015214AF; Fri, 7 Jun 2019 23:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559948774; bh=f4AkjFOIn0Gip+XazVZg69WWKUhXLR5+twcGRrKeoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QY9m1Ul4shwJdOrKa+vSes+MtqHpV8CyCzjk0Fb19zpN26jnDpvfoAH4Eud2nUtPa wtdGgczeQI9SAVpmcSJ4NPJnzpDeH6J1xSKgfIALE4Nf+sIU7IC+Jvzrqystx0kHTY ucwNbCPf2xQ0nSPy5H7lbdOnLGcFWdgWWd0C++x4= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, kafai@fb.com, weiwan@google.com, sbrivio@redhat.com, David Ahern Subject: [PATCH v3 net-next 10/20] ipv6: Handle all fib6_nh in a nexthop in mtu updates Date: Fri, 7 Jun 2019 16:06:00 -0700 Message-Id: <20190607230610.10349-11-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190607230610.10349-1-dsahern@kernel.org> References: <20190607230610.10349-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Use nexthop_for_each_fib6_nh to call fib6_nh_mtu_change for each fib6_nh in a nexthop for rt6_mtu_change_route. For __ip6_rt_update_pmtu, we need to find the nexthop that correlates to the device and gateway in the rt6_info. Signed-off-by: David Ahern --- net/ipv6/route.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1c6cff699a76..52ecd1ffde7e 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2683,10 +2683,31 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk, rcu_read_unlock(); return; } - res.nh = res.f6i->fib6_nh; res.fib6_flags = res.f6i->fib6_flags; res.fib6_type = res.f6i->fib6_type; + if (res.f6i->nh) { + struct fib6_nh_match_arg arg = { + .dev = dst->dev, + .gw = &rt6->rt6i_gateway, + }; + + nexthop_for_each_fib6_nh(res.f6i->nh, + fib6_nh_find_match, &arg); + + /* fib6_info uses a nexthop that does not have fib6_nh + * using the dst->dev + gw. Should be impossible. + */ + if (!arg.match) { + rcu_read_unlock(); + return; + } + + res.nh = arg.match; + } else { + res.nh = res.f6i->fib6_nh; + } + nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr); if (nrt6) { rt6_do_update_pmtu(nrt6, mtu); @@ -4654,6 +4675,12 @@ static int rt6_mtu_change_route(struct fib6_info *f6i, void *p_arg) return 0; arg->f6i = f6i; + if (f6i->nh) { + /* fib6_nh_mtu_change only returns 0, so this is safe */ + return nexthop_for_each_fib6_nh(f6i->nh, fib6_nh_mtu_change, + arg); + } + return fib6_nh_mtu_change(f6i->fib6_nh, arg); } -- 2.11.0