Changeset 57904 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Sep 25, 2015 7:57:12 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 102876
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
r57817 r57904 59 59 #include <net/if.h> 60 60 #include <net/if_var.h> 61 RT_C_DECLS_BEGIN 62 #include <net/bpf.h> 63 RT_C_DECLS_END 61 64 #include <netinet/in.h> 62 65 #include <netinet/in_var.h> … … 924 927 { 925 928 /* 926 * Check if this interface is in promiscuous mode. We should not drop 927 * any packets before they get to the driver as it passes them to tap 928 * callbacks in order for BPF to work properly. 929 * If the interface is in promiscuous mode we should let 930 * all inbound packets (this one was for a bridged guest) 931 * reach the driver as it passes them to tap callbacks in 932 * order for BPF to work properly. 929 933 */ 930 if (vboxNetFltDarwinIsPromiscuous(pThis)) 934 if ( fSrc == INTNETTRUNKDIR_WIRE 935 && vboxNetFltDarwinIsPromiscuous(pThis)) 936 { 931 937 fDropIt = false; 938 } 939 940 /* 941 * A packet from the host to a guest. As we won't pass it 942 * to the drvier/wire we need to feed it to bpf ourselves. 943 */ 944 if (fSrc == INTNETTRUNKDIR_HOST) 945 { 946 bpf_tap_out(pThis->u.s.pIfNet, DLT_EN10MB, pMBuf, NULL, 0); 947 } 932 948 } 933 949 } … … 1088 1104 Assert(pThis->pSwitchPort); 1089 1105 pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pThis->u.s.MacAddr); 1106 #if 0 1107 /* 1108 * XXX: Don't tell SrvIntNetR0 if the interface is 1109 * promiscuous, because there's no code yet to update that 1110 * information and we don't want it stuck, spamming all 1111 * traffic to the host. 1112 */ 1090 1113 pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort, vboxNetFltDarwinIsPromiscuous(pThis)); 1114 #endif 1091 1115 pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0, INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST); 1092 1116 pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */); … … 1127 1151 /* 1128 1152 * Create a mbuf for the gather list and push it onto the wire. 1129 *1130 * Note! If the interface is in the promiscuous mode we need to send the1131 * packet down the stack so it reaches the driver and Berkeley1132 * Packet Filter (see @bugref{5817}).1133 1153 */ 1134 if ( (fDst & INTNETTRUNKDIR_WIRE) || vboxNetFltDarwinIsPromiscuous(pThis))1154 if (fDst & INTNETTRUNKDIR_WIRE) 1135 1155 { 1136 1156 mbuf_t pMBuf = vboxNetFltDarwinMBufFromSG(pThis, pSG); … … 1153 1173 if (pMBuf) 1154 1174 { 1155 /* This is what IONetworkInterface::inputPacket does. */1175 void *pvEthHdr = mbuf_data(pMBuf); 1156 1176 unsigned const cbEthHdr = 14; 1157 mbuf_pkthdr_setheader(pMBuf, mbuf_data(pMBuf)); 1158 mbuf_pkthdr_setlen(pMBuf, mbuf_pkthdr_len(pMBuf) - cbEthHdr); 1159 mbuf_setdata(pMBuf, (uint8_t *)mbuf_data(pMBuf) + cbEthHdr, mbuf_len(pMBuf) - cbEthHdr); 1160 mbuf_pkthdr_setrcvif(pMBuf, pIfNet); /* will crash without this. */ 1161 1177 1178 mbuf_pkthdr_setrcvif(pMBuf, pIfNet); 1179 mbuf_pkthdr_setheader(pMBuf, pvEthHdr); /* link-layer header */ 1180 mbuf_adj(pMBuf, cbEthHdr); /* move to payload */ 1181 1182 bpf_tap_in(pIfNet, DLT_EN10MB, pMBuf, pvEthHdr, cbEthHdr); 1162 1183 errno_t err = ifnet_input(pIfNet, pMBuf, NULL); 1163 1184 if (err)
Note:
See TracChangeset
for help on using the changeset viewer.