Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Move the assignment of SCTP-specific function hooks...



details:   https://anonhg.NetBSD.org/src/rev/c33c428196a1
branches:  trunk
changeset: 457748:c33c428196a1
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Jul 16 22:57:55 2019 +0000

description:
Move the assignment of SCTP-specific function hooks/pointers.

Without this, a rumpkernel (appropriately modified) built with SCTP
enabled will try to assign the function pointers, but the targets
are only available in rumpnet.  We cannot link the rumpkernel against
rumpnet because rumpnet is already linked against rumpkernel and we
would end up with a circular dependency.

As reported in private Email by rjs@

diffstat:

 sys/kern/compat_stub.c |  17 ++++++-----------
 sys/kern/uipc_socket.c |  15 +++++++++++++--
 2 files changed, 19 insertions(+), 13 deletions(-)

diffs (92 lines):

diff -r b9981e41b11c -r c33c428196a1 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Tue Jul 16 21:13:28 2019 +0000
+++ b/sys/kern/compat_stub.c    Tue Jul 16 22:57:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.13 2019/06/25 15:33:55 rjs Exp $ */
+/* $NetBSD: compat_stub.c,v 1.14 2019/07/16 22:57:55 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,6 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
-#include "opt_sctp.h"
 #endif
 
 #include <sys/systm.h>
@@ -44,10 +43,6 @@
 #include <sys/timex.h>
 #endif
 
-#ifdef SCTP
-#include <netinet/sctp_route.h>
-#endif
-
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
  *
@@ -68,15 +63,15 @@
  * Routine vectors for sctp (called from within rtsock)
  *
  * MP-hooks not needed since the SCTP code is not modular
+ *
+ * For now, just point these at NULL.  Network initialization code
+ * in if.c will overwrite these with correct values.  This is needed
+ * to enable building of rumpkern library without creating circular
+ * dependency with rumpnet library
  */
 
-#ifdef SCTP
-void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
-void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
-#else
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
-#endif 
 
 
 /*
diff -r b9981e41b11c -r c33c428196a1 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Tue Jul 16 21:13:28 2019 +0000
+++ b/sys/kern/uipc_socket.c    Tue Jul 16 22:57:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.280 2019/06/01 15:20:51 maxv Exp $   */
+/*     $NetBSD: uipc_socket.c,v 1.281 2019/07/16 22:57:55 pgoyette Exp $       */
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.280 2019/06/01 15:20:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.281 2019/07/16 22:57:55 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -113,6 +113,10 @@
 #include <uvm/uvm_loan.h>
 #include <uvm/uvm_page.h>
 
+#ifdef SCTP
+#include <netinet/sctp_route.h>
+#endif
+
 MALLOC_DEFINE(M_SONAME, "soname", "socket name");
 
 extern const struct fileops socketops;
@@ -439,6 +443,13 @@
 
        sysctl_kern_socket_setup();
 
+#ifdef SCTP
+       /* Update the SCTP function hooks if necessary*/
+
+        vec_sctp_add_ip_address = sctp_add_ip_address;
+        vec_sctp_delete_ip_address = sctp_delete_ip_address; 
+#endif
+
        mutex_init(&so_pendfree_lock, MUTEX_DEFAULT, IPL_VM);
        softnet_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
        cv_init(&socurkva_cv, "sokva");



Home | Main Index | Thread Index | Old Index