From 658ac1aafb5415ece454a6df65aac7edefd5b519 Mon Sep 17 00:00:00 2001 From: thedisbo1125 Date: Fri, 3 Jul 2026 09:39:53 -0400 Subject: [PATCH] add ability to check if DHCP is running --- src/VBox/Main/idl/VirtualBox.xidl | 6 ++++++ src/VBox/Main/include/DHCPServerImpl.h | 1 + src/VBox/Main/src-server/DHCPServerImpl.cpp | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl index e5855b1357ca..528b8c346fdc 100644 --- a/src/VBox/Main/idl/VirtualBox.xidl +++ b/src/VBox/Main/idl/VirtualBox.xidl @@ -2539,6 +2539,12 @@ + + + specifies if the DHCP server is running + + + specifies server IP diff --git a/src/VBox/Main/include/DHCPServerImpl.h b/src/VBox/Main/include/DHCPServerImpl.h index 543020d14f78..2c93d5248541 100644 --- a/src/VBox/Main/include/DHCPServerImpl.h +++ b/src/VBox/Main/include/DHCPServerImpl.h @@ -87,6 +87,7 @@ class ATL_NO_VTABLE DHCPServer HRESULT getEventSource(ComPtr &aEventSource) RT_OVERRIDE; HRESULT getEnabled(BOOL *aEnabled) RT_OVERRIDE; HRESULT setEnabled(BOOL aEnabled) RT_OVERRIDE; + HRESULT getRunning(BOOL *aRunning) RT_OVERRIDE; HRESULT getIPAddress(com::Utf8Str &aIPAddress) RT_OVERRIDE; HRESULT getNetworkMask(com::Utf8Str &aNetworkMask) RT_OVERRIDE; HRESULT getNetworkName(com::Utf8Str &aName) RT_OVERRIDE; diff --git a/src/VBox/Main/src-server/DHCPServerImpl.cpp b/src/VBox/Main/src-server/DHCPServerImpl.cpp index e95d2fd5b96e..37816fe50f1e 100644 --- a/src/VBox/Main/src-server/DHCPServerImpl.cpp +++ b/src/VBox/Main/src-server/DHCPServerImpl.cpp @@ -477,6 +477,14 @@ HRESULT DHCPServer::setEnabled(BOOL aEnabled) } +HRESULT DHCPServer::getRunning(BOOL *aRunning) +{ + AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); + *aRunning = m->dhcp.isRunning(); + return S_OK; +} + + HRESULT DHCPServer::getIPAddress(com::Utf8Str &aIPAddress) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);