On Wed, Jun 10, 2020 at 11:47:49PM +0200, Sebastian Benoit wrote: > Remi Locherer([email protected]) on 2020.06.10 22:16:36 +0200: > > On Tue, Jun 09, 2020 at 10:02:06AM +0200, Remi Locherer wrote: > > > On Tue, Jun 09, 2020 at 09:17:31AM +0200, Claudio Jeker wrote: > > > > On Tue, Jun 09, 2020 at 08:44:42AM +0200, Remi Locherer wrote: > > > > > On Mon, Jun 08, 2020 at 10:10:17PM +0200, Remi Locherer wrote: > > > > > > Hi, > > > > > > > > > > > > to my knowledge there is no easy way to list all active rdomains or > > > > > > routing tables. Other platforms have "show vrf" or similar commands > > > > > > for an overview. > > > > > > > > > > > > Here is my attempt at such a view for OpenBSD: > > > > > > > > > > Updated diff with small changes: > > > > > - Print inet instead of Internet (input deraadt) > > > > > - Removed padding before rdomain id. > > > > > - Changed man page wording. > > > > > > > > > > twister ..in/netstat$ obj/netstat -R > > > > > Rdomain 0 > > > > > Interfaces: lo0 iwm0 re0 enc0 pflog0 mpe0 > > > > > Routing tables: > > > > > 0: inet 8, inet6 45, mpls 1 > > > > > 3: inet 1, inet6 0, mpls 0 > > > > > 7: inet 130309, inet6 10000, mpls 0 > > > > > > > > > > Rdomain 77 > > > > > Interfaces: vether77 lo77 > > > > > Routing tables: > > > > > 77: inet 0, inet6 0, mpls 0 > > > > > > > > > > Rdomain 122 > > > > > Interfaces: vether122 lo122 pair122 vether1122 vether1123 > > > > > vether1124 vether1125 vether1126 vether1127 > > > > > Routing tables: > > > > > 122: inet 24, inet6 0, mpls 0 > > > > > > > > > > Rdomain 255 > > > > > Interfaces: vether255 lo255 > > > > > Routing tables: > > > > > 255: inet 3, inet6 0, mpls 0 > > > > > > > > > > twister ..in/netstat$ > > > > > > > > > > OK? > > > > > > > > Why do you think the route counts are needed? You fetch all routing > > > > tables > > > > to count them in userland. The sysctl for doing that is expensive and > > > > especially on systems with full tables will make this command slow. > > > > If this is something we really want then the kernel should track and > > > > provide the count. > > > > > > These counters are of interest for operators. But I agree that counting > > > the routes in userland is unfortunate. But I don't know how bad it is. > > > Is a lock involved in the kernel when dumping the full table? > > > > I did some homework and figured out, that dumping a routing table takes the > > NET_LOCK. So it's not just inefficient counting all routes in userland it > > might have a negative impact on the system. > > > > Below my new proposal without the counters. I still think it would be good > > to have those counters. Maybe I'll try to find a solution for that. > > Maybe sysctl NET_RT_STATS and struct rtstat could be expanded to cover this?
I also looked at that. If I understand sysctl_rtable_rstat() correct then it is not per table but for all of them. I guess I can change that. ;-)
