virtualbox: unique Nic session labels

Append the network adapter index to Nic session labels.

Fixes #1966
This commit is contained in:
Emery Hemingway 2016-05-16 16:55:38 +02:00 committed by Christian Helmuth
parent f06087625f
commit 5e6c3a979e
3 changed files with 29 additions and 8 deletions

View File

@ -1 +1 @@
6305944f1109406627baf4fafcc37aa68020ab79
d7b1f7d895c0a28fe1ba95796adc23a09b4113b5

View File

@ -4,7 +4,7 @@
*/
/*
* Copyright (C) 2014-2015 Genode Labs GmbH
* Copyright (C) 2014-2016 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
@ -38,6 +38,7 @@
#include <nic_session/connection.h>
#include <nic/packet_allocator.h>
#include <base/snprintf.h>
/*******************************************************************************
* Structures and Typedefs *
@ -155,10 +156,10 @@ class Nic_client
public:
Nic_client(PDRVNIC drvtap)
Nic_client(PDRVNIC drvtap, char const *label)
:
_tx_block_alloc(_packet_allocator()),
_nic(_tx_block_alloc, BUF_SIZE, BUF_SIZE),
_nic(_tx_block_alloc, BUF_SIZE, BUF_SIZE, label),
_link_state_dispatcher(_sig_rec, *this, &Nic_client::_handle_link_state),
_rx_packet_avail_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_packet_avail),
_rx_ready_to_ack_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_ready_to_ack),
@ -477,6 +478,7 @@ static DECLCALLBACK(int) drvNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
{
PDRVNIC pThis = PDMINS_2_DATA(pDrvIns, PDRVNIC);
PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
int rc;
/*
* Init the static parts.
@ -516,11 +518,19 @@ static DECLCALLBACK(int) drvNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
N_("Configuration error: the above device/driver"
" didn't export the network config interface!\n"));
char label[8];
uint64_t slot;
rc = CFGMR3QueryInteger(pCfg, "Slot", &slot);
if (RT_FAILURE(rc))
return PDMDRV_SET_ERROR(pDrvIns, rc,
N_("Configuration error: Failed to retrieve the network interface slot"));
Genode::snprintf(label, sizeof(label), "%d", slot);
/*
* Setup Genode nic_session connection
*/
try {
pThis->nic_client = new (Genode::env()->heap()) Nic_client(pThis);
pThis->nic_client = new (Genode::env()->heap()) Nic_client(pThis, label);
} catch (...) {
return VERR_HOSTIF_INIT_FAILED;
}
@ -528,9 +538,9 @@ static DECLCALLBACK(int) drvNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
/*
* Create the asynchronous I/O thread.
*/
int rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pThread, pThis,
drvNicAsyncIoThread, drvNicAsyncIoWakeup,
128 * _1K, RTTHREADTYPE_IO, "nic_thread");
rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pThread, pThis,
drvNicAsyncIoThread, drvNicAsyncIoWakeup,
128 * _1K, RTTHREADTYPE_IO, "nic_thread");
AssertRCReturn(rc, rc);
return rc;

View File

@ -1086,6 +1086,17 @@ index caed4be..6d02496 100644
}
#elif defined(VBOX_WITH_NETFLT)
@@ -5206,6 +5206,10 @@
#undef H
+ /* store the slot index for later */
+ InsertConfigInteger(pCfg, "Slot", uInstance);
+
+
return VINF_SUCCESS;
}
diff --git a/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp
index fed0ac3..bc3c334 100644
--- a/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp