Module Name: src
Committed By: dyoung
Date: Fri Aug 21 22:43:33 UTC 2009
Modified Files:
src/sys/kern: kern_sysctl.c
Log Message:
Make sure that a sysctlnode's child nodes, even nodes that are not
yet in service, have a correct pointer to their parent, sysctl_parent.
This fixes a bug where sysctl_teardown(9) could not clean up a
network interface's sysctl(9) trees when I detached it, because
the wrong log had been recorded.
To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/kern_sysctl.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/kern_sysctl.c
diff -u src/sys/kern/kern_sysctl.c:1.222 src/sys/kern/kern_sysctl.c:1.223
--- src/sys/kern/kern_sysctl.c:1.222 Wed Apr 15 20:44:25 2009
+++ src/sys/kern/kern_sysctl.c Fri Aug 21 22:43:32 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sysctl.c,v 1.222 2009/04/15 20:44:25 elad Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.223 2009/08/21 22:43:32 dyoung Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.222 2009/04/15 20:44:25 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.223 2009/08/21 22:43:32 dyoung Exp $");
#include "opt_defcorename.h"
#include "ksyms.h"
@@ -1143,8 +1143,8 @@
* and...reparent any children of any moved nodes
*/
for (ni = at; ni <= pnode->sysctl_clen; ni++)
- if (SYSCTL_TYPE(node[ni].sysctl_flags) == CTLTYPE_NODE)
- for (t = 0; t < node[ni].sysctl_clen; t++)
+ if (node[ni].sysctl_child != NULL)
+ for (t = 0; t < node[ni].sysctl_csize; t++)
node[ni].sysctl_child[t].sysctl_parent =
&node[ni];
}