Index | Thread | Search

From:
Lucas Gabriel Vuotto <lucas@sexy.is>
Subject:
sysctl.2: NET_RT_DUMP uses the current rtable
To:
tech@openbsd.org
Date:
Wed, 9 Oct 2024 16:47:46 +0000

Download raw body.

Thread
I got confused by the manpage, as it states that rtable 0 is used. My
understanding of /sys/net/rtsock.c:sysctl_rtable is that the current
rtable is used instead:

  2187		if (namelen == 4) {
  2188			tableid = name[3];
  2189			if (!rtable_exists(tableid))
  2190				return (ENOENT);
  2191		} else
  2192			tableid = curproc->p_p->ps_rtableid;

The misunderstanding prompted me to hunt for NET_RT_DUMP usage in ports
and prepare useless patches for 7 ports. :')

	Lucas


diff /usr/src
commit - 352e6c5d7c95cf0c08d3c38de0fb23cb51af1fce
path + /usr/src
blob - 78c69ff581350ca2587f400bd58916a6dbfd0d16
file + lib/libc/sys/sysctl.2
--- lib/libc/sys/sysctl.2
+++ lib/libc/sys/sysctl.2
@@ -1322,7 +1322,7 @@ priority value.
 .Pp
 An optional seventh level name can be provided to select the routing table
 on which to run the operation.
-If not provided, the table with ID 0 is used.
+If not provided, the current routing table is used.
 .It Dv PF_INET
 Get or set various global information about IPv4
 .Pq Internet Protocol version 4 .