Thanks Stuart, Ill take a look at how the prefix searches are done ... and see if I can re-use that for route(8) if people think that it would be useful to have in route(8) Thanks again,
Tom Smyth On Tue, 25 Jun 2024 at 09:39, Stuart Henderson <[email protected]> wrote: > > 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... > > > -- Kindest regards, Tom Smyth.

