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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 53E0EC04AB5 for ; Thu, 6 Jun 2019 22:17:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 246CB206BB for ; Thu, 6 Jun 2019 22:17:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729086AbfFFWRz (ORCPT ); Thu, 6 Jun 2019 18:17:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43848 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbfFFWRz (ORCPT ); Thu, 6 Jun 2019 18:17:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E59C390B93; Thu, 6 Jun 2019 22:17:54 +0000 (UTC) Received: from localhost (ovpn-112-18.ams2.redhat.com [10.36.112.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A42627E68A; Thu, 6 Jun 2019 22:17:52 +0000 (UTC) Date: Fri, 7 Jun 2019 00:17:47 +0200 From: Stefano Brivio To: Martin Lau Cc: David Miller , Jianlin Shi , "Wei Wang" , David Ahern , Eric Dumazet , "netdev@vger.kernel.org" Subject: Re: [PATCH net 1/2] ipv6: Dump route exceptions too in rt6_dump_route() Message-ID: <20190607001747.4ced02c7@redhat.com> In-Reply-To: <20190606214456.orxy6274xryxyfww@kafai-mbp.dhcp.thefacebook.com> References: <085ce9fbe0206be0d1d090b36e656aa89cef3d98.1559851514.git.sbrivio@redhat.com> <20190606214456.orxy6274xryxyfww@kafai-mbp.dhcp.thefacebook.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 06 Jun 2019 22:17:55 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 6 Jun 2019 21:44:58 +0000 Martin Lau wrote: > > + if (!(filter->flags & RTM_F_CLONED)) { > > + err = rt6_fill_node(net, arg->skb, rt, NULL, NULL, NULL, 0, > > + RTM_NEWROUTE, > > + NETLINK_CB(arg->cb->skb).portid, > > + arg->cb->nlh->nlmsg_seq, flags); > > + if (err) > > + return err; > > + } else { > > + flags |= NLM_F_DUMP_FILTERED; > > + } > > + > > + bucket = rcu_dereference(rt->rt6i_exception_bucket); > > + if (!bucket) > > + return 0; > > + > > + for (i = 0; i < FIB6_EXCEPTION_BUCKET_SIZE; i++) { > > + hlist_for_each_entry(rt6_ex, &bucket->chain, hlist) { > > + if (rt6_check_expired(rt6_ex->rt6i)) > > + continue; > > + > > + err = rt6_fill_node(net, arg->skb, rt, > > + &rt6_ex->rt6i->dst, > > + NULL, NULL, 0, RTM_NEWROUTE, > > + NETLINK_CB(arg->cb->skb).portid, > > + arg->cb->nlh->nlmsg_seq, flags); > Thanks for the patch. > > A question on when rt6_fill_node() returns -EMSGSIZE while dumping the > exception bucket here. Where will the next inet6_dump_fib() start? And thanks for reviewing. It starts again from the same node, see fib6_dump_node(): w->leaf = rt; where rt is the fib6_info where we failed dumping, so we won't skip dumping any node. This also means that to avoid sending duplicates in the case where at least one rt6_fill_node() call goes through and one fails, we would need to track the last bucket and entry sent, or, alternatively, to make sure we can fit the whole node before dumping. I don't think that can happen in practice, or at least I haven't found a way to create enough valid exceptions for the same node. Anyway, I guess that would be nicer, but the fix is going to be much bigger, and I don't think we even have to guarantee that. I'd rather take care of that as a follow-up. Any preferred solution by the way? -- Stefano