VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c@ 46150

Last change on this file since 46150 was 45143, checked in by vboxsync, 12 years ago

solaris/VBoxNetFltBow: fix destroying managed VNICs for VNIC templates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 55.4 KB
Line 
1/* $Id: VBoxNetFltBow-solaris.c 45143 2013-03-22 13:58:03Z vboxsync $ */
2/** @file
3 * VBoxNetFlt - Network Filter Driver (Host), Solaris Specific Code.
4 */
5
6/*
7 * Copyright (C) 2008-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/*******************************************************************************
28* Header Files *
29*******************************************************************************/
30#define LOG_GROUP LOG_GROUP_NET_FLT_DRV
31#ifdef DEBUG_ramshankar
32# define LOG_ENABLED
33# define LOG_INSTANCE RTLogRelDefaultInstance()
34#endif
35#include <VBox/log.h>
36#include <VBox/err.h>
37#include <VBox/intnetinline.h>
38#include <VBox/version.h>
39#include <iprt/initterm.h>
40#include <iprt/alloca.h>
41#include <iprt/assert.h>
42#include <iprt/err.h>
43#include <iprt/string.h>
44#include <iprt/rand.h>
45#include <iprt/net.h>
46#include <iprt/spinlock.h>
47#include <iprt/mem.h>
48
49#include <sys/types.h>
50#include <sys/modctl.h>
51#include <sys/conf.h>
52#include <sys/stat.h>
53#include <sys/ddi.h>
54#include <sys/gld.h>
55#include <sys/sunddi.h>
56#include <sys/strsubr.h>
57#include <sys/dlpi.h>
58#include <sys/dls_mgmt.h>
59#include <sys/mac.h>
60#include <sys/strsun.h>
61
62#include <sys/vnic_mgmt.h>
63#include <sys/mac_client.h>
64#include <sys/mac_provider.h>
65#include <sys/dls.h>
66#include <sys/dld.h>
67#include <sys/cred.h>
68
69
70#define VBOXNETFLT_OS_SPECFIC 1
71#include "../VBoxNetFltInternal.h"
72
73/*******************************************************************************
74* Defined Constants And Macros *
75*******************************************************************************/
76/** The module name. */
77#define DEVICE_NAME "vboxbow"
78/** The module descriptions as seen in 'modinfo'. */
79#define DEVICE_DESC_DRV "VirtualBox NetBow"
80/** The dynamically created VNIC name (hardcoded in NetIf-solaris.cpp).
81 * @todo move this define into a common header. */
82#define VBOXBOW_VNIC_NAME "vboxvnic"
83/** The VirtualBox VNIC template name (hardcoded in NetIf-solaris.cpp).
84 * * @todo move this define into a common header. */
85#define VBOXBOW_VNIC_TEMPLATE_NAME "vboxvnic_template"
86/** Debugging switch for using symbols in kmdb */
87# define LOCAL static
88/** VBOXNETFLTVNIC::u32Magic */
89# define VBOXNETFLTVNIC_MAGIC 0x0ddfaced
90
91/** VLAN tag masking, should probably be in IPRT? */
92#define VLAN_ID(vlan) (((vlan) >> 0) & 0x0fffu)
93#define VLAN_CFI(vlan) (((vlan) >> 12) & 0x0001u)
94#define VLAN_PRI(vlan) (((vlan) >> 13) & 0x0007u)
95#define VLAN_TAG(pri,cfi,vid) (((pri) << 13) | ((cfi) << 12) | ((vid) << 0))
96
97typedef struct VLANHEADER
98{
99 uint16_t Type;
100 uint16_t Data;
101} VLANHEADER;
102typedef struct VLANHEADER *PVLANHEADER;
103
104/* Private: from sys/vlan.h */
105#ifndef VLAN_ID_NONE
106# define VLAN_ID_NONE 0
107#endif
108
109/* Private: from sys/param.h */
110#ifndef MAXLINKNAMESPECIFIER
111# define MAXLINKNAMESPECIFIER 96 /* MAXLINKNAMELEN + ZONENAME_MAX */
112#endif
113
114/* Private: from sys/mac_client_priv.h, mac client function prototypes. */
115extern uint16_t mac_client_vid(mac_client_handle_t hClient);
116extern void mac_client_get_resources(mac_client_handle_t hClient, mac_resource_props_t *pResources);
117extern int mac_client_set_resources(mac_client_handle_t hClient, mac_resource_props_t *pResources);
118
119
120/*******************************************************************************
121* Kernel Entry Hooks *
122*******************************************************************************/
123LOCAL int VBoxNetFltSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd);
124LOCAL int VBoxNetFltSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd);
125LOCAL int VBoxNetFltSolarisGetInfo(dev_info_t *pDip, ddi_info_cmd_t enmCmd, void *pArg, void **ppResult);
126
127
128/*******************************************************************************
129* Structures and Typedefs *
130*******************************************************************************/
131/**
132 * cb_ops: for drivers that support char/block entry points
133 */
134static struct cb_ops g_VBoxNetFltSolarisCbOps =
135{
136 nulldev, /* c open */
137 nulldev, /* c close */
138 nodev, /* b strategy */
139 nodev, /* b dump */
140 nodev, /* b print */
141 nodev, /* c read */
142 nodev, /* c write*/
143 nodev, /* c ioctl*/
144 nodev, /* c devmap */
145 nodev, /* c mmap */
146 nodev, /* c segmap */
147 nochpoll, /* c poll */
148 ddi_prop_op, /* property ops */
149 NULL, /* streamtab */
150 D_NEW | D_MP, /* compat. flag */
151 CB_REV, /* revision */
152 nodev, /* c aread */
153 nodev /* c awrite */
154};
155
156/**
157 * dev_ops: for driver device operations
158 */
159static struct dev_ops g_VBoxNetFltSolarisDevOps =
160{
161 DEVO_REV, /* driver build revision */
162 0, /* ref count */
163 VBoxNetFltSolarisGetInfo,
164 nulldev, /* identify */
165 nulldev, /* probe */
166 VBoxNetFltSolarisAttach,
167 VBoxNetFltSolarisDetach,
168 nodev, /* reset */
169 &g_VBoxNetFltSolarisCbOps,
170 NULL, /* bus ops */
171 nodev, /* power */
172 ddi_quiesce_not_needed
173};
174
175/**
176 * modldrv: export driver specifics to the kernel
177 */
178static struct modldrv g_VBoxNetFltSolarisModule =
179{
180 &mod_driverops, /* extern from kernel */
181 DEVICE_DESC_DRV " " VBOX_VERSION_STRING "r" RT_XSTR(VBOX_SVN_REV),
182 &g_VBoxNetFltSolarisDevOps
183};
184
185/**
186 * modlinkage: export install/remove/info to the kernel
187 */
188static struct modlinkage g_VBoxNetFltSolarisModLinkage =
189{
190 MODREV_1,
191 {
192 &g_VBoxNetFltSolarisModule,
193 NULL,
194 }
195};
196
197/*
198 * VBOXNETFLTVNICTEMPLATE: VNIC template information.
199 */
200typedef struct VBOXNETFLTVNICTEMPLATE
201{
202 /** The name of link on which the VNIC template is created on. */
203 char szLinkName[MAXNAMELEN];
204 /** The VLAN Id (can be VLAN_ID_NONE). */
205 uint16_t uVLANId;
206 /** Resources (bandwidth, CPU bindings, flow priority etc.) */
207 mac_resource_props_t Resources;
208} VBOXNETFLTVNICTEMPLATE;
209typedef struct VBOXNETFLTVNICTEMPLATE *PVBOXNETFLTVNICTEMPLATE;
210
211/**
212 * VBOXNETFLTVNIC: Per-VNIC instance data.
213 */
214typedef struct VBOXNETFLTVNIC
215{
216 /** Magic number (VBOXNETFLTVNIC_MAGIC). */
217 uint32_t u32Magic;
218 /** Whether we created the VNIC or not. */
219 bool fCreated;
220 /** Pointer to the VNIC template if any. */
221 PVBOXNETFLTVNICTEMPLATE pVNICTemplate;
222 /** Pointer to the VirtualBox interface instance. */
223 void *pvIf;
224 /** The MAC handle. */
225 mac_handle_t hInterface;
226 /** The VNIC link ID. */
227 datalink_id_t hLinkId;
228 /** The MAC client handle */
229 mac_client_handle_t hClient;
230 /** The unicast address handle. */
231 mac_unicast_handle_t hUnicast;
232 /** The promiscuous handle. */
233 mac_promisc_handle_t hPromisc;
234 /* The VNIC name. */
235 char szName[MAXLINKNAMESPECIFIER];
236 /** Handle to the next VNIC in the list. */
237 list_node_t hNode;
238} VBOXNETFLTVNIC;
239typedef struct VBOXNETFLTVNIC *PVBOXNETFLTVNIC;
240
241
242/*******************************************************************************
243* Global Variables *
244*******************************************************************************/
245/** Global Device handle we only support one instance. */
246static dev_info_t *g_pVBoxNetFltSolarisDip = NULL;
247/** Global Mutex (actually an rw lock). */
248static RTSEMFASTMUTEX g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX;
249/** The (common) global data. */
250static VBOXNETFLTGLOBALS g_VBoxNetFltSolarisGlobals;
251/** Global next-free VNIC Id (never decrements). */
252static volatile uint64_t g_VBoxNetFltSolarisVNICId = 0;
253
254
255/*******************************************************************************
256* Internal Functions *
257*******************************************************************************/
258LOCAL mblk_t *vboxNetFltSolarisMBlkFromSG(PVBOXNETFLTINS pThis, PINTNETSG pSG, uint32_t fDst);
259LOCAL unsigned vboxNetFltSolarisMBlkCalcSGSegs(PVBOXNETFLTINS pThis, mblk_t *pMsg);
260LOCAL int vboxNetFltSolarisMBlkToSG(PVBOXNETFLTINS pThis, mblk_t *pMsg, PINTNETSG pSG, unsigned cSegs, uint32_t fSrc);
261LOCAL void vboxNetFltSolarisRecv(void *pvData, mac_resource_handle_t hResource, mblk_t *pMsg, boolean_t fLoopback);
262LOCAL void vboxNetFltSolarisAnalyzeMBlk(mblk_t *pMsg);
263LOCAL int vboxNetFltSolarisReportInfo(PVBOXNETFLTINS pThis, mac_handle_t hInterface, bool fIsVNIC);
264LOCAL int vboxNetFltSolarisInitVNIC(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC);
265LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNICTEMPLATE pVNICTemplate);
266LOCAL PVBOXNETFLTVNIC vboxNetFltSolarisAllocVNIC(void);
267LOCAL void vboxNetFltSolarisFreeVNIC(PVBOXNETFLTVNIC pVNIC);
268LOCAL void vboxNetFltSolarisDestroyVNIC(PVBOXNETFLTVNIC pVNIC);
269LOCAL int vboxNetFltSolarisCreateVNIC(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC *ppVNIC);
270LOCAL inline int vboxNetFltSolarisGetLinkId(const char *pszMacName, datalink_id_t *pLinkId);
271
272/**
273 * Kernel entry points
274 */
275int _init(void)
276{
277 Log((DEVICE_NAME ":_init\n"));
278
279 /*
280 * Prevent module autounloading.
281 */
282 modctl_t *pModCtl = mod_getctl(&g_VBoxNetFltSolarisModLinkage);
283 if (pModCtl)
284 pModCtl->mod_loadflags |= MOD_NOAUTOUNLOAD;
285 else
286 LogRel((DEVICE_NAME ":failed to disable autounloading!\n"));
287
288 /*
289 * Initialize IPRT.
290 */
291 int rc = RTR0Init(0);
292 if (RT_SUCCESS(rc))
293 {
294 /*
295 * Initialize Solaris specific globals here.
296 */
297 rc = RTSemFastMutexCreate(&g_VBoxNetFltSolarisMtx);
298 if (RT_SUCCESS(rc))
299 {
300 /*
301 * Initialize the globals and connect to the support driver.
302 *
303 * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv)
304 * for establishing the connect to the support driver.
305 */
306 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals));
307 rc = vboxNetFltInitGlobalsAndIdc(&g_VBoxNetFltSolarisGlobals);
308 if (RT_SUCCESS(rc))
309 {
310 rc = mod_install(&g_VBoxNetFltSolarisModLinkage);
311 if (!rc)
312 return rc;
313
314 LogRel((DEVICE_NAME ":mod_install failed. rc=%d\n", rc));
315 vboxNetFltTryDeleteIdcAndGlobals(&g_VBoxNetFltSolarisGlobals);
316 }
317 else
318 LogRel((DEVICE_NAME ":failed to initialize globals.\n"));
319
320 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx);
321 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX;
322 }
323
324 RTR0Term();
325 }
326 else
327 LogRel((DEVICE_NAME ":failed to initialize IPRT (rc=%d)\n", rc));
328
329 memset(&g_VBoxNetFltSolarisGlobals, 0, sizeof(g_VBoxNetFltSolarisGlobals));
330 return RTErrConvertToErrno(rc);
331}
332
333
334int _fini(void)
335{
336 int rc;
337 Log((DEVICE_NAME ":_fini\n"));
338
339 /*
340 * Undo the work done during start (in reverse order).
341 */
342 rc = vboxNetFltTryDeleteIdcAndGlobals(&g_VBoxNetFltSolarisGlobals);
343 if (RT_FAILURE(rc))
344 {
345 LogRel((DEVICE_NAME ":_fini - busy!\n"));
346 return EBUSY;
347 }
348
349 rc = mod_remove(&g_VBoxNetFltSolarisModLinkage);
350 if (!rc)
351 {
352 if (g_VBoxNetFltSolarisMtx != NIL_RTSEMFASTMUTEX)
353 {
354 RTSemFastMutexDestroy(g_VBoxNetFltSolarisMtx);
355 g_VBoxNetFltSolarisMtx = NIL_RTSEMFASTMUTEX;
356 }
357
358 RTR0Term();
359 }
360
361 return rc;
362}
363
364
365int _info(struct modinfo *pModInfo)
366{
367 Log((DEVICE_NAME ":_info\n"));
368
369 int rc = mod_info(&g_VBoxNetFltSolarisModLinkage, pModInfo);
370
371 Log((DEVICE_NAME ":_info returns %d\n", rc));
372 return rc;
373}
374
375
376/**
377 * Attach entry point, to attach a device to the system or resume it.
378 *
379 * @param pDip The module structure instance.
380 * @param enmCmd Operation type (attach/resume).
381 *
382 * @returns corresponding solaris error code.
383 */
384LOCAL int VBoxNetFltSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd)
385{
386 Log((DEVICE_NAME ":VBoxNetFltSolarisAttach pDip=%p enmCmd=%d\n", pDip, enmCmd));
387
388 switch (enmCmd)
389 {
390 case DDI_ATTACH:
391 {
392 g_pVBoxNetFltSolarisDip = pDip;
393 return DDI_SUCCESS;
394 }
395
396 case DDI_RESUME:
397 {
398 /* Nothing to do here... */
399 return DDI_SUCCESS;
400 }
401
402 /* case DDI_PM_RESUME: */
403 default:
404 return DDI_FAILURE;
405 }
406}
407
408
409/**
410 * Detach entry point, to detach a device to the system or suspend it.
411 *
412 * @param pDip The module structure instance.
413 * @param enmCmd Operation type (detach/suspend).
414 *
415 * @returns corresponding solaris error code.
416 */
417LOCAL int VBoxNetFltSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
418{
419 Log((DEVICE_NAME ":VBoxNetFltSolarisDetach pDip=%p enmCmd=%d\n", pDip, enmCmd));
420
421 switch (enmCmd)
422 {
423 case DDI_DETACH:
424 {
425 return DDI_SUCCESS;
426 }
427
428 case DDI_RESUME:
429 {
430 /* Nothing to do here... */
431 return DDI_SUCCESS;
432 }
433
434 /* case DDI_PM_SUSPEND: */
435 /* case DDI_HOT_PLUG_DETACH: */
436 default:
437 return DDI_FAILURE;
438 }
439}
440
441
442/**
443 * Info entry point, called by solaris kernel for obtaining driver info.
444 *
445 * @param pDip The module structure instance (do not use).
446 * @param enmCmd Information request type.
447 * @param pvArg Type specific argument.
448 * @param ppvResult Where to store the requested info.
449 *
450 * @returns corresponding solaris error code.
451 */
452LOCAL int VBoxNetFltSolarisGetInfo(dev_info_t *pDip, ddi_info_cmd_t enmCmd, void *pvArg, void **ppResult)
453{
454 Log((DEVICE_NAME ":VBoxNetFltSolarisGetInfo pDip=%p enmCmd=%d pArg=%p instance=%d\n", pDip, enmCmd, getminor((dev_t)pvArg)));
455
456 switch (enmCmd)
457 {
458 case DDI_INFO_DEVT2DEVINFO:
459 {
460 *ppResult = g_pVBoxNetFltSolarisDip;
461 return DDI_SUCCESS;
462 }
463
464 case DDI_INFO_DEVT2INSTANCE:
465 {
466 int instance = getminor((dev_t)pvArg);
467 *ppResult = (void *)(uintptr_t)instance;
468 return DDI_SUCCESS;
469 }
470 }
471
472 return DDI_FAILURE;
473}
474
475
476/**
477 * Create a solaris message block from the SG list.
478 *
479 * @param pThis The instance.
480 * @param pSG Pointer to the scatter-gather list.
481 *
482 * @returns Solaris message block.
483 */
484LOCAL inline mblk_t *vboxNetFltSolarisMBlkFromSG(PVBOXNETFLTINS pThis, PINTNETSG pSG, uint32_t fDst)
485{
486 Log((DEVICE_NAME ":vboxNetFltSolarisMBlkFromSG pThis=%p pSG=%p\n", pThis, pSG));
487
488 mblk_t *pMsg = allocb(pSG->cbTotal, BPRI_HI);
489 if (RT_UNLIKELY(!pMsg))
490 {
491 LogRel((DEVICE_NAME ":vboxNetFltSolarisMBlkFromSG failed to alloc %d bytes for mblk_t.\n", pSG->cbTotal));
492 return NULL;
493 }
494
495 /*
496 * Single buffer copy. Maybe later explore the
497 * need/possibility for using a mblk_t chain rather.
498 */
499 for (unsigned i = 0; i < pSG->cSegsUsed; i++)
500 {
501 if (pSG->aSegs[i].pv)
502 {
503 bcopy(pSG->aSegs[i].pv, pMsg->b_wptr, pSG->aSegs[i].cb);
504 pMsg->b_wptr += pSG->aSegs[i].cb;
505 }
506 }
507 return pMsg;
508}
509
510
511/**
512 * Calculate the number of segments required for this message block.
513 *
514 * @param pThis The instance
515 * @param pMsg Pointer to the data message.
516 *
517 * @returns Number of segments.
518 */
519LOCAL unsigned vboxNetFltSolarisMBlkCalcSGSegs(PVBOXNETFLTINS pThis, mblk_t *pMsg)
520{
521 unsigned cSegs = 0;
522 for (mblk_t *pCur = pMsg; pCur; pCur = pCur->b_cont)
523 if (MBLKL(pCur))
524 cSegs++;
525
526#ifdef PADD_RUNT_FRAMES_FROM_HOST
527 if (msgdsize(pMsg) < 60)
528 cSegs++;
529#endif
530
531 NOREF(pThis);
532 return RT_MAX(cSegs, 1);
533}
534
535
536/**
537 * Initializes an SG list from the given message block.
538 *
539 * @param pThis The instance.
540 * @param pMsg Pointer to the data message.
541 The caller must ensure it's not a control message block.
542 * @param pSG Pointer to the SG.
543 * @param cSegs Number of segments in the SG.
544 * This should match the number in the message block exactly!
545 * @param fSrc The source of the message.
546 *
547 * @returns VBox status code.
548 */
549LOCAL int vboxNetFltSolarisMBlkToSG(PVBOXNETFLTINS pThis, mblk_t *pMsg, PINTNETSG pSG, unsigned cSegs, uint32_t fSrc)
550{
551 Log((DEVICE_NAME ":vboxNetFltSolarisMBlkToSG pThis=%p pMsg=%p pSG=%p cSegs=%d\n", pThis, pMsg, pSG, cSegs));
552
553 /*
554 * Convert the message block to segments. Works cbTotal and sets cSegsUsed.
555 */
556 IntNetSgInitTempSegs(pSG, 0 /*cbTotal*/, cSegs, 0 /*cSegsUsed*/);
557 mblk_t *pCur = pMsg;
558 unsigned iSeg = 0;
559 while (pCur)
560 {
561 size_t cbSeg = MBLKL(pCur);
562 if (cbSeg)
563 {
564 void *pvSeg = pCur->b_rptr;
565 pSG->aSegs[iSeg].pv = pvSeg;
566 pSG->aSegs[iSeg].cb = cbSeg;
567 pSG->aSegs[iSeg].Phys = NIL_RTHCPHYS;
568 pSG->cbTotal += cbSeg;
569 iSeg++;
570 }
571 pCur = pCur->b_cont;
572 }
573 pSG->cSegsUsed = iSeg;
574
575#ifdef PADD_RUNT_FRAMES_FROM_HOST
576 if (pSG->cbTotal < 60 && (fSrc & INTNETTRUNKDIR_HOST))
577 {
578 Log((DEVICE_NAME ":vboxNetFltSolarisMBlkToSG pulling up to length.\n"));
579
580 static uint8_t const s_abZero[128] = {0};
581 pSG->aSegs[iSeg].Phys = NIL_RTHCPHYS;
582 pSG->aSegs[iSeg].pv = (void *)&s_abZero[0];
583 pSG->aSegs[iSeg].cb = 60 - pSG->cbTotal;
584 pSG->cbTotal = 60;
585 pSG->cSegsUsed++;
586 Assert(iSeg + 1 < cSegs);
587 }
588#endif
589
590 Log((DEVICE_NAME ":vboxNetFltSolarisMBlkToSG iSeg=%d pSG->cbTotal=%d msgdsize=%d\n", iSeg, pSG->cbTotal, msgdsize(pMsg)));
591 return VINF_SUCCESS;
592}
593
594
595/**
596 * Simple packet dump, used for internal debugging.
597 *
598 * @param pMsg Pointer to the message to analyze and dump.
599 */
600LOCAL void vboxNetFltSolarisAnalyzeMBlk(mblk_t *pMsg)
601{
602 LogFunc((DEVICE_NAME ":vboxNetFltSolarisAnalyzeMBlk pMsg=%p\n", pMsg));
603
604 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr;
605 uint8_t *pb = pMsg->b_rptr;
606 if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV4))
607 {
608 PRTNETIPV4 pIpHdr = (PRTNETIPV4)(pEthHdr + 1);
609 if (!pMsg->b_cont)
610 {
611 if (pIpHdr->ip_p == RTNETIPV4_PROT_ICMP)
612 LogRel((DEVICE_NAME ":ICMP D=%.6Rhxs S=%.6Rhxs T=%04x\n", pb, pb + 6, RT_BE2H_U16(*(uint16_t *)(pb + 12))));
613 else if (pIpHdr->ip_p == RTNETIPV4_PROT_TCP)
614 LogRel((DEVICE_NAME ":TCP D=%.6Rhxs S=%.6Rhxs\n", pb, pb + 6));
615 else if (pIpHdr->ip_p == RTNETIPV4_PROT_UDP)
616 {
617 PCRTNETUDP pUdpHdr = (PCRTNETUDP)((uint32_t *)pIpHdr + pIpHdr->ip_hl);
618 if ( RT_BE2H_U16(pUdpHdr->uh_sport) == 67
619 && RT_BE2H_U16(pUdpHdr->uh_dport) == 68)
620 {
621 LogRel((DEVICE_NAME ":UDP bootp ack D=%.6Rhxs S=%.6Rhxs UDP_CheckSum=%04x Computex=%04x\n", pb, pb + 6,
622 RT_BE2H_U16(pUdpHdr->uh_sum), RT_BE2H_U16(RTNetIPv4UDPChecksum(pIpHdr, pUdpHdr, pUdpHdr + 1))));
623 }
624 }
625 }
626 else
627 {
628 Log((DEVICE_NAME ":Chained IP packet. Skipping validity check.\n"));
629 }
630 }
631 else if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_VLAN))
632 {
633 PVLANHEADER pVlanHdr = (PVLANHEADER)(pMsg->b_rptr + sizeof(RTNETETHERHDR) - sizeof(pEthHdr->EtherType));
634 LogRel((DEVICE_NAME ":VLAN Pcp=%u Cfi=%u Id=%u\n", VLAN_PRI(RT_BE2H_U16(pVlanHdr->Data)),
635 VLAN_CFI(RT_BE2H_U16(pVlanHdr->Data)), VLAN_ID(RT_BE2H_U16(pVlanHdr->Data))));
636 LogRel((DEVICE_NAME "%.*Rhxd\n", sizeof(VLANHEADER), pVlanHdr));
637 }
638 else if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_ARP))
639 {
640 PRTNETARPHDR pArpHdr = (PRTNETARPHDR)(pEthHdr + 1);
641 LogRel((DEVICE_NAME ":ARP Op=%d\n", pArpHdr->ar_oper));
642 }
643 else if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV6))
644 {
645 LogRel((DEVICE_NAME ":IPv6 D=%.6Rhxs S=%.6Rhxs\n", pb, pb + 6));
646 }
647 else if ( pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPX_1)
648 || pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPX_2)
649 || pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPX_3))
650 {
651 LogRel((DEVICE_NAME ":IPX packet.\n"));
652 }
653 else
654 {
655 LogRel((DEVICE_NAME ":Unknown EtherType=%x D=%.6Rhxs S=%.6Rhxs\n", RT_H2BE_U16(pEthHdr->EtherType), &pEthHdr->DstMac,
656 &pEthHdr->SrcMac));
657 /* Log((DEVICE_NAME ":%.*Rhxd\n", MBLKL(pMsg), pMsg->b_rptr)); */
658 }
659}
660
661
662/**
663 * Helper.
664 */
665DECLINLINE(bool) vboxNetFltPortSolarisIsHostMac(PVBOXNETFLTINS pThis, PCRTMAC pMac)
666{
667 return pThis->u.s.MacAddr.au16[0] == pMac->au16[0]
668 && pThis->u.s.MacAddr.au16[1] == pMac->au16[1]
669 && pThis->u.s.MacAddr.au16[2] == pMac->au16[2];
670}
671
672
673/**
674 * Receive (rx) entry point.
675 *
676 * @param pvData Private data.
677 * @param hResource The resource handle.
678 * @param pMsg The packet.
679 * @param fLoopback Whether this is a loopback packet or not.
680 */
681LOCAL void vboxNetFltSolarisRecv(void *pvData, mac_resource_handle_t hResource, mblk_t *pMsg, boolean_t fLoopback)
682{
683 Log((DEVICE_NAME ":vboxNetFltSolarisRecv pvData=%p pMsg=%p fLoopback=%d cbData=%d\n", pvData, pMsg, fLoopback,
684 pMsg ? MBLKL(pMsg) : 0));
685
686 PVBOXNETFLTINS pThis = (PVBOXNETFLTINS)pvData;
687 AssertPtrReturnVoid(pThis);
688 AssertPtrReturnVoid(pMsg);
689
690 /*
691 * Active? Retain the instance and increment the busy counter.
692 */
693 if (!vboxNetFltTryRetainBusyActive(pThis))
694 {
695 freemsgchain(pMsg);
696 return;
697 }
698
699 uint32_t fSrc = INTNETTRUNKDIR_WIRE;
700 PRTNETETHERHDR pEthHdr = (PRTNETETHERHDR)pMsg->b_rptr;
701 if ( MBLKL(pMsg) >= sizeof(RTNETETHERHDR)
702 && vboxNetFltPortSolarisIsHostMac(pThis, &pEthHdr->SrcMac))
703 fSrc = INTNETTRUNKDIR_HOST;
704
705 /*
706 * Route all received packets into the internal network.
707 */
708 uint16_t cFailed = 0;
709 for (mblk_t *pCurMsg = pMsg; pCurMsg != NULL; pCurMsg = pCurMsg->b_next)
710 {
711 unsigned cSegs = vboxNetFltSolarisMBlkCalcSGSegs(pThis, pCurMsg);
712 PINTNETSG pSG = (PINTNETSG)alloca(RT_OFFSETOF(INTNETSG, aSegs[cSegs]));
713 int rc = vboxNetFltSolarisMBlkToSG(pThis, pMsg, pSG, cSegs, fSrc);
714 if (RT_SUCCESS(rc))
715 pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL, pSG, fSrc);
716 else
717 cFailed++;
718 }
719 vboxNetFltRelease(pThis, true /* fBusy */);
720
721 if (RT_UNLIKELY(cFailed))
722 LogRel((DEVICE_NAME ":vboxNetFltSolarisMBlkToSG failed for %u packets.\n", cFailed));
723
724 freemsgchain(pMsg);
725
726 NOREF(hResource);
727}
728
729
730#if 0
731/**
732 * MAC layer link notification hook.
733 *
734 * @param pvArg Opaque pointer to the instance.
735 * @param Type Notification Type.
736 *
737 * @remarks This hook will be invoked for various changes to the underlying
738 * interface even when VMs aren't running so don't do any funky stuff
739 * here.
740 */
741LOCAL void vboxNetFltSolarisLinkNotify(void *pvArg, mac_notify_type_t Type)
742{
743 LogRel((DEVICE_NAME ":vboxNetFltSolarisLinkNotify pvArg=%p Type=%d\n", pvArg, Type));
744
745 PVBOXNETFLTINS pThis = pvArg;
746 AssertReturnVoid(VALID_PTR(pThis));
747 AssertReturnVoid(pThis->u.s.hInterface);
748
749 switch (Type)
750 {
751 case MAC_NOTE_LINK:
752 {
753 LogRel((DEVICE_NAME ":vboxNetFltSolarisLinkNotify link state change\n"));
754 link_state_t hLinkState = mac_stat_get(pThis->u.s.hInterface, MAC_STAT_LINK_STATE);
755 bool fDisconnectedFromHost = hLinkState == LINK_STATE_UP ? false : true;
756 if (fDisconnectedFromHost != ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost))
757 {
758 ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, fDisconnectedFromHost);
759 LogRel((DEVICE_NAME ":vboxNetFltSolarisLinkNotify link state change: new state=%s\n",
760 fDisconnectedFromHost ? "DOWN" : "UP"));
761 }
762 break;
763 }
764
765 default:
766 return;
767 }
768}
769#endif
770
771
772/**
773 * Report capabilities and MAC address to IntNet after obtaining the MAC address
774 * of the underlying interface for a VNIC or the current interface if it's a
775 * physical/ether-stub interface.
776 *
777 * @param pThis The instance.
778 * @param hInterface The Interface handle.
779 * @param fIsVNIC Whether this interface handle corresponds to a VNIC
780 * or not.
781 *
782 * @remarks Retains the instance while doing it's job.
783 * @returns VBox status code.
784 */
785LOCAL int vboxNetFltSolarisReportInfo(PVBOXNETFLTINS pThis, mac_handle_t hInterface, bool fIsVNIC)
786{
787 mac_handle_t hLowerMac = NULL;
788 if (!fIsVNIC)
789 hLowerMac = hInterface;
790 else
791 {
792 hLowerMac = mac_get_lower_mac_handle(hInterface);
793 if (RT_UNLIKELY(!hLowerMac))
794 {
795 LogRel((DEVICE_NAME ":vboxNetFltSolarisReportInfo failed to get lower MAC handle for '%s'\n", pThis->szName));
796 return VERR_INVALID_HANDLE;
797 }
798 }
799
800 pThis->u.s.hInterface = hLowerMac;
801
802#if 0
803 /*
804 * Try setup link notification hooks, this might fail if mac_no_notification()
805 * doesn't support it. We won't bother using the private function since link notification
806 * isn't critical for us and ignore failures.
807 */
808 pThis->u.s.hNotify = mac_notify_add(hLowerMac, vboxNetFltSolarisLinkNotify, pThis);
809 if (!pThis->u.s.hNotify)
810 LogRel((DEVICE_NAME ":vboxNetFltSolarisReportInfo Warning! Failed to setup link notification hook.\n"));
811#endif
812
813 mac_unicast_primary_get(hLowerMac, (uint8_t *)pThis->u.s.MacAddr.au8);
814 if (vboxNetFltTryRetainBusyNotDisconnected(pThis))
815 {
816 Assert(pThis->pSwitchPort);
817 Log((DEVICE_NAME ":vboxNetFltSolarisReportInfo phys mac %.6Rhxs\n", &pThis->u.s.MacAddr));
818 pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr);
819 pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, false); /** @todo Promisc */
820 pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
821 pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
822 vboxNetFltRelease(pThis, true /*fBusy*/);
823 return VINF_SUCCESS;
824 }
825 else
826 LogRel((DEVICE_NAME ":vboxNetFltSolarisReportInfo failed to retain interface. pThis=%p\n", pThis));
827
828 return VERR_INTNET_FLT_IF_BUSY;
829}
830
831
832/**
833 * Initialize a VNIC, optionally from a template.
834 *
835 * @param pThis The instance.
836 * @param pVNIC Pointer to the VNIC.
837 * @param pVNICTemplate Pointer to the VNIC template initialize from, can be
838 * NULL.
839 *
840 * @returns VBox status code.
841 */
842LOCAL int vboxNetFltSolarisInitVNIC(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC)
843{
844 /*
845 * Some paranoia.
846 */
847 AssertReturn(pThis, VERR_INVALID_PARAMETER);
848 AssertReturn(pVNIC, VERR_INVALID_PARAMETER);
849 AssertReturn(pVNIC->hInterface, VERR_INVALID_POINTER);
850 AssertReturn(pVNIC->hLinkId != DATALINK_INVALID_LINKID, VERR_INVALID_HANDLE);
851 AssertReturn(!pVNIC->hClient, VERR_INVALID_POINTER);
852
853 int rc = mac_client_open(pVNIC->hInterface, &pVNIC->hClient,
854 NULL, /* name of this client */
855 MAC_OPEN_FLAGS_USE_DATALINK_NAME | /* client name same as underlying NIC */
856 MAC_OPEN_FLAGS_MULTI_PRIMARY /* allow multiple primary unicasts */
857 );
858 if (RT_LIKELY(!rc))
859 {
860 if (pVNIC->pVNICTemplate)
861 rc = mac_client_set_resources(pVNIC->hClient, &pVNIC->pVNICTemplate->Resources);
862
863 if (RT_LIKELY(!rc))
864 {
865 Log((DEVICE_NAME ":vboxNetFltSolarisInitVNIC succesfully initialized VNIC.\n"));
866 return VINF_SUCCESS;
867 }
868 else
869 {
870 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNIC mac_client_set_resources failed. rc=%d\n", rc));
871 rc = VERR_INTNET_FLT_VNIC_CREATE_FAILED;
872 }
873
874 mac_client_close(pVNIC->hClient, 0 /* flags */);
875 pVNIC->hClient = NULL;
876 }
877 else
878 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNIC failed to open mac client for '%s' rc=%d\n", pThis->szName, rc));
879
880 return rc;
881}
882
883
884/**
885 * Initializes the VNIC template. This involves opening the template VNIC to
886 * retreive info. like the VLAN Id, underlying MAC address etc.
887 *
888 * @param pThis The VM connection instance.
889 * @param pVNICTemplate Pointer to a VNIC template to initialize.
890 *
891 * @returns VBox status code.
892 */
893LOCAL int vboxNetFltSolarisInitVNICTemplate(PVBOXNETFLTINS pThis, PVBOXNETFLTVNICTEMPLATE pVNICTemplate)
894{
895 Log((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate pThis=%p pVNICTemplate=%p\n", pThis, pVNICTemplate));
896
897 AssertReturn(pVNICTemplate, VERR_INVALID_PARAMETER);
898 AssertReturn(pThis->u.s.fIsVNICTemplate == true, VERR_INVALID_STATE);
899
900 /*
901 * Get the VNIC template's datalink ID.
902 */
903 datalink_id_t VNICLinkId;
904 int rc = vboxNetFltSolarisGetLinkId(pThis->szName, &VNICLinkId);
905 if (RT_SUCCESS(rc))
906 {
907 /*
908 * Open the VNIC to obtain a MAC handle so as to retreive the VLAN ID.
909 */
910 mac_handle_t hInterface;
911 rc = mac_open_by_linkid(VNICLinkId, &hInterface);
912 if (!rc)
913 {
914 /*
915 * Get the underlying linkname.
916 */
917 mac_handle_t hPhysLinkHandle = mac_get_lower_mac_handle(hInterface);
918 if (RT_LIKELY(hPhysLinkHandle))
919 {
920 const char *pszLinkName = mac_name(hPhysLinkHandle);
921 rc = RTStrCopy(pVNICTemplate->szLinkName, sizeof(pVNICTemplate->szLinkName), pszLinkName);
922 if (RT_SUCCESS(rc))
923 {
924 /*
925 * Now open the VNIC template to retrieve the VLAN Id & resources.
926 */
927 mac_client_handle_t hClient;
928 rc = mac_client_open(hInterface, &hClient,
929 NULL, /* name of this client */
930 MAC_OPEN_FLAGS_USE_DATALINK_NAME | /* client name same as underlying NIC */
931 MAC_OPEN_FLAGS_MULTI_PRIMARY /* allow multiple primary unicasts */
932 );
933 if (RT_LIKELY(!rc))
934 {
935 pVNICTemplate->uVLANId = mac_client_vid(hClient);
936 mac_client_get_resources(hClient, &pVNICTemplate->Resources);
937 mac_client_close(hClient, 0 /* fFlags */);
938 mac_close(hInterface);
939
940 Log((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate successfully init. VNIC template. szLinkName=%s\n",
941 pVNICTemplate->szLinkName));
942 return VINF_SUCCESS;
943 }
944 else
945 {
946 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate failed to open VNIC template. rc=%d\n", rc));
947 rc = VERR_INTNET_FLT_IF_FAILED;
948 }
949 }
950 else
951 {
952 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate failed to copy link name of underlying interface"
953 ". rc=%d\n", rc));
954 }
955 }
956 else
957 {
958 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate failed to get lower handle for VNIC template '%s'.\n",
959 pThis->szName));
960 rc = VERR_INTNET_FLT_IF_FAILED;
961 }
962
963 mac_close(hInterface);
964 }
965 else
966 {
967 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate failed to open by link ID. rc=%d\n", rc));
968 rc = VERR_INTNET_FLT_IF_FAILED;
969 }
970 }
971 else
972 LogRel((DEVICE_NAME ":vboxNetFltSolarisInitVNICTemplate failed to get VNIC template link Id. rc=%d\n", rc));
973
974 return rc;
975}
976
977
978/**
979 * Allocate a VNIC structure.
980 *
981 * @returns An allocated VNIC structure or NULL in case of errors.
982 */
983LOCAL PVBOXNETFLTVNIC vboxNetFltSolarisAllocVNIC(void)
984{
985 PVBOXNETFLTVNIC pVNIC = RTMemAllocZ(sizeof(VBOXNETFLTVNIC));
986 if (RT_UNLIKELY(!pVNIC))
987 return NULL;
988
989 pVNIC->u32Magic = VBOXNETFLTVNIC_MAGIC;
990 pVNIC->fCreated = false;
991 pVNIC->pVNICTemplate = NULL;
992 pVNIC->pvIf = NULL;
993 pVNIC->hInterface = NULL;
994 pVNIC->hLinkId = DATALINK_INVALID_LINKID;
995 pVNIC->hClient = NULL;
996 pVNIC->hUnicast = NULL;
997 pVNIC->hPromisc = NULL;
998 RT_ZERO(pVNIC->szName);
999 list_link_init(&pVNIC->hNode);
1000 return pVNIC;
1001}
1002
1003
1004/**
1005 * Frees an allocated VNIC.
1006 *
1007 * @param pVNIC Pointer to the VNIC.
1008 */
1009LOCAL inline void vboxNetFltSolarisFreeVNIC(PVBOXNETFLTVNIC pVNIC)
1010{
1011 RTMemFree(pVNIC);
1012}
1013
1014
1015/**
1016 * Destroy a created VNIC if it was created by us, or just
1017 * de-initializes the VNIC freeing up resources handles.
1018 *
1019 * @param pVNIC Pointer to the VNIC.
1020 */
1021LOCAL void vboxNetFltSolarisDestroyVNIC(PVBOXNETFLTVNIC pVNIC)
1022{
1023 AssertPtrReturnVoid(pVNIC);
1024 AssertMsgReturnVoid(pVNIC->u32Magic == VBOXNETFLTVNIC_MAGIC, ("pVNIC=%p u32Magic=%#x\n", pVNIC, pVNIC->u32Magic));
1025 if (pVNIC)
1026 {
1027 if (pVNIC->hClient)
1028 {
1029#if 0
1030 if (pVNIC->hUnicast)
1031 {
1032 mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast);
1033 pVNIC->hUnicast = NULL;
1034 }
1035#endif
1036
1037 if (pVNIC->hPromisc)
1038 {
1039 mac_promisc_remove(pVNIC->hPromisc);
1040 pVNIC->hPromisc = NULL;
1041 }
1042
1043 mac_rx_clear(pVNIC->hClient);
1044
1045 mac_client_close(pVNIC->hClient, 0 /* fFlags */);
1046 pVNIC->hClient = NULL;
1047 }
1048
1049 if (pVNIC->hInterface)
1050 {
1051 mac_close(pVNIC->hInterface);
1052 pVNIC->hInterface = NULL;
1053 }
1054
1055 if (pVNIC->fCreated)
1056 {
1057 vnic_delete(pVNIC->hLinkId, 0 /* Flags */);
1058 pVNIC->hLinkId = DATALINK_INVALID_LINKID;
1059 pVNIC->fCreated = false;
1060 }
1061
1062 if (pVNIC->pVNICTemplate)
1063 {
1064 RTMemFree(pVNIC->pVNICTemplate);
1065 pVNIC->pVNICTemplate = NULL;
1066 }
1067 }
1068}
1069
1070
1071/**
1072 * Create a non-persistent VNIC over the given interface.
1073 *
1074 * @param pThis The VM connection instance.
1075 * @param ppVNIC Where to store the created VNIC.
1076 *
1077 * @returns VBox status code.
1078 */
1079LOCAL int vboxNetFltSolarisCreateVNIC(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC *ppVNIC)
1080{
1081 Log((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC pThis=%p\n", pThis));
1082
1083 AssertReturn(pThis, VERR_INVALID_POINTER);
1084 AssertReturn(ppVNIC, VERR_INVALID_POINTER);
1085
1086 int rc = VERR_INVALID_STATE;
1087 PVBOXNETFLTVNIC pVNIC = vboxNetFltSolarisAllocVNIC();
1088 if (RT_UNLIKELY(!pVNIC))
1089 return VERR_NO_MEMORY;
1090
1091 /*
1092 * Set a random MAC address for now. It will be changed to the VM interface's
1093 * MAC address later, see vboxNetFltPortOsNotifyMacAddress().
1094 */
1095 RTMAC GuestMac;
1096 GuestMac.au8[0] = 0x08;
1097 GuestMac.au8[1] = 0x00;
1098 GuestMac.au8[2] = 0x27;
1099 RTRandBytes(&GuestMac.au8[3], 3);
1100
1101 AssertCompile(sizeof(RTMAC) <= MAXMACADDRLEN);
1102
1103 const char *pszLinkName = pThis->szName;
1104 uint16_t uVLANId = VLAN_ID_NONE;
1105 vnic_mac_addr_type_t AddrType = VNIC_MAC_ADDR_TYPE_FIXED;
1106 vnic_ioc_diag_t Diag = VNIC_IOC_DIAG_NONE;
1107 int MacSlot = 0;
1108 int MacLen = sizeof(GuestMac);
1109 uint32_t fFlags = 0;
1110
1111 if (pThis->u.s.fIsVNICTemplate)
1112 {
1113 pVNIC->pVNICTemplate = RTMemAllocZ(sizeof(VBOXNETFLTVNICTEMPLATE));
1114 if (RT_UNLIKELY(!pVNIC->pVNICTemplate))
1115 {
1116 vboxNetFltSolarisFreeVNIC(pVNIC);
1117 return VERR_NO_MEMORY;
1118 }
1119
1120 /*
1121 * Initialize the VNIC template.
1122 */
1123 rc = vboxNetFltSolarisInitVNICTemplate(pThis, pVNIC->pVNICTemplate);
1124 if (RT_FAILURE(rc))
1125 {
1126 LogRel((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC failed to initialize VNIC from VNIC template. rc=%Rrc\n", rc));
1127 vboxNetFltSolarisFreeVNIC(pVNIC);
1128 return rc;
1129 }
1130
1131 pszLinkName = pVNIC->pVNICTemplate->szLinkName;
1132 uVLANId = pVNIC->pVNICTemplate->uVLANId;
1133#if 0
1134 /*
1135 * Required only if we're creating a VLAN interface & not a VNIC with a VLAN Id.
1136 */
1137 if (uVLANId != VLAN_ID_NONE)
1138 fFlags |= MAC_VLAN;
1139#endif
1140 Log((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC pThis=%p VLAN Id=%u\n", pThis, uVLANId));
1141 }
1142
1143 /*
1144 * Create the VNIC under 'pszLinkName', which can be the one from the VNIC template or can
1145 * be a physical interface.
1146 */
1147 rc = RTSemFastMutexRequest(g_VBoxNetFltSolarisMtx); AssertRC(rc);
1148 RTStrPrintf(pVNIC->szName, sizeof(pVNIC->szName), "%s%RU64", VBOXBOW_VNIC_NAME, g_VBoxNetFltSolarisVNICId);
1149 rc = vnic_create(pVNIC->szName, pszLinkName, &AddrType, &MacLen, GuestMac.au8, &MacSlot, 0 /* Mac-Prefix Length */, uVLANId,
1150 fFlags, &pVNIC->hLinkId, &Diag, NULL /* Reserved */);
1151 if (!rc)
1152 {
1153 pVNIC->fCreated = true;
1154 ASMAtomicIncU64(&g_VBoxNetFltSolarisVNICId);
1155 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx);
1156
1157 /*
1158 * Now try opening the created VNIC.
1159 */
1160 rc = mac_open_by_linkid(pVNIC->hLinkId, &pVNIC->hInterface);
1161 if (!rc)
1162 {
1163 /*
1164 * Initialize the VNIC from the physical interface or the VNIC template.
1165 */
1166 rc = vboxNetFltSolarisInitVNIC(pThis, pVNIC);
1167 if (RT_SUCCESS(rc))
1168 {
1169 Log((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC created VNIC '%s' over '%s' with random mac %.6Rhxs\n",
1170 pVNIC->szName, pszLinkName, &GuestMac));
1171 *ppVNIC = pVNIC;
1172 return VINF_SUCCESS;
1173 }
1174 else
1175 LogRel((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC vboxNetFltSolarisInitVNIC failed. rc=%d\n", rc));
1176
1177 mac_close(pVNIC->hInterface);
1178 pVNIC->hInterface = NULL;
1179 }
1180 else
1181 {
1182 LogRel((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC failed to open VNIC '%s' over '%s'. rc=%d\n", pVNIC->szName,
1183 pThis->szName, rc));
1184 }
1185
1186 vboxNetFltSolarisDestroyVNIC(pVNIC);
1187 rc = VERR_INTNET_FLT_VNIC_CREATE_FAILED;
1188 }
1189 else
1190 {
1191 RTSemFastMutexRelease(g_VBoxNetFltSolarisMtx);
1192
1193 LogRel((DEVICE_NAME ":vboxNetFltSolarisCreateVNIC failed to create VNIC '%s' over '%s' rc=%d Diag=%d\n", pVNIC->szName,
1194 pszLinkName, rc, Diag));
1195 rc = VERR_INTNET_FLT_VNIC_CREATE_FAILED;
1196 }
1197
1198 vboxNetFltSolarisFreeVNIC(pVNIC);
1199
1200 return rc;
1201}
1202
1203
1204/**
1205 * Wrapper for getting the datalink ID given the MAC name.
1206 *
1207 * @param pszMacName The MAC name.
1208 * @param pLinkId Where to store the datalink ID.
1209 *
1210 * @returns VBox status code.
1211 */
1212LOCAL inline int vboxNetFltSolarisGetLinkId(const char *pszMacName, datalink_id_t *pLinkId)
1213{
1214 /*
1215 * dls_mgmt_get_linkid() requires to be in a state to answer upcalls. We should always use this
1216 * first before resorting to other means to retrieve the MAC name.
1217 */
1218 int rc = dls_mgmt_get_linkid(pszMacName, pLinkId);
1219 if (rc)
1220 rc = dls_devnet_macname2linkid(pszMacName, pLinkId);
1221
1222 if (RT_LIKELY(!rc))
1223 return VINF_SUCCESS;
1224
1225 LogRel((DEVICE_NAME ":vboxNetFltSolarisGetLinkId failed for '%s'. rc=%d\n", pszMacName, rc));
1226 return RTErrConvertFromErrno(rc);
1227}
1228
1229
1230/**
1231 * Set the promiscuous mode RX hook.
1232 *
1233 * @param pThis The VM connection instance.
1234 * @param pVNIC Pointer to the VNIC.
1235 *
1236 * @returns VBox status code.
1237 */
1238LOCAL inline int vboxNetFltSolarisSetPromisc(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC)
1239{
1240 int rc = VINF_SUCCESS;
1241 if (!pVNIC->hPromisc)
1242 {
1243 rc = mac_promisc_add(pVNIC->hClient, MAC_CLIENT_PROMISC_FILTERED, vboxNetFltSolarisRecv, pThis, &pVNIC->hPromisc,
1244 MAC_PROMISC_FLAGS_NO_TX_LOOP | MAC_PROMISC_FLAGS_VLAN_TAG_STRIP | MAC_PROMISC_FLAGS_NO_PHYS);
1245 if (RT_UNLIKELY(rc))
1246 LogRel((DEVICE_NAME ":vboxNetFltSolarisSetPromisc failed. rc=%d\n", rc));
1247 rc = RTErrConvertFromErrno(rc);
1248 }
1249 return rc;
1250}
1251
1252
1253/**
1254 * Clear the promiscuous mode RX hook.
1255 *
1256 * @param pThis The VM connection instance.
1257 * @param pVNIC Pointer to the VNIC.
1258 */
1259LOCAL inline void vboxNetFltSolarisRemovePromisc(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC)
1260{
1261 if (pVNIC->hPromisc)
1262 {
1263 mac_promisc_remove(pVNIC->hPromisc);
1264 pVNIC->hPromisc = NULL;
1265 }
1266}
1267
1268
1269/* -=-=-=-=-=- Common Hooks -=-=-=-=-=- */
1270
1271
1272void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive)
1273{
1274 Log((DEVICE_NAME ":vboxNetFltPortOsSetActive pThis=%p fActive=%d\n", pThis, fActive));
1275
1276 /*
1277 * Reactivate/quiesce the interface.
1278 */
1279 PVBOXNETFLTVNIC pVNIC = list_head(&pThis->u.s.hVNICs);
1280 if (fActive)
1281 {
1282 for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC))
1283 if (pVNIC->hClient)
1284 {
1285#if 0
1286 mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis);
1287#endif
1288 vboxNetFltSolarisSetPromisc(pThis, pVNIC);
1289 }
1290 }
1291 else
1292 {
1293 for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC))
1294 if (pVNIC->hClient)
1295 {
1296#if 0
1297 mac_rx_clear(pVNIC->hClient);
1298#endif
1299 vboxNetFltSolarisRemovePromisc(pThis, pVNIC);
1300 }
1301 }
1302}
1303
1304
1305int vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis)
1306{
1307 Log((DEVICE_NAME ":vboxNetFltOsDisconnectIt pThis=%p\n", pThis));
1308 return VINF_SUCCESS;
1309}
1310
1311
1312int vboxNetFltOsConnectIt(PVBOXNETFLTINS pThis)
1313{
1314 Log((DEVICE_NAME ":vboxNetFltOsConnectIt pThis=%p\n", pThis));
1315 return VINF_SUCCESS;
1316}
1317
1318
1319void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
1320{
1321 Log((DEVICE_NAME ":vboxNetFltOsDeleteInstance pThis=%p\n", pThis));
1322
1323 if (pThis->u.s.hNotify)
1324 mac_notify_remove(pThis->u.s.hNotify, B_TRUE /* Wait */);
1325
1326 /*
1327 * Destroy all managed VNICs. If a VNIC was passed to us, there
1328 * will be only 1 item in the list, otherwise as many interfaces
1329 * that were somehow not destroyed using DisconnectInterface() will be
1330 * present.
1331 */
1332 PVBOXNETFLTVNIC pVNIC = NULL;
1333 while ((pVNIC = list_remove_head(&pThis->u.s.hVNICs)) != NULL)
1334 {
1335 vboxNetFltSolarisDestroyVNIC(pVNIC);
1336 vboxNetFltSolarisFreeVNIC(pVNIC);
1337 }
1338
1339 list_destroy(&pThis->u.s.hVNICs);
1340}
1341
1342
1343int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
1344{
1345 Log((DEVICE_NAME ":vboxNetFltOsInitInstance pThis=%p pvContext=%p\n", pThis, pvContext));
1346
1347 /*
1348 * Figure out if the interface is a VNIC or a physical/etherstub/whatever NIC, then
1349 * do the actual VNIC creation if necessary in vboxNetFltPortOsConnectInterface().
1350 */
1351 mac_handle_t hInterface;
1352 int rc = mac_open_by_linkname(pThis->szName, &hInterface);
1353 if (RT_LIKELY(!rc))
1354 {
1355 rc = mac_is_vnic(hInterface);
1356 if (!rc)
1357 {
1358 Log((DEVICE_NAME ":vboxNetFltOsInitInstance pThis=%p physical interface '%s' detected.\n", pThis, pThis->szName));
1359 pThis->u.s.fIsVNIC = false;
1360 }
1361 else
1362 {
1363 pThis->u.s.fIsVNIC = true;
1364 if (RTStrNCmp(pThis->szName, VBOXBOW_VNIC_TEMPLATE_NAME, sizeof(VBOXBOW_VNIC_TEMPLATE_NAME) - 1) == 0)
1365 {
1366 Log((DEVICE_NAME ":vboxNetFltOsInitInstance pThis=%p VNIC template '%s' detected.\n", pThis, pThis->szName));
1367 pThis->u.s.fIsVNICTemplate = true;
1368 }
1369 }
1370
1371 if ( pThis->u.s.fIsVNIC
1372 && !pThis->u.s.fIsVNICTemplate)
1373 Log((DEVICE_NAME ":vboxNetFltOsInitInstance pThis=%p VNIC '%s' detected.\n", pThis, pThis->szName));
1374
1375 /*
1376 * Report info. (host MAC address, promiscuous, GSO capabilities etc.) to IntNet.
1377 */
1378 rc = vboxNetFltSolarisReportInfo(pThis, hInterface, pThis->u.s.fIsVNIC);
1379 if (RT_FAILURE(rc))
1380 LogRel((DEVICE_NAME ":vboxNetFltOsInitInstance failed to report info. rc=%d\n", rc));
1381
1382 mac_close(hInterface);
1383 }
1384 else
1385 {
1386 LogRel((DEVICE_NAME ":vboxNetFltOsInitInstance failed to open link '%s'! rc=%d\n", pThis->szName, rc));
1387 rc = VERR_INTNET_FLT_IF_FAILED;
1388 }
1389
1390 return rc;
1391}
1392
1393
1394int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis)
1395{
1396 /*
1397 * Init. the solaris specific data.
1398 */
1399 pThis->u.s.fIsVNIC = false;
1400 pThis->u.s.fIsVNICTemplate = false;
1401 list_create(&pThis->u.s.hVNICs, sizeof(VBOXNETFLTVNIC), offsetof(VBOXNETFLTVNIC, hNode));
1402 pThis->u.s.hNotify = NULL;
1403 RT_ZERO(pThis->u.s.MacAddr);
1404 return VINF_SUCCESS;
1405}
1406
1407
1408bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis)
1409{
1410 /*
1411 * @todo Think about this.
1412 */
1413 return false;
1414}
1415
1416
1417int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst)
1418{
1419 /*
1420 * Validate parameters.
1421 */
1422 PVBOXNETFLTVNIC pVNIC = pvIfData;
1423 AssertReturn(VALID_PTR(pVNIC), VERR_INVALID_POINTER);
1424 AssertMsgReturn(pVNIC->u32Magic == VBOXNETFLTVNIC_MAGIC,
1425 ("Invalid magic=%#x (expected %#x)\n", pVNIC->u32Magic, VBOXNETFLTVNIC_MAGIC),
1426 VERR_INVALID_MAGIC);
1427
1428 /*
1429 * Xmit the packet down the appropriate VNIC interface.
1430 */
1431 int rc = VINF_SUCCESS;
1432 mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst);
1433 if (RT_LIKELY(pMsg))
1434 {
1435 Log((DEVICE_NAME ":vboxNetFltPortOsXmit pThis=%p cbData=%d\n", pThis, MBLKL(pMsg)));
1436
1437 mac_tx_cookie_t pXmitCookie = mac_tx(pVNIC->hClient, pMsg, 0 /* Hint */, MAC_DROP_ON_NO_DESC, NULL /* return message */);
1438 if (RT_LIKELY(!pXmitCookie))
1439 return VINF_SUCCESS;
1440
1441 pMsg = NULL;
1442 rc = VERR_NET_IO_ERROR;
1443 LogRel((DEVICE_NAME ":vboxNetFltPortOsXmit Xmit failed pVNIC=%p.\n", pVNIC));
1444 }
1445 else
1446 {
1447 LogRel((DEVICE_NAME ":vboxNetFltPortOsXmit no memory for allocating Xmit packet.\n"));
1448 rc = VERR_NO_MEMORY;
1449 }
1450
1451 return rc;
1452}
1453
1454
1455void vboxNetFltPortOsNotifyMacAddress(PVBOXNETFLTINS pThis, void *pvIfData, PCRTMAC pMac)
1456{
1457 Log((DEVICE_NAME ":vboxNetFltPortOSNotifyMacAddress pszIf=%s pszVNIC=%s MAC=%.6Rhxs\n", pThis->szName,
1458 ((PVBOXNETFLTVNIC)pvIfData)->szName, pMac));
1459
1460 /*
1461 * Validate parameters.
1462 */
1463 PVBOXNETFLTVNIC pVNIC = pvIfData;
1464 AssertMsgReturnVoid(VALID_PTR(pVNIC) && pVNIC->u32Magic == VBOXNETFLTVNIC_MAGIC,
1465 ("Invalid pVNIC=%p magic=%#x (expected %#x)\n", pvIfData,
1466 VALID_PTR(pVNIC) ? pVNIC->u32Magic : 0, VBOXNETFLTVNIC_MAGIC));
1467 AssertMsgReturnVoid(pVNIC->hLinkId != DATALINK_INVALID_LINKID,
1468 ("Invalid hLinkId pVNIC=%p magic=%#x\n", pVNIC, pVNIC->u32Magic));
1469
1470 /*
1471 * Set the MAC address of the VNIC to the one used by the VM interface.
1472 */
1473 uchar_t au8GuestMac[MAXMACADDRLEN];
1474 bcopy(pMac->au8, au8GuestMac, sizeof(RTMAC));
1475
1476 vnic_mac_addr_type_t AddrType = VNIC_MAC_ADDR_TYPE_FIXED;
1477 vnic_ioc_diag_t Diag = VNIC_IOC_DIAG_NONE;
1478 int MacSlot = 0;
1479 int MacLen = sizeof(RTMAC);
1480
1481 int rc = vnic_modify_addr(pVNIC->hLinkId, &AddrType, &MacLen, au8GuestMac, &MacSlot, 0 /* Mac-Prefix Length */, &Diag);
1482 if (RT_LIKELY(!rc))
1483 {
1484 /*
1485 * Remove existing unicast address, promisc. and the RX hook.
1486 */
1487#if 0
1488 if (pVNIC->hUnicast)
1489 {
1490 mac_rx_clear(pVNIC->hClient);
1491 mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast);
1492 pVNIC->hUnicast = NULL;
1493 }
1494#endif
1495
1496 if (pVNIC->hPromisc)
1497 {
1498 mac_promisc_remove(pVNIC->hPromisc);
1499 pVNIC->hPromisc = NULL;
1500 }
1501
1502 mac_diag_t MacDiag = MAC_DIAG_NONE;
1503 /* uint16_t uVLANId = pVNIC->pVNICTemplate ? pVNIC->pVNICTemplate->uVLANId : 0; */
1504#if 0
1505 rc = mac_unicast_add(pVNIC->hClient, NULL, MAC_UNICAST_PRIMARY, &pVNIC->hUnicast, 0 /* VLAN Id */, &MacDiag);
1506#endif
1507 if (RT_LIKELY(!rc))
1508 {
1509 rc = vboxNetFltSolarisSetPromisc(pThis, pVNIC);
1510#if 0
1511 if (RT_SUCCESS(rc))
1512 {
1513 /*
1514 * Set the RX receive function.
1515 * This shouldn't be necessary as vboxNetFltPortOsSetActive() will be invoked after this, but in the future,
1516 * if the guest NIC changes MAC address this may not be followed by a vboxNetFltPortOsSetActive() call,
1517 * so set it here anyway.
1518 */
1519 mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis);
1520 Log((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress successfully added unicast address %.6Rhxs\n", pMac));
1521 }
1522 else
1523 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress failed to set promiscuous mode. rc=%d\n", rc));
1524 mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast);
1525 pVNIC->hUnicast = NULL;
1526#endif
1527 }
1528 else
1529 {
1530 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress failed to add primary unicast address. rc=%d Diag=%d\n", rc,
1531 MacDiag));
1532 }
1533 }
1534 else
1535 {
1536 /*
1537 * They really ought to use EEXIST, but I'm afraid this error comes from the VNIC device driver directly.
1538 * Sequence: vnic_modify_addr()->mac_unicast_primary_set()->mac_update_macaddr() which uses a function pointer
1539 * to the MAC driver (calls mac_vnic_unicast_set() in our case). Documented here if the error code should change we know
1540 * where to look.
1541 */
1542 if (rc == ENOTSUP)
1543 {
1544 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress: failed! a VNIC with mac %.6Rhxs probably already exists.",
1545 pMac, rc));
1546 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress: This NIC cannot establish connection. szName=%s szVNIC=%s\n",
1547 pThis->szName, pVNIC->szName));
1548 }
1549 else
1550 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress failed! mac %.6Rhxs rc=%d Diag=%d\n", pMac, rc, Diag));
1551 }
1552}
1553
1554
1555int vboxNetFltPortOsConnectInterface(PVBOXNETFLTINS pThis, void *pvIf, void **ppvIfData)
1556{
1557 Log((DEVICE_NAME ":vboxNetFltPortOsConnectInterface pThis=%p pvIf=%p\n", pThis, pvIf));
1558
1559 int rc = VINF_SUCCESS;
1560
1561 /*
1562 * If the underlying interface is a physical interface or a VNIC template, we need to create
1563 * a VNIC per guest NIC.
1564 */
1565 if ( !pThis->u.s.fIsVNIC
1566 || pThis->u.s.fIsVNICTemplate)
1567 {
1568 PVBOXNETFLTVNIC pVNIC = NULL;
1569 rc = vboxNetFltSolarisCreateVNIC(pThis, &pVNIC);
1570 if (RT_SUCCESS(rc))
1571 {
1572 /*
1573 * VM Interface<->VNIC association so that we can Xmit/Recv on the right ones.
1574 */
1575 pVNIC->pvIf = pvIf;
1576 *ppvIfData = pVNIC;
1577
1578 /*
1579 * Add the created VNIC to the list of VNICs we manage.
1580 */
1581 list_insert_tail(&pThis->u.s.hVNICs, pVNIC);
1582 return VINF_SUCCESS;
1583 }
1584 else
1585 LogRel((DEVICE_NAME ":vboxNetFltPortOsConnectInterface failed to create VNIC rc=%d\n", rc));
1586 }
1587 else
1588 {
1589 /*
1590 * This is a VNIC passed to us, use it directly.
1591 */
1592 PVBOXNETFLTVNIC pVNIC = vboxNetFltSolarisAllocVNIC();
1593 if (RT_LIKELY(pVNIC))
1594 {
1595 pVNIC->fCreated = false;
1596
1597 rc = mac_open_by_linkname(pThis->szName, &pVNIC->hInterface);
1598 if (!rc)
1599 {
1600 /*
1601 * Obtain the data link ID for this VNIC, it's needed for modifying the MAC address among other things.
1602 */
1603 rc = vboxNetFltSolarisGetLinkId(pThis->szName, &pVNIC->hLinkId);
1604 if (RT_SUCCESS(rc))
1605 {
1606 /*
1607 * Initialize the VNIC and add it to the list of managed VNICs.
1608 */
1609 RTStrPrintf(pVNIC->szName, sizeof(pVNIC->szName), "%s", pThis->szName);
1610 rc = vboxNetFltSolarisInitVNIC(pThis, pVNIC);
1611 if (!rc)
1612 {
1613 pVNIC->pvIf = pvIf;
1614 *ppvIfData = pVNIC;
1615 list_insert_head(&pThis->u.s.hVNICs, pVNIC);
1616 return VINF_SUCCESS;
1617 }
1618 else
1619 LogRel((DEVICE_NAME ":vboxNetFltPortOsConnectInterface failed to initialize VNIC. rc=%d\n", rc));
1620 }
1621 else
1622 {
1623 LogRel((DEVICE_NAME ":vboxNetFltPortOsConnectInterface failed to get link id for '%s'. rc=%d\n",
1624 pThis->szName, rc));
1625 }
1626 }
1627 else
1628 {
1629 LogRel((DEVICE_NAME ":vboxNetFltPortOsConnectInterface failed to open VNIC '%s'. rc=%d\n", pThis->szName, rc));
1630 rc = VERR_OPEN_FAILED;
1631 }
1632
1633 vboxNetFltSolarisFreeVNIC(pVNIC);
1634 }
1635 else
1636 {
1637 LogRel((DEVICE_NAME ":vboxNetFltOsInitInstance failed to allocate VNIC private data.\n"));
1638 rc = VERR_NO_MEMORY;
1639 }
1640 }
1641
1642 return rc;
1643}
1644
1645
1646int vboxNetFltPortOsDisconnectInterface(PVBOXNETFLTINS pThis, void *pvIfData)
1647{
1648 Log((DEVICE_NAME ":vboxNetFltPortOsDisconnectInterface pThis=%p\n", pThis));
1649
1650 PVBOXNETFLTVNIC pVNIC = pvIfData;
1651 AssertMsgReturn(VALID_PTR(pVNIC) && pVNIC->u32Magic == VBOXNETFLTVNIC_MAGIC,
1652 ("Invalid pvIfData=%p magic=%#x (expected %#x)\n", pvIfData,
1653 pVNIC ? pVNIC->u32Magic : 0, VBOXNETFLTVNIC_MAGIC), VERR_INVALID_POINTER);
1654
1655 /*
1656 * If the underlying interface is a physical interface or a VNIC template, we need to delete the created VNIC.
1657 */
1658 if ( !pThis->u.s.fIsVNIC
1659 || pThis->u.s.fIsVNICTemplate)
1660 {
1661 /*
1662 * Remove the VNIC from the list, destroy and free it.
1663 */
1664 list_remove(&pThis->u.s.hVNICs, pVNIC);
1665 Log((DEVICE_NAME ":vboxNetFltPortOsDisconnectInterface destroying pVNIC=%p\n", pVNIC));
1666 vboxNetFltSolarisDestroyVNIC(pVNIC);
1667 vboxNetFltSolarisFreeVNIC(pVNIC);
1668 }
1669
1670 return VINF_SUCCESS;
1671}
1672
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette