Module Name:    src
Committed By:   pooka
Date:           Fri Aug 22 11:28:04 UTC 2014

Modified Files:
        src/sys/kern: uipc_domain.c

Log Message:
Change the meaning of the boolean parameter to domaininit().
was: attach route domain if found from domains link set
now: attach any domain which is found from domains link set

No functional change to monolithic kernel.  In a rump kernel, which
attaches networking domains "modularly", prevents domains from
accidentally leaking in via the link set in static linked scenarios.

Problem reported by cube, Tom Bousso, and the voices in my head.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/kern/uipc_domain.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/uipc_domain.c
diff -u src/sys/kern/uipc_domain.c:1.93 src/sys/kern/uipc_domain.c:1.94
--- src/sys/kern/uipc_domain.c:1.93	Wed Apr 23 17:05:18 2014
+++ src/sys/kern/uipc_domain.c	Fri Aug 22 11:28:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_domain.c,v 1.93 2014/04/23 17:05:18 pooka Exp $	*/
+/*	$NetBSD: uipc_domain.c,v 1.94 2014/08/22 11:28:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.93 2014/04/23 17:05:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.94 2014/08/22 11:28:03 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -82,7 +82,7 @@ static struct domain domain_dummy;
 __link_set_add_rodata(domains,domain_dummy);
 
 void
-domaininit(bool addroute)
+domaininit(bool attach)
 {
 	__link_set_decl(domains, struct domain);
 	struct domain * const * dpp;
@@ -94,16 +94,18 @@ domaininit(bool addroute)
 	 * Add all of the domains.  Make sure the PF_ROUTE
 	 * domain is added last.
 	 */
-	__link_set_foreach(dpp, domains) {
-		if (*dpp == &domain_dummy)
-			continue;
-		if ((*dpp)->dom_family == PF_ROUTE)
-			rt_domain = *dpp;
-		else
-			domain_attach(*dpp);
+	if (attach) {
+		__link_set_foreach(dpp, domains) {
+			if (*dpp == &domain_dummy)
+				continue;
+			if ((*dpp)->dom_family == PF_ROUTE)
+				rt_domain = *dpp;
+			else
+				domain_attach(*dpp);
+		}
+		if (rt_domain)
+			domain_attach(rt_domain);
 	}
-	if (rt_domain && addroute)
-		domain_attach(rt_domain);
 
 	callout_init(&pffasttimo_ch, CALLOUT_MPSAFE);
 	callout_init(&pfslowtimo_ch, CALLOUT_MPSAFE);

Reply via email to