Module Name:    src
Committed By:   martin
Date:           Fri Jul 13 15:49:55 UTC 2018

Modified Files:
        src/sys/kern [netbsd-8]: init_main.c
        src/sys/net [netbsd-8]: if.c if.h
        src/sys/rump/net/lib/libnet [netbsd-8]: net_component.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #911):

        sys/kern/init_main.c: revision 1.498
        sys/rump/net/lib/libnet/net_component.c: revision 1.10
        sys/net/if.h: revision 1.264
        sys/net/if.c: revision 1.429

Fix net.inet6.ip6.ifq node doesn't exist

The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.
sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@


To generate a diff of this commit:
cvs rdiff -u -r1.490 -r1.490.6.1 src/sys/kern/init_main.c
cvs rdiff -u -r1.394.2.11 -r1.394.2.12 src/sys/net/if.c
cvs rdiff -u -r1.239.2.6 -r1.239.2.7 src/sys/net/if.h
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/rump/net/lib/libnet/net_component.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.490 src/sys/kern/init_main.c:1.490.6.1
--- src/sys/kern/init_main.c:1.490	Mon Jan 16 09:28:40 2017
+++ src/sys/kern/init_main.c	Fri Jul 13 15:49:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $	*/
+/*	$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -558,6 +558,7 @@ main(void)
 	lltableinit();
 #endif
 	domaininit(true);
+	ifinit_post();
 	if_attachdomain();
 	splx(s);
 

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.394.2.11 src/sys/net/if.c:1.394.2.12
--- src/sys/net/if.c:1.394.2.11	Thu Jun  7 17:50:54 2018
+++ src/sys/net/if.c	Fri Jul 13 15:49:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $	*/
+/*	$NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -291,8 +291,6 @@ void
 ifinit(void)
 {
 
-	if_sysctl_setup(NULL);
-
 #if (defined(INET) || defined(INET6))
 	encapinit();
 #endif
@@ -330,6 +328,14 @@ ifinit1(void)
 #endif
 }
 
+/* XXX must be after domaininit() */
+void
+ifinit_post(void)
+{
+
+	if_sysctl_setup(NULL);
+}
+
 ifnet_t *
 if_alloc(u_char type)
 {

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.239.2.6 src/sys/net/if.h:1.239.2.7
--- src/sys/net/if.h:1.239.2.6	Fri Jul 13 14:26:48 2018
+++ src/sys/net/if.h	Fri Jul 13 15:49:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.239.2.6 2018/07/13 14:26:48 martin Exp $	*/
+/*	$NetBSD: if.h,v 1.239.2.7 2018/07/13 15:49:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1088,6 +1088,7 @@ void	if_link_state_change_softint(struct
 void	if_up(struct ifnet *);
 void	ifinit(void);
 void	ifinit1(void);
+void	ifinit_post(void);
 int	ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *);
 extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
 int	ifioctl_common(struct ifnet *, u_long, void *);

Index: src/sys/rump/net/lib/libnet/net_component.c
diff -u src/sys/rump/net/lib/libnet/net_component.c:1.9 src/sys/rump/net/lib/libnet/net_component.c:1.9.6.1
--- src/sys/rump/net/lib/libnet/net_component.c:1.9	Thu Feb 16 08:39:10 2017
+++ src/sys/rump/net/lib/libnet/net_component.c	Fri Jul 13 15:49:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $	*/
+/*	$NetBSD: net_component.c,v 1.9.6.1 2018/07/13 15:49:55 martin Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.9.6.1 2018/07/13 15:49:55 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/domain.h>
@@ -65,5 +65,6 @@ RUMP_COMPONENT(RUMP_COMPONENT_NET_ROUTE)
 RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
 {
 
+	ifinit_post();
 	loopinit();
 }

Reply via email to