On Mon, 10 Jun 2019 15:31:37 -0600 David Ahern <dsah...@gmail.com> wrote:
> On 6/8/19 12:12 PM, Stefano Brivio wrote: > > To avoid dumping exceptions if not requested, we can, in the future, add > > support for NLM_F_MATCH as described by RFC 3549. This would also require > > some changes in iproute2: whenever a 'cache' argument is given, > > RTM_F_CLONED should be set in the dump request and, when filtering in the > > kernel is desired, NLM_F_MATCH should be also passed. We can then signal > > filtering with the NLM_F_DUMP_FILTERED whenever a NLM_F_MATCH flag caused > > it. > > NLM_F_MATCH is set today. iproute2 for example uses NLM_F_DUMP for dump > requests and NLM_F_DUMP is defined as: > > #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) > > further, the kernel already supports kernel side filtering now for > routes. See ip_valid_fib_dump_req. Indeed, we don't have to add much: just make this work for IPv4 too, honour NLM_F_MATCH, and skip filtering (further optimisation) on NLM_F_DUMP_FILTERED in iproute2 (ip neigh already uses that). -- Stefano