VirtualBox

Ignore:
Timestamp:
Sep 26, 2015 3:35:03 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102879
Message:

VBoxNetAdp/darwin: use bpfattach() without tap and send callbacks.
Default behavior is fine and we get bpf packet injection for free.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp

    r57904 r57907  
    5151#include <sys/conf.h>
    5252#include <miscfs/devfs/devfs.h>
    53 extern "C" {
     53RT_C_DECLS_BEGIN
    5454#include <net/bpf.h>
    55 }
     55RT_C_DECLS_END
    5656
    5757#define VBOXNETADP_OS_SPECFIC 1
     
    210210}
    211211
    212 static errno_t vboxNetAdpDarwinBpfTap(ifnet_t pIface, u_int32_t uLinkType, bpf_tap_mode nMode)
    213 {
    214     PVBOXNETADP pThis = VBOXNETADP_FROM_IFACE(pIface);
    215     Assert(pThis);
    216     Log2(("vboxNetAdpDarwinBpfTap: mode=%d\n", nMode));
    217     pThis->u.s.nTapMode = nMode;
    218     return 0;
    219 }
    220 
    221 static errno_t vboxNetAdpDarwinBpfSend(ifnet_t pIface, u_int32_t uLinkType, mbuf_t pMBuf)
    222 {
    223     LogRel(("vboxnetadp: BPF send function is not implemented (dlt=%d)\n", uLinkType));
    224     mbuf_freem_list(pMBuf);
    225     return 0;
    226 }
    227 
    228 
    229212int vboxNetAdpOsCreate(PVBOXNETADP pThis, PCRTMAC pMACAddress)
    230213{
     
    241224        return rc;
    242225    }
    243 
    244     pThis->u.s.nTapMode = BPF_MODE_DISABLED;
    245226
    246227    mac.sdl_len = sizeof(mac);
     
    279260        if (!err)
    280261        {
    281             err = bpf_attach(pThis->u.s.pIface, DLT_EN10MB, ETHER_HDR_LEN,
    282                       vboxNetAdpDarwinBpfSend, vboxNetAdpDarwinBpfTap);
    283             if (err)
    284             {
    285                 LogRel(("vboxnetadp: bpf_attach failed with %d\n", err));
    286             }
     262            bpfattach(pThis->u.s.pIface, DLT_EN10MB, ETHER_HDR_LEN);
     263
    287264            err = ifnet_set_flags(pThis->u.s.pIface, IFF_RUNNING | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST, 0xFFFF);
    288265            if (!err)
Note: See TracChangeset for help on using the changeset viewer.

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