Changeset 555 in vbox for trunk/src/VBox/HostDrivers/VBoxTAP
- Timestamp:
- Feb 2, 2007 3:00:55 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxTAP/tapdrvr.c
r506 r555 1882 1882 } 1883 1883 1884 #ifdef VBOX 1885 case TAP_IOCTL_TRANSFER_ETHPACKETS: 1886 { 1887 PTAP_SCATTER_GATHER_LIST pList; 1888 ULONG i; 1889 PMDL pMdlBuf = NULL; 1890 1891 if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(TAP_SCATTER_GATHER_LIST)) 1892 { 1893 NOTE_ERROR (); 1894 p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER; 1895 break; 1896 } 1897 pList = (PTAP_SCATTER_GATHER_LIST)p_IRP->AssociatedIrp.SystemBuffer; 1898 1899 /* Sanity checks */ 1900 if ( pList->cPackets > TAP_SCATTER_GATHER_MAX_PACKETS 1901 || l_IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(TAP_SCATTER_GATHER_LIST) + (pList->cPackets-1)*sizeof(TAP_SCATTER_GATHER_ITEM) 1902 ) 1903 { 1904 NOTE_ERROR (); 1905 p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER; 1906 break; 1907 } 1908 1909 __try 1910 { 1911 /* Send all packets. */ 1912 for (i=0;i<pList->cPackets;i++) 1913 { 1914 char *pBuffer; 1915 1916 DUMP_PACKET ("IRP_MJ_WRITE ETH", (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer, l_IrpSp->Parameters.Write.Length); 1917 1918 pMdlBuf = IoAllocateMdl(pList->aPacket[i].pPacket, pList->aPacket[i].cb, FALSE, FALSE, NULL); 1919 if (!pMdlBuf) 1920 { 1921 p_IRP->IoStatus.Status = l_Status = STATUS_NO_MEMORY; 1922 break; 1923 } 1924 1925 /* Exceptions caught by top _try _except block */ 1926 /** @todo really necessary to lock the pages?? */ 1927 MmProbeAndLockPages(pMdlBuf, KernelMode, IoModifyAccess); 1928 1929 pBuffer = MmGetSystemAddressForMdlSafe(pMdlBuf, NormalPagePriority); 1930 if (!pBuffer) 1931 { 1932 MmUnlockPages(pMdlBuf); 1933 IoFreeMdl(pMdlBuf); 1934 p_IRP->IoStatus.Status = l_Status = STATUS_NO_MEMORY; 1935 break; 1936 } 1937 1938 NdisMEthIndicateReceive(l_Adapter->m_MiniportAdapterHandle, (NDIS_HANDLE) l_Adapter, 1939 pBuffer, 1940 ETHERNET_HEADER_SIZE, 1941 pBuffer + ETHERNET_HEADER_SIZE, 1942 pList->aPacket[i].cb - ETHERNET_HEADER_SIZE, 1943 pList->aPacket[i].cb - ETHERNET_HEADER_SIZE); 1944 1945 NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle); 1946 1947 MmUnlockPages(pMdlBuf); 1948 IoFreeMdl(pMdlBuf); 1949 pMdlBuf = NULL; 1950 1951 } 1952 p_IRP->IoStatus.Information = 1; // Simple boolean value 1953 } 1954 __except (EXCEPTION_EXECUTE_HANDLER) 1955 { 1956 DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE\n", 1957 NAME (l_Adapter))); 1958 NOTE_ERROR (); 1959 if (pMdlBuf) 1960 IoFreeMdl(pMdlBuf); 1961 1962 p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL; 1963 break; 1964 } 1965 break; 1966 } 1967 #endif 1968 1884 1969 default: 1885 1970 {
Note:
See TracChangeset
for help on using the changeset viewer.