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@
This commit is contained in:
pgoyette 2019-07-16 22:57:55 +00:00
parent fbf9c51ff3
commit 40a27fe72c
2 changed files with 19 additions and 13 deletions

View File

@ -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 *) = NULL;
* 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
/*

View File

@ -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.c,v 1.280 2019/06/01 15:20:51 maxv Exp $
#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");