Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Change the meaning of the boolean parameter to doma...



details:   https://anonhg.NetBSD.org/src/rev/af8ee50e2607
branches:  trunk
changeset: 801879:af8ee50e2607
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Aug 22 11:28:03 2014 +0000

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

diffstat:

 sys/kern/uipc_domain.c |  26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r 93f0e22e82e5 -r af8ee50e2607 sys/kern/uipc_domain.c
--- a/sys/kern/uipc_domain.c    Fri Aug 22 10:51:38 2014 +0000
+++ b/sys/kern/uipc_domain.c    Fri Aug 22 11:28:03 2014 +0000
@@ -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 @@
 __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 @@
         * 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);



Home | Main Index | Thread Index | Old Index