Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
hide struct router_info
To:
tech@openbsd.org
Date:
Tue, 11 Nov 2025 12:33:34 +0100

Download raw body.

Thread
Hi,

struct router_info is only used in netinet/igmp.c.  Remove it from
netinet/in_var.h header to avoid global visibility.  Also sort
pointer before integer fields in struct.

Release build was successful.

ok?

bluhm

Index: netinet/igmp.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/igmp.c,v
diff -u -p -r1.88 igmp.c
--- netinet/igmp.c	8 Jul 2025 00:47:41 -0000	1.88
+++ netinet/igmp.c	11 Nov 2025 09:53:09 -0000
@@ -94,6 +94,16 @@
 
 #define IP_MULTICASTOPTS	0
 
+/*
+ * Per-interface router version information.
+ */
+struct router_info {
+	LIST_ENTRY(router_info)	rti_list;
+	unsigned int	rti_ifidx;
+	int		rti_type;	/* type of router on this interface */
+	int		rti_age;	/* time since last v1 query */
+};
+
 int	igmp_timers_are_running;	/* [a] shortcut for fast timer */
 static LIST_HEAD(, router_info) rti_head;
 static struct mbuf *router_alert;
Index: netinet/in_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_var.h,v
diff -u -p -r1.41 in_var.h
--- netinet/in_var.h	18 Oct 2018 15:23:04 -0000	1.41
+++ netinet/in_var.h	11 Nov 2025 09:54:17 -0000
@@ -75,8 +75,7 @@ struct	in_aliasreq {
 	struct	sockaddr_in ifra_mask;
 };
 
-
-#ifdef	_KERNEL
+#ifdef _KERNEL
 /*
  * Macro for finding the internet address structure (in_ifaddr) corresponding
  * to a given interface (ifnet structure).
@@ -93,19 +92,9 @@ do {									\
 	}								\
 	(ia) = ifatoia(ifa);						\
 } while (/* CONSTCOND */ 0)
-#endif
 
-/*
- * Per-interface router version information.
- */
-struct router_info {
-	unsigned int	rti_ifidx;
-	int		rti_type;	/* type of router on this interface */
-	int		rti_age;	/* time since last v1 query */
-	LIST_ENTRY(router_info)	rti_list;
-};
+struct router_info;
 
-#ifdef _KERNEL
 /*
  * Internet multicast address structure.  There is one of these for each IP
  * multicast group to which this host belongs on a given network interface.
@@ -161,6 +150,6 @@ void	in_ifscrub(struct ifnet *, struct i
 int	in_control(struct socket *, u_long, caddr_t, struct ifnet *);
 int	in_ioctl(u_long, caddr_t, struct ifnet *, int);
 void	in_prefixlen2mask(struct in_addr *, int);
-#endif
+#endif /* _KERNEL */
 
 #endif /* _NETINET_IN_VAR_H_ */