1 | /* $Id: VBoxNetFltInternal.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxNetFlt - Network Filter Driver (Host), Internal Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef VBOX_INCLUDED_SRC_VBoxNetFlt_VBoxNetFltInternal_h
|
---|
38 | #define VBOX_INCLUDED_SRC_VBoxNetFlt_VBoxNetFltInternal_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <VBox/sup.h>
|
---|
44 | #include <VBox/intnet.h>
|
---|
45 | #include <iprt/semaphore.h>
|
---|
46 | #include <iprt/assert.h>
|
---|
47 |
|
---|
48 |
|
---|
49 | RT_C_DECLS_BEGIN
|
---|
50 |
|
---|
51 | /** Pointer to the globals. */
|
---|
52 | typedef struct VBOXNETFLTGLOBALS *PVBOXNETFLTGLOBALS;
|
---|
53 |
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * The state of a filter driver instance.
|
---|
57 | *
|
---|
58 | * The state machine differs a bit between the platforms because of
|
---|
59 | * the way we hook into the stack. On some hosts we can dynamically
|
---|
60 | * attach when required (on CreateInstance) and on others we will
|
---|
61 | * have to connect when the network stack is bound up. These modes
|
---|
62 | * are called static and dynamic config and governed at compile time
|
---|
63 | * by the VBOXNETFLT_STATIC_CONFIG define.
|
---|
64 | *
|
---|
65 | * See sec_netflt_msc for more details on locking and synchronization.
|
---|
66 | */
|
---|
67 | typedef enum VBOXNETFTLINSSTATE
|
---|
68 | {
|
---|
69 | /** The usual invalid state. */
|
---|
70 | kVBoxNetFltInsState_Invalid = 0,
|
---|
71 | /** Initialization.
|
---|
72 | * We've reserved the interface name but need to attach to the actual
|
---|
73 | * network interface outside the lock to avoid deadlocks.
|
---|
74 | * In the dynamic case this happens during a Create(Instance) call.
|
---|
75 | * In the static case it happens during driver initialization. */
|
---|
76 | kVBoxNetFltInsState_Initializing,
|
---|
77 | #ifdef VBOXNETFLT_STATIC_CONFIG
|
---|
78 | /** Unconnected, not hooked up to a switch (static only).
|
---|
79 | * The filter driver instance has been instantiated and hooked up,
|
---|
80 | * waiting to be connected to an internal network. */
|
---|
81 | kVBoxNetFltInsState_Unconnected,
|
---|
82 | #endif
|
---|
83 | /** Connected to an internal network. */
|
---|
84 | kVBoxNetFltInsState_Connected,
|
---|
85 | /** Disconnecting from the internal network and possibly the host network interface.
|
---|
86 | * Partly for reasons of deadlock avoidance again. */
|
---|
87 | kVBoxNetFltInsState_Disconnecting,
|
---|
88 | /** The instance has been disconnected from both the host and the internal network. */
|
---|
89 | kVBoxNetFltInsState_Destroyed,
|
---|
90 |
|
---|
91 | /** The habitual 32-bit enum hack. */
|
---|
92 | kVBoxNetFltInsState_32BitHack = 0x7fffffff
|
---|
93 | } VBOXNETFTLINSSTATE;
|
---|
94 |
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * The per-instance data of the VBox filter driver.
|
---|
98 | *
|
---|
99 | * This is data associated with a network interface / NIC / wossname which
|
---|
100 | * the filter driver has been or may be attached to. When possible it is
|
---|
101 | * attached dynamically, but this may not be possible on all OSes so we have
|
---|
102 | * to be flexible about things.
|
---|
103 | *
|
---|
104 | * A network interface / NIC / wossname can only have one filter driver
|
---|
105 | * instance attached to it. So, attempts at connecting an internal network
|
---|
106 | * to an interface that's already in use (connected to another internal network)
|
---|
107 | * will result in a VERR_SHARING_VIOLATION.
|
---|
108 | *
|
---|
109 | * Only one internal network can connect to a filter driver instance.
|
---|
110 | */
|
---|
111 | typedef struct VBOXNETFLTINS
|
---|
112 | {
|
---|
113 | /** Pointer to the next interface in the list. (VBOXNETFLTGLOBAL::pInstanceHead) */
|
---|
114 | struct VBOXNETFLTINS *pNext;
|
---|
115 | /** Our RJ-45 port.
|
---|
116 | * This is what the internal network plugs into. */
|
---|
117 | INTNETTRUNKIFPORT MyPort;
|
---|
118 | /** The RJ-45 port on the INTNET "switch".
|
---|
119 | * This is what we're connected to. */
|
---|
120 | PINTNETTRUNKSWPORT pSwitchPort;
|
---|
121 | /** Pointer to the globals. */
|
---|
122 | PVBOXNETFLTGLOBALS pGlobals;
|
---|
123 |
|
---|
124 | /** The spinlock protecting the state variables and host interface handle. */
|
---|
125 | RTSPINLOCK hSpinlock;
|
---|
126 | /** The current interface state. */
|
---|
127 | VBOXNETFTLINSSTATE volatile enmState;
|
---|
128 | /** The trunk state. */
|
---|
129 | INTNETTRUNKIFSTATE volatile enmTrunkState;
|
---|
130 | bool volatile fActive;
|
---|
131 | /** Disconnected from the host network interface. */
|
---|
132 | bool volatile fDisconnectedFromHost;
|
---|
133 | /** Rediscovery is pending.
|
---|
134 | * cBusy will never reach zero during rediscovery, so which
|
---|
135 | * takes care of serializing rediscovery and disconnecting. */
|
---|
136 | bool volatile fRediscoveryPending;
|
---|
137 | /** Whether we should not attempt to set promiscuous mode at all. */
|
---|
138 | bool fDisablePromiscuous;
|
---|
139 | #if (ARCH_BITS == 32) && defined(__GNUC__)
|
---|
140 | #if 0
|
---|
141 | uint32_t u32Padding; /**< Alignment padding, will assert in ASMAtomicUoWriteU64 otherwise. */
|
---|
142 | #endif
|
---|
143 | #endif
|
---|
144 | /** The timestamp of the last rediscovery. */
|
---|
145 | uint64_t volatile NanoTSLastRediscovery;
|
---|
146 | /** Reference count. */
|
---|
147 | uint32_t volatile cRefs;
|
---|
148 | /** The busy count.
|
---|
149 | * This counts the number of current callers and pending packet. */
|
---|
150 | uint32_t volatile cBusy;
|
---|
151 | /** The event that is signaled when we go idle and that pfnWaitForIdle blocks on. */
|
---|
152 | RTSEMEVENT hEventIdle;
|
---|
153 |
|
---|
154 | /** @todo move MacAddr out of this structure! */
|
---|
155 | union
|
---|
156 | {
|
---|
157 | #ifdef VBOXNETFLT_OS_SPECFIC
|
---|
158 | struct
|
---|
159 | {
|
---|
160 | # if defined(RT_OS_DARWIN)
|
---|
161 | /** @name Darwin instance data.
|
---|
162 | * @{ */
|
---|
163 | /** Pointer to the darwin network interface we're attached to.
|
---|
164 | * This is treated as highly volatile and should only be read and retained
|
---|
165 | * while owning hSpinlock. Releasing references to this should not be done
|
---|
166 | * while owning it though as we might end up destroying it in some paths. */
|
---|
167 | ifnet_t volatile pIfNet;
|
---|
168 | /** The interface filter handle.
|
---|
169 | * Same access rules as with pIfNet. */
|
---|
170 | interface_filter_t volatile pIfFilter;
|
---|
171 | /** Whether we've need to set promiscuous mode when the interface comes up. */
|
---|
172 | bool volatile fNeedSetPromiscuous;
|
---|
173 | /** Whether we've successfully put the interface into to promiscuous mode.
|
---|
174 | * This is for dealing with the ENETDOWN case. */
|
---|
175 | bool volatile fSetPromiscuous;
|
---|
176 | /** The MAC address of the interface. */
|
---|
177 | RTMAC MacAddr;
|
---|
178 | /** PF_SYSTEM socket to listen for events (XXX: globals?) */
|
---|
179 | socket_t pSysSock;
|
---|
180 | /** @} */
|
---|
181 | # elif defined(RT_OS_LINUX)
|
---|
182 | /** @name Linux instance data
|
---|
183 | * @{ */
|
---|
184 | /** Pointer to the device. */
|
---|
185 | struct net_device * volatile pDev;
|
---|
186 | /** MTU of host's interface. */
|
---|
187 | uint32_t cbMtu;
|
---|
188 | /** Whether we've successfully put the interface into to promiscuous mode.
|
---|
189 | * This is for dealing with the ENETDOWN case. */
|
---|
190 | bool volatile fPromiscuousSet;
|
---|
191 | /** Whether device exists and physically attached. */
|
---|
192 | bool volatile fRegistered;
|
---|
193 | /** Whether our packet handler is installed. */
|
---|
194 | bool volatile fPacketHandler;
|
---|
195 | /** The MAC address of the interface. */
|
---|
196 | RTMAC MacAddr;
|
---|
197 | struct notifier_block Notifier; /* netdevice */
|
---|
198 | struct notifier_block NotifierIPv4;
|
---|
199 | struct notifier_block NotifierIPv6;
|
---|
200 | struct packet_type PacketType;
|
---|
201 | # ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE
|
---|
202 | struct sk_buff_head XmitQueue;
|
---|
203 | struct work_struct XmitTask;
|
---|
204 | # endif
|
---|
205 | /** @} */
|
---|
206 | # elif defined(RT_OS_SOLARIS)
|
---|
207 | /** @name Solaris instance data.
|
---|
208 | * @{ */
|
---|
209 | # ifdef VBOX_WITH_NETFLT_CROSSBOW
|
---|
210 | /** Whether the underlying interface is a VNIC or not. */
|
---|
211 | bool fIsVNIC;
|
---|
212 | /** Whether the underlying interface is a VNIC template or not. */
|
---|
213 | bool fIsVNICTemplate;
|
---|
214 | /** Handle to list of created VNICs. */
|
---|
215 | list_t hVNICs;
|
---|
216 | /** The MAC address of the host interface. */
|
---|
217 | RTMAC MacAddr;
|
---|
218 | /** Handle of this interface (lower MAC). */
|
---|
219 | mac_handle_t hInterface;
|
---|
220 | /** Handle to link state notifier. */
|
---|
221 | mac_notify_handle_t hNotify;
|
---|
222 | # else
|
---|
223 | /** Pointer to the bound IPv4 stream. */
|
---|
224 | struct vboxnetflt_stream_t * volatile pIp4Stream;
|
---|
225 | /** Pointer to the bound IPv6 stream. */
|
---|
226 | struct vboxnetflt_stream_t * volatile pIp6Stream;
|
---|
227 | /** Pointer to the bound ARP stream. */
|
---|
228 | struct vboxnetflt_stream_t * volatile pArpStream;
|
---|
229 | /** Pointer to the unbound promiscuous stream. */
|
---|
230 | struct vboxnetflt_promisc_stream_t * volatile pPromiscStream;
|
---|
231 | /** Whether we are attaching to IPv6 stream dynamically now. */
|
---|
232 | bool volatile fAttaching;
|
---|
233 | /** Whether this is a VLAN interface or not. */
|
---|
234 | bool volatile fVLAN;
|
---|
235 | /** Layered device handle to the interface. */
|
---|
236 | ldi_handle_t hIface;
|
---|
237 | /** The MAC address of the interface. */
|
---|
238 | RTMAC MacAddr;
|
---|
239 | /** Mutex protection used for loopback. */
|
---|
240 | kmutex_t hMtx;
|
---|
241 | /** Mutex protection used for dynamic IPv6 attaches. */
|
---|
242 | RTSEMFASTMUTEX hPollMtx;
|
---|
243 | # endif
|
---|
244 | /** @} */
|
---|
245 | # elif defined(RT_OS_FREEBSD)
|
---|
246 | /** @name FreeBSD instance data.
|
---|
247 | * @{ */
|
---|
248 | /** Interface handle */
|
---|
249 | struct ifnet *ifp;
|
---|
250 | /** Netgraph node handle */
|
---|
251 | node_p node;
|
---|
252 | /** Input hook */
|
---|
253 | hook_p input;
|
---|
254 | /** Output hook */
|
---|
255 | hook_p output;
|
---|
256 | /** Original interface flags */
|
---|
257 | unsigned int flags;
|
---|
258 | /** Input queue */
|
---|
259 | struct ifqueue inq;
|
---|
260 | /** Output queue */
|
---|
261 | struct ifqueue outq;
|
---|
262 | /** Input task */
|
---|
263 | struct task tskin;
|
---|
264 | /** Output task */
|
---|
265 | struct task tskout;
|
---|
266 | /** The MAC address of the interface. */
|
---|
267 | RTMAC MacAddr;
|
---|
268 | /** @} */
|
---|
269 | # elif defined(RT_OS_WINDOWS)
|
---|
270 | /** @name Windows instance data.
|
---|
271 | * @{ */
|
---|
272 | /** Filter driver device context. */
|
---|
273 | VBOXNETFLTWIN WinIf;
|
---|
274 |
|
---|
275 | volatile uint32_t cModeNetFltRefs;
|
---|
276 | volatile uint32_t cModePassThruRefs;
|
---|
277 | #ifndef VBOXNETFLT_NO_PACKET_QUEUE
|
---|
278 | /** Packet worker thread info */
|
---|
279 | PACKET_QUEUE_WORKER PacketQueueWorker;
|
---|
280 | #endif
|
---|
281 | /** The MAC address of the interface. Caching MAC for performance reasons. */
|
---|
282 | RTMAC MacAddr;
|
---|
283 | /** mutex used to synchronize WinIf init/deinit */
|
---|
284 | RTSEMMUTEX hWinIfMutex;
|
---|
285 | /** @} */
|
---|
286 | # else
|
---|
287 | # error "PORTME"
|
---|
288 | # endif
|
---|
289 | } s;
|
---|
290 | #endif
|
---|
291 | /** Padding. */
|
---|
292 | #if defined(RT_OS_WINDOWS)
|
---|
293 | # if defined(VBOX_NETFLT_ONDEMAND_BIND)
|
---|
294 | uint8_t abPadding[192];
|
---|
295 | # elif defined(VBOXNETADP)
|
---|
296 | uint8_t abPadding[256];
|
---|
297 | # else
|
---|
298 | uint8_t abPadding[1024];
|
---|
299 | # endif
|
---|
300 | #elif defined(RT_OS_LINUX)
|
---|
301 | uint8_t abPadding[320];
|
---|
302 | #elif defined(RT_OS_FREEBSD)
|
---|
303 | uint8_t abPadding[320];
|
---|
304 | #else
|
---|
305 | uint8_t abPadding[128];
|
---|
306 | #endif
|
---|
307 | } u;
|
---|
308 |
|
---|
309 | /** The interface name. */
|
---|
310 | char szName[1];
|
---|
311 | } VBOXNETFLTINS;
|
---|
312 | /** Pointer to the instance data of a host network filter driver. */
|
---|
313 | typedef struct VBOXNETFLTINS *PVBOXNETFLTINS;
|
---|
314 |
|
---|
315 | AssertCompileMemberAlignment(VBOXNETFLTINS, NanoTSLastRediscovery, 8);
|
---|
316 | #ifdef VBOXNETFLT_OS_SPECFIC
|
---|
317 | AssertCompile(RT_SIZEOFMEMB(VBOXNETFLTINS, u.s) <= RT_SIZEOFMEMB(VBOXNETFLTINS, u.abPadding));
|
---|
318 | #endif
|
---|
319 |
|
---|
320 |
|
---|
321 | /**
|
---|
322 | * The global data of the VBox filter driver.
|
---|
323 | *
|
---|
324 | * This contains the bit required for communicating with support driver, VBoxDrv
|
---|
325 | * (start out as SupDrv).
|
---|
326 | */
|
---|
327 | typedef struct VBOXNETFLTGLOBALS
|
---|
328 | {
|
---|
329 | /** Mutex protecting the list of instances and state changes. */
|
---|
330 | RTSEMFASTMUTEX hFastMtx;
|
---|
331 | /** Pointer to a list of instance data. */
|
---|
332 | PVBOXNETFLTINS pInstanceHead;
|
---|
333 |
|
---|
334 | /** The INTNET trunk network interface factory. */
|
---|
335 | INTNETTRUNKFACTORY TrunkFactory;
|
---|
336 | /** The SUPDRV component factory registration. */
|
---|
337 | SUPDRVFACTORY SupDrvFactory;
|
---|
338 | /** The number of current factory references. */
|
---|
339 | int32_t volatile cFactoryRefs;
|
---|
340 | /** Whether the IDC connection is open or not.
|
---|
341 | * This is only for cleaning up correctly after the separate IDC init on Windows. */
|
---|
342 | bool fIDCOpen;
|
---|
343 | /** The SUPDRV IDC handle (opaque struct). */
|
---|
344 | SUPDRVIDCHANDLE SupDrvIDC;
|
---|
345 | } VBOXNETFLTGLOBALS;
|
---|
346 |
|
---|
347 |
|
---|
348 | DECLHIDDEN(int) vboxNetFltInitGlobalsAndIdc(PVBOXNETFLTGLOBALS pGlobals);
|
---|
349 | DECLHIDDEN(int) vboxNetFltInitGlobals(PVBOXNETFLTGLOBALS pGlobals);
|
---|
350 | DECLHIDDEN(int) vboxNetFltInitIdc(PVBOXNETFLTGLOBALS pGlobals);
|
---|
351 | DECLHIDDEN(int) vboxNetFltTryDeleteIdcAndGlobals(PVBOXNETFLTGLOBALS pGlobals);
|
---|
352 | DECLHIDDEN(void) vboxNetFltDeleteGlobals(PVBOXNETFLTGLOBALS pGlobals);
|
---|
353 | DECLHIDDEN(int) vboxNetFltTryDeleteIdc(PVBOXNETFLTGLOBALS pGlobals);
|
---|
354 |
|
---|
355 | DECLHIDDEN(bool) vboxNetFltCanUnload(PVBOXNETFLTGLOBALS pGlobals);
|
---|
356 | DECLHIDDEN(PVBOXNETFLTINS) vboxNetFltFindInstance(PVBOXNETFLTGLOBALS pGlobals, const char *pszName);
|
---|
357 |
|
---|
358 | DECL_HIDDEN_CALLBACK(void) vboxNetFltPortReleaseBusy(PINTNETTRUNKIFPORT pIfPort);
|
---|
359 | DECLHIDDEN(void) vboxNetFltRetain(PVBOXNETFLTINS pThis, bool fBusy);
|
---|
360 | DECLHIDDEN(bool) vboxNetFltTryRetainBusyActive(PVBOXNETFLTINS pThis);
|
---|
361 | DECLHIDDEN(bool) vboxNetFltTryRetainBusyNotDisconnected(PVBOXNETFLTINS pThis);
|
---|
362 | DECLHIDDEN(void) vboxNetFltRelease(PVBOXNETFLTINS pThis, bool fBusy);
|
---|
363 |
|
---|
364 | #ifdef VBOXNETFLT_STATIC_CONFIG
|
---|
365 | DECLHIDDEN(int) vboxNetFltSearchCreateInstance(PVBOXNETFLTGLOBALS pGlobals, const char *pszName, PVBOXNETFLTINS *ppInstance, void * pContext);
|
---|
366 | #endif
|
---|
367 |
|
---|
368 |
|
---|
369 |
|
---|
370 | /** @name The OS specific interface.
|
---|
371 | * @{ */
|
---|
372 | /**
|
---|
373 | * Try rediscover the host interface.
|
---|
374 | *
|
---|
375 | * This is called periodically from the transmit path if we're marked as
|
---|
376 | * disconnected from the host. There is no chance of a race here.
|
---|
377 | *
|
---|
378 | * @returns true if the interface was successfully rediscovered and reattach,
|
---|
379 | * otherwise false.
|
---|
380 | * @param pThis The new instance.
|
---|
381 | */
|
---|
382 | DECLHIDDEN(bool) vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis);
|
---|
383 |
|
---|
384 | /**
|
---|
385 | * Transmits a frame.
|
---|
386 | *
|
---|
387 | * @return IPRT status code.
|
---|
388 | * @param pThis The new instance.
|
---|
389 | * @param pvIfData Pointer to the host-private interface data.
|
---|
390 | * @param pSG The (scatter/)gather list.
|
---|
391 | * @param fDst The destination mask. At least one bit will be set.
|
---|
392 | *
|
---|
393 | * @remarks Owns the out-bound trunk port semaphore.
|
---|
394 | */
|
---|
395 | DECLHIDDEN(int) vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst);
|
---|
396 |
|
---|
397 | /**
|
---|
398 | * This is called when activating or suspending the instance.
|
---|
399 | *
|
---|
400 | * Use this method to enable and disable promiscuous mode on
|
---|
401 | * the interface to prevent unnecessary interrupt load.
|
---|
402 | *
|
---|
403 | * It is only called when the state changes.
|
---|
404 | *
|
---|
405 | * @param pThis The instance.
|
---|
406 | * @param fActive Whether to active (@c true) or deactive.
|
---|
407 | *
|
---|
408 | * @remarks Owns the lock for the out-bound trunk port.
|
---|
409 | */
|
---|
410 | DECLHIDDEN(void) vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive);
|
---|
411 |
|
---|
412 | /**
|
---|
413 | * This is called when a network interface has obtained a new MAC address.
|
---|
414 | *
|
---|
415 | * @param pThis The instance.
|
---|
416 | * @param pvIfData Pointer to the private interface data.
|
---|
417 | * @param pMac Pointer to the new MAC address.
|
---|
418 | */
|
---|
419 | DECLHIDDEN(void) vboxNetFltPortOsNotifyMacAddress(PVBOXNETFLTINS pThis, void *pvIfData, PCRTMAC pMac);
|
---|
420 |
|
---|
421 | /**
|
---|
422 | * This is called when an interface is connected to the network.
|
---|
423 | *
|
---|
424 | * @return IPRT status code.
|
---|
425 | * @param pThis The instance.
|
---|
426 | * @param pvIf Pointer to the interface.
|
---|
427 | * @param ppvIfData Where to store the private interface data.
|
---|
428 | */
|
---|
429 | DECLHIDDEN(int) vboxNetFltPortOsConnectInterface(PVBOXNETFLTINS pThis, void *pvIf, void **ppvIfData);
|
---|
430 |
|
---|
431 | /**
|
---|
432 | * This is called when a VM host disconnects from the network.
|
---|
433 | *
|
---|
434 | * @param pThis The instance.
|
---|
435 | * @param pvIfData Pointer to the private interface data.
|
---|
436 | */
|
---|
437 | DECLHIDDEN(int) vboxNetFltPortOsDisconnectInterface(PVBOXNETFLTINS pThis, void *pvIfData);
|
---|
438 |
|
---|
439 | /**
|
---|
440 | * This is called to when disconnecting from a network.
|
---|
441 | *
|
---|
442 | * @return IPRT status code.
|
---|
443 | * @param pThis The new instance.
|
---|
444 | *
|
---|
445 | * @remarks May own the semaphores for the global list, the network lock and the out-bound trunk port.
|
---|
446 | */
|
---|
447 | DECLHIDDEN(int) vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis);
|
---|
448 |
|
---|
449 | /**
|
---|
450 | * This is called to when connecting to a network.
|
---|
451 | *
|
---|
452 | * @return IPRT status code.
|
---|
453 | * @param pThis The new instance.
|
---|
454 | *
|
---|
455 | * @remarks Owns the semaphores for the global list, the network lock and the out-bound trunk port.
|
---|
456 | */
|
---|
457 | DECLHIDDEN(int) vboxNetFltOsConnectIt(PVBOXNETFLTINS pThis);
|
---|
458 |
|
---|
459 | /**
|
---|
460 | * Counter part to vboxNetFltOsInitInstance().
|
---|
461 | *
|
---|
462 | * @return IPRT status code.
|
---|
463 | * @param pThis The new instance.
|
---|
464 | *
|
---|
465 | * @remarks May own the semaphores for the global list, the network lock and the out-bound trunk port.
|
---|
466 | */
|
---|
467 | DECLHIDDEN(void) vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis);
|
---|
468 |
|
---|
469 | /**
|
---|
470 | * This is called to attach to the actual host interface
|
---|
471 | * after linking the instance into the list.
|
---|
472 | *
|
---|
473 | * The MAC address as well promiscuousness and GSO capabilities should be
|
---|
474 | * reported by this function.
|
---|
475 | *
|
---|
476 | * @return IPRT status code.
|
---|
477 | * @param pThis The new instance.
|
---|
478 | * @param pvContext The user supplied context in the static config only.
|
---|
479 | * NULL in the dynamic config.
|
---|
480 | *
|
---|
481 | * @remarks Owns no locks.
|
---|
482 | */
|
---|
483 | DECLHIDDEN(int) vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext);
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * This is called to perform structure initializations.
|
---|
487 | *
|
---|
488 | * @return IPRT status code.
|
---|
489 | * @param pThis The new instance.
|
---|
490 | *
|
---|
491 | * @remarks Owns no locks.
|
---|
492 | */
|
---|
493 | DECLHIDDEN(int) vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis);
|
---|
494 | /** @} */
|
---|
495 |
|
---|
496 |
|
---|
497 | RT_C_DECLS_END
|
---|
498 |
|
---|
499 | #endif /* !VBOX_INCLUDED_SRC_VBoxNetFlt_VBoxNetFltInternal_h */
|
---|
500 |
|
---|