On 6/18/19 7:20 AM, Stefano Brivio wrote: > The following patches add back the ability to dump IPv4 and IPv6 exception > routes, and we need to allow selection of regular routes or exceptions. > > Use RTM_F_CLONED as filter to decide whether to dump routes or exceptions: > iproute2 passes it in dump requests (except for IPv6 cache flush requests, > this will be fixed in iproute2) and this used to work as long as > exceptions were stored directly in the FIB, for both IPv4 and IPv6. > > Caveat: if strict checking is not requested (that is, if the dump request > doesn't go through ip_valid_fib_dump_req()), we can't filter on protocol, > tables or route types. > > In this case, filtering on RTM_F_CLONED would be inconsistent: we would > fix 'ip route list cache' by returning exception routes and at the same > time introduce another bug in case another selector is present, e.g. on > 'ip route list cache table main' we would return all exception routes, > without filtering on tables. > > Keep this consistent by applying no filters at all, and dumping both > routes and exceptions, if strict checking is not requested. iproute2 > currently filters results anyway, and no unwanted results will be > presented to the user. The kernel will just dump more data than needed. > > v5: New patch: add dump_routes and dump_exceptions flags in filter and > simply clear the unwanted one if strict checking is enabled, don't > ignore NLM_F_MATCH and don't set filter_set if NLM_F_MATCH is set. > Skip filtering altogether if no strict checking is requested: > selecting routes or exceptions only would be inconsistent with the > fact we can't filter on tables. > > Suggested-by: David Ahern <dsah...@gmail.com> > Signed-off-by: Stefano Brivio <sbri...@redhat.com> > --- > include/net/ip_fib.h | 2 ++ > net/ipv4/fib_frontend.c | 8 +++++++- > net/ipv6/ip6_fib.c | 3 ++- > 3 files changed, 11 insertions(+), 2 deletions(-) >
Reviewed-by: David Ahern <dsah...@gmail.com>