On 2024-06-24, Tom Smyth <[email protected]> wrote:
> Folks,
> while  reviewing  nsh  I was wondering how to improve show route commands...
> reviewing the man route man page,
>
> there doesnt seem to be a  straight forward way of displaying
> blackhole routes without using
>
> route show |grep B for blackhole
>
> route show |grep R for Reject
>
> is there something Im missing,
>
> would I be better off improving route(8) rather than stringing
> commands together for NSH ?

It's not an efficient operation in the first place; kernel lookup is
done with the address/prefix as a key and the flags (B/R etc) are only
found once you've fetched a route (similar if you wanted to e.g. find
routes with a specific destination router).

In order to find all routes with a certain flag you do need to dump
the whole route table and check it.

It could be done slightly more efficiently with a check for the
relevant flag rather than going via a text processing tool like grep,
but I bet the actual overall time isn't going to be very different...



Reply via email to