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@
This commit is contained in:
ozaki-r 2018-07-03 03:37:03 +00:00
parent 4bcba09122
commit 1350b04367
4 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.497 2018/04/16 14:51:59 kamil Exp $ */
/* $NetBSD: init_main.c,v 1.498 2018/07/03 03:37:03 ozaki-r 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.497 2018/04/16 14:51:59 kamil Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.498 2018/07/03 03:37:03 ozaki-r Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -572,6 +572,7 @@ main(void)
lltableinit();
#endif
domaininit(true);
ifinit_post();
if_attachdomain();
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.428 2018/06/26 06:48:02 msaitoh Exp $ */
/* $NetBSD: if.c,v 1.429 2018/07/03 03:37:03 ozaki-r 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.428 2018/06/26 06:48:02 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.429 2018/07/03 03:37:03 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -279,8 +279,6 @@ void
ifinit(void)
{
if_sysctl_setup(NULL);
#if (defined(INET) || defined(INET6))
encapinit();
#endif
@ -323,6 +321,14 @@ ifinit1(void)
#endif
}
/* XXX must be after domaininit() */
void
ifinit_post(void)
{
if_sysctl_setup(NULL);
}
ifnet_t *
if_alloc(u_char type)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.263 2018/06/21 10:37:49 knakahara Exp $ */
/* $NetBSD: if.h,v 1.264 2018/07/03 03:37:03 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -1090,6 +1090,7 @@ void if_link_state_change_softint(struct ifnet *, int);
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 *);

View File

@ -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.10 2018/07/03 03:37:03 ozaki-r 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.10 2018/07/03 03:37:03 ozaki-r 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();
}