Module Name:    src
Committed By:   pgoyette
Date:           Tue Jul 16 22:57:55 UTC 2019

Modified Files:
        src/sys/kern: compat_stub.c uipc_socket.c

Log Message:
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@


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.280 -r1.281 src/sys/kern/uipc_socket.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.13 src/sys/kern/compat_stub.c:1.14
--- src/sys/kern/compat_stub.c:1.13	Tue Jun 25 15:33:55 2019
+++ src/sys/kern/compat_stub.c	Tue Jul 16 22:57:55 2019
@@ -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 @@ void (*vec_ntp_adjtime1)(struct timex *)
  * 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 
 
 
 /*

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.280 src/sys/kern/uipc_socket.c:1.281
--- src/sys/kern/uipc_socket.c:1.280	Sat Jun  1 15:20:51 2019
+++ src/sys/kern/uipc_socket.c	Tue Jul 16 22:57:55 2019
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_socket.
 #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 @@ soinit(void)
 
 	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");

Reply via email to