From 5e6c3a979e9417fa631ed8a13ca2334a3da2cabd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 16 May 2016 16:55:38 +0200 Subject: [PATCH] virtualbox: unique Nic session labels Append the network adapter index to Nic session labels. Fixes #1966 --- repos/ports/ports/virtualbox.hash | 2 +- repos/ports/src/virtualbox/network.cpp | 24 +++++++++++++------ .../src/virtualbox/patches/vbox_main.patch | 11 +++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 81b47fdeeb..f730904922 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -6305944f1109406627baf4fafcc37aa68020ab79 +d7b1f7d895c0a28fe1ba95796adc23a09b4113b5 diff --git a/repos/ports/src/virtualbox/network.cpp b/repos/ports/src/virtualbox/network.cpp index b87d7268ed..1ee1ad86f9 100644 --- a/repos/ports/src/virtualbox/network.cpp +++ b/repos/ports/src/virtualbox/network.cpp @@ -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 #include +#include /******************************************************************************* * 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; diff --git a/repos/ports/src/virtualbox/patches/vbox_main.patch b/repos/ports/src/virtualbox/patches/vbox_main.patch index 42def9d386..5ec451723c 100644 --- a/repos/ports/src/virtualbox/patches/vbox_main.patch +++ b/repos/ports/src/virtualbox/patches/vbox_main.patch @@ -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