Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Fix net.inet6.ip6.ifq node doesn't exist



details:   https://anonhg.NetBSD.org/src/rev/e9477271808a
branches:  trunk
changeset: 323836:e9477271808a
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jul 03 03:37:03 2018 +0000

description:
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@

diffstat:

 sys/kern/init_main.c                    |   5 +++--
 sys/net/if.c                            |  14 ++++++++++----
 sys/net/if.h                            |   3 ++-
 sys/rump/net/lib/libnet/net_component.c |   5 +++--
 4 files changed, 18 insertions(+), 9 deletions(-)

diffs (110 lines):

diff -r cbb965bf70cd -r e9477271808a sys/kern/init_main.c
--- a/sys/kern/init_main.c      Tue Jul 03 01:56:39 2018 +0000
+++ b/sys/kern/init_main.c      Tue Jul 03 03:37:03 2018 +0000
@@ -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 @@
        lltableinit();
 #endif
        domaininit(true);
+       ifinit_post();
        if_attachdomain();
        splx(s);
 
diff -r cbb965bf70cd -r e9477271808a sys/net/if.c
--- a/sys/net/if.c      Tue Jul 03 01:56:39 2018 +0000
+++ b/sys/net/if.c      Tue Jul 03 03:37:03 2018 +0000
@@ -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 @@
 ifinit(void)
 {
 
-       if_sysctl_setup(NULL);
-
 #if (defined(INET) || defined(INET6))
        encapinit();
 #endif
@@ -323,6 +321,14 @@
 #endif
 }
 
+/* XXX must be after domaininit() */
+void
+ifinit_post(void)
+{
+
+       if_sysctl_setup(NULL);
+}
+
 ifnet_t *
 if_alloc(u_char type)
 {
diff -r cbb965bf70cd -r e9477271808a sys/net/if.h
--- a/sys/net/if.h      Tue Jul 03 01:56:39 2018 +0000
+++ b/sys/net/if.h      Tue Jul 03 03:37:03 2018 +0000
@@ -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_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 *);
diff -r cbb965bf70cd -r e9477271808a sys/rump/net/lib/libnet/net_component.c
--- a/sys/rump/net/lib/libnet/net_component.c   Tue Jul 03 01:56:39 2018 +0000
+++ b/sys/rump/net/lib/libnet/net_component.c   Tue Jul 03 03:37:03 2018 +0000
@@ -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_IF)
 {
 
+       ifinit_post();
        loopinit();
 }



Home | Main Index | Thread Index | Old Index