PF_BLUETOOTH protocols: skip initialization of non-virtualized globals

for non-default VNET instances.

This fixes panic on a vnet initialization when ng_btsocket is loaded.

MFC after:	1 week
This commit is contained in:
Mikolaj Golub 2014-06-10 18:21:37 +00:00
parent 6fd4061119
commit 4a8e4eb55b
5 changed files with 27 additions and 0 deletions

View File

@ -51,6 +51,9 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <net/vnet.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/bluetooth/include/ng_bluetooth.h>
@ -728,6 +731,10 @@ ng_btsocket_hci_raw_init(void)
bitstr_t *f = NULL;
int error = 0;
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
ng_btsocket_hci_raw_node = NULL;
ng_btsocket_hci_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_hci_raw_ioctl_timeout = 5;

View File

@ -1813,6 +1813,10 @@ ng_btsocket_l2cap_init(void)
{
int error = 0;
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
ng_btsocket_l2cap_node = NULL;
ng_btsocket_l2cap_debug_level = NG_BTSOCKET_WARN_LEVEL;

View File

@ -50,6 +50,9 @@
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <net/vnet.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/bluetooth/include/ng_bluetooth.h>
@ -513,6 +516,10 @@ ng_btsocket_l2cap_raw_init(void)
{
int error = 0;
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
ng_btsocket_l2cap_raw_node = NULL;
ng_btsocket_l2cap_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_l2cap_raw_ioctl_timeout = 5;

View File

@ -328,6 +328,11 @@ ng_btsocket_rfcomm_check_fcs(u_int8_t *data, int type, u_int8_t fcs)
void
ng_btsocket_rfcomm_init(void)
{
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
ng_btsocket_rfcomm_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_rfcomm_timo = 60;

View File

@ -1107,6 +1107,10 @@ ng_btsocket_sco_init(void)
{
int error = 0;
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
ng_btsocket_sco_node = NULL;
ng_btsocket_sco_debug_level = NG_BTSOCKET_WARN_LEVEL;