Multiple rtables may exist in the default rdomain (0), that is their
corresponding rdomains/lo(4) interfaces do not have to exist.

This demonstrates it;  first, nothing but default, so route(8) fails:

        # netstat -R
        Rdomain 0
          Interfaces: lo0 vio0 enc0
          Routing table: 0

        # route -T1 exec id -R
        route: routing table 1: No such file or directory

Then create an rdomain and with it an rtable:

        # ifconfig lo1 rdomain 1
        # netstat -R
        Rdomain 0
          Interfaces: lo0 vio0 enc0
          Routing table: 0

        Rdomain 1
          Interface: lo1
          Routing table: 1

This makes route(8) work, but it keeps working when we remove the
rdomain again since the rtable persits:

        # route -T1 exec id -R
        1
        # ifconfig lo1 destroy
        # netstat -R
        Rdomain 0
          Interfaces: lo0 vio0 enc0
          Routing tables: 0 1

        # route -T1 exec id -R
        1


I'm not sure yet, whether this is intentional or in fact a bug.
Either ways, the manual should be fixed - route(8)'s synopsis says the
same, just like ping(8)'s `-V rtable':

        $ man -hs8 route
        route [-dnqtv] [-T rtable] command [[modifiers] args]

Feedback? Objections? OK?


Index: share/man/man4/rdomain.4
===================================================================
RCS file: /cvs/src/share/man/man4/rdomain.4,v
retrieving revision 1.13
diff -u -p -r1.13 rdomain.4
--- share/man/man4/rdomain.4    1 Feb 2020 15:00:20 -0000       1.13
+++ share/man/man4/rdomain.4    30 Jul 2020 01:56:39 -0000
@@ -98,7 +98,7 @@ Put em0 and lo4 in rdomain 4:
 # ifconfig em0 192.0.2.100/24
 .Ed
 .Pp
-Set a default route and localhost reject route within rdomain 4:
+Set a default route and localhost reject route within rtable 4:
 .Bd -literal -offset indent
 # route -T4 -qn add -net 127 127.0.0.1 -reject
 # route -T4 -n add default 192.0.2.1
@@ -106,7 +106,7 @@ Set a default route and localhost reject
 .Pp
 Start
 .Xr sshd 8
-in rdomain 4:
+in rtable 4:
 .Pp
 .Dl # route -T4 exec /usr/sbin/sshd
 .Pp

Reply via email to