Commit graph

39 commits

Author SHA1 Message Date
Cameron Gutman 136c0d4296 [AFD]
- Fix handling of IRP_MJ_READ and IRP_MJ_WRITE to allow passing sockets as parameters to NtReadFile and NtWriteFile

svn path=/trunk/; revision=57233
2012-09-04 03:01:15 +00:00
Cameron Gutman 6c0d0cbab0 [AFD]
- Fix one of the worst bugs in AFD of all time. Our AFD code operated under the assumption that none of the input parameters would change once we called LockRequest. This assumption is completely false. The only guarantee that made was that the pages never disappeared from us, not they they couldn't be modified. There are frequent cases where the user-mode buffer was modified from underneath us (WSPRecv allocates the struct on stack which makes it invalid during overlapped operations that complete later). When this happened, we would bugcheck when we tried to unlock the buffers since we accessed this in a member of the struct the caller passed us.
- I've fixed this by adding a parameter to LockRequest which specifies whether the buffer should be copied back when it is unlocked.
- This bug has been around for ages and I was never able to figure out why we just freed garbage sometimes. Now that the ws2_32_winetest exposed it reliably, I was finally able to fix it.

svn path=/trunk/; revision=57175
2012-08-27 04:16:28 +00:00
Cameron Gutman e1499f3b9e [MSAFD]
- Add support for getting and setting SO_EXCLUSIVEADDRUSE
- Add support for setting SO_REUSEADDR
[AFD]
- Implement proper TDI way of indicating a reusable address file
- More work remains in TCP/IP to support this

svn path=/trunk/; revision=57115
2012-08-20 05:48:52 +00:00
Cameron Gutman f34cad36e2 [AFD]
- Cancel the in-flight disconnect IRP during socket closure
[TCPIP]
- Make a disconnect IRP cancelable

svn path=/trunk/; revision=53016
2011-08-01 03:54:19 +00:00
Amine Khaldi 6ece3cae14 [AFD]
* Use afd.h as a PCH.

svn path=/trunk/; revision=52929
2011-07-27 19:29:34 +00:00
Cameron Gutman acd4c15b61 [AFD]
- Fix (hopefully) the final disconnect bugs

svn path=/trunk/; revision=52783
2011-07-22 15:11:01 +00:00
Cameron Gutman 2e54713de3 [AFD]
- Wait to signal a graceful receive shutdown until all buffered transport data is read by the application

svn path=/trunk/; revision=52774
2011-07-22 04:11:50 +00:00
Cameron Gutman 78bd31b30d [AFD]
- Fix typos from my previous commit
- Fix another bug with recv() on a datagram socket
- Fix cancellation bugs

svn path=/trunk/; revision=52725
2011-07-18 11:27:01 +00:00
Cameron Gutman e37e340708 [AFD]
- Fix a nasty datagram corruption bug that would result in an uninitialized buffer data being returned instead of packet data if the client read buffer was smaller than the datagram received
- Fix broken user-mode send datagram IRP completion code which didn't set the completion status
- Implement disabling/enabling event select triggers

svn path=/trunk/; revision=52723
2011-07-18 04:21:40 +00:00
Cameron Gutman 54f9acbf0d [AFD]
- Add support for AFD_INFO_INLINING_MODE
- Add support for setting AFD_INFO_RECEIVE_WINDOW_SIZE and AFD_INFO_SEND_WINDOW_SIZE
- None of this is used by our current msafd but mswsock_new uses it

svn path=/trunk/; revision=52538
2011-07-04 18:07:55 +00:00
Cameron Gutman 0e8f87ff82 [MSAFD/AFD]
- Pass the non-blocking information as a boolean (mswsock_new does this too)
[AFD]
- Don't block waiting for a connection to accept on a non-blocking listener

svn path=/trunk/; revision=52537
2011-07-04 17:37:45 +00:00
Cameron Gutman f828c2431c [AFD]
- Fix a corrupted disconnect timeout pointer being sent to the TDI transport driver

svn path=/trunk/; revision=52502
2011-07-02 20:26:21 +00:00
Cameron Gutman a45e92a406 [AFD]
- Rewrite disconnect to work asynchronously

svn path=/trunk/; revision=52497
2011-07-01 14:31:37 +00:00
Cameron Gutman f6485fab90 [AFD]
- Queue the user-mode connect IRP before calling TdiConnect to avoid a race if the TDI_CONNECT IRP is completed before we get a chance to queue the user-mode IRP to accept the connection
- Change the non-blocking TDI helper functions to always return STATUS_PENDING if the completion function will be called to avoid duplicate handling of IRPs

svn path=/trunk/; revision=52441
2011-06-24 14:06:48 +00:00
Cameron Gutman d7a7a20e8b [AFD]
- Hold on to the disconnect IRP until all pending sending IRPs are sent to the transport driver if a controlled disconnect was requested

svn path=/trunk/; revision=52415
2011-06-22 00:17:19 +00:00
Cameron Gutman dcf65c0e08 [AFD]
- Rewrite user-mode request locking to fix several bugs
- IRP_MJ_READ and IRP_MJ_WRITE doesn't crash
- Revert the IoModifyAccess change (the Write parameter was relevant to the buffer not the request)
- Use GetLockedData to retrieve a locked buffer instead of accessing it manually
- Lock several requests which were not locked and could cause a crash
- ASSERT that the in flight request is the IRP being completed
- Fix a socket closure bug so shutdown(SO_SEND) will not prevent packets being received
- Don't count bytes used in the receive content
- Don't free the datagram buffer if it is a peek request
- Requeue the datagram buffer at the head of the list if it is a peek request
- Fix a bug which could cause corrupted data to be received if multiple datagrams come in before the app receives them 
- Make sure that we're not overwriting an existing in flight request when creating a new one
- Perform an implicit bind in AfdPacketSocketWriteData if it is not already bound
- Implement batching several user-mode send IRPs into one TDI request (if there is already one pending)
- Fix a potential crash if a connectionless send IRP is cancelled

svn path=/trunk/; revision=52186
2011-06-11 12:46:04 +00:00
Cameron Gutman 588db734b0 [AFD]
- Disassociate the connection from the address file before closing them

svn path=/trunk/; revision=52083
2011-06-04 20:31:05 +00:00
Cameron Gutman e26e8e7106 [AFD]
- Launch a new listen IRP right after the current one completes instead of waiting until the current pending connection is accepted
- Reduces the chance of AFD missing two connection requests that are issued very close together and increases network performance by allowing our connection queue to do its job

svn path=/trunk/; revision=52013
2011-05-30 17:27:53 +00:00
Cameron Gutman 219cc11d6a [MSAFD]
- Remove an incorrect change
- Create a new function called TranslateNtStatusError to translate NTSTATUS to winsock error codes
- Call the TranslateNtStatusError in MsafdReturnWithErrno and also use it to translate AFD's poll event error codes
[AFD]
- Track the status for each poll event in our FCB and copy it back when we get an IOCTL_AFD_ENUM_NETWORK_EVENTS IRP
- Remove some useless PollReeval calls

svn path=/trunk/; revision=47377
2010-05-28 03:55:50 +00:00
Cameron Gutman ffdab4c2f5 Merge aicom-network-branch (without NDIS changes for now)
New noteworthy improvements include (in addition to the other improvements made in the commits that were reverted in trunk):
 - Support for sending/receiving packets > 16KB in size
 - Samba-tng works
 - Tracert works
 - Major speed and stability improvements (especially for TCP connections)
 - Use ExAllocatePoolWithTag/ExFreePoolWithTag instead of memtrack

svn path=/trunk/; revision=45172
2010-01-21 03:48:10 +00:00
Cameron Gutman 29fa274d6d - Create another branch for networking fixes
- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers)
 - If someone wants to delete aicom-network-fixes, they are welcome to
 - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea

svn path=/branches/aicom-network-branch/; revision=44353
2009-12-02 03:23:19 +00:00
Cameron Gutman 79e704337b - Update AFD's shared header
- Add entity type check for IF_MIB_STATS_ID
 - Sort out some confusion with TDI entities
 - Implement IOCTL_AFD_GET_CONTEXT_SIZE
 - Enable debug prints for unimplemented ioctls
 - Add kernel-mode support for setting TTL

svn path=/trunk/; revision=43767
2009-10-26 03:11:44 +00:00
Cameron Gutman 6ad0121a58 - Add cancellation support for IOCTL_AFD_SELECT
- Fix release build

svn path=/trunk/; revision=43275
2009-10-03 21:34:34 +00:00
Cameron Gutman 5920b78ec2 - Implement IRP cancellation for AFD
- Fixes "Broken driver did not complete!" showing up in the debug log (especially during winetests)

svn path=/trunk/; revision=43274
2009-10-03 20:52:54 +00:00
Cameron Gutman be53da4398 - Implement AFD_INFO_GROUP_ID_TYPE
svn path=/trunk/; revision=42964
2009-08-29 17:53:45 +00:00
Cameron Gutman b12ea8a99d - Fix several bugs in select code and remove some dead code
- Fix a typo
 - Part 1 of x

svn path=/trunk/; revision=42673
2009-08-15 02:09:23 +00:00
Cameron Gutman e99d1fe3f9 - Implement IOCTL_AFD_SET_INFO
- We currently disregard the value of BlockingMode so this causes no behavior change

svn path=/trunk/; revision=41833
2009-07-09 16:47:11 +00:00
Cameron Gutman a5d8c32124 - Remove a useless parameter from UnlockAndMaybeComplete
- Fix a few listening bugs

svn path=/trunk/; revision=40267
2009-03-28 15:49:29 +00:00
Cameron Gutman d99f998d2d - This should fix a rare afd crash
- It was a race condition caused by another thread clearing our IRP while we were still using it

svn path=/trunk/; revision=40183
2009-03-23 05:05:57 +00:00
Cameron Gutman 3f46303c0e - Merge aicom-network-fixes up to r39995
svn path=/trunk/; revision=40004
2009-03-13 17:25:48 +00:00
Timo Kreuzer 6f7b6a94c9 merge from amd64 branch. and
35645: Fix some wrong declarations for 64bits. (Samuel Serapión)
35652: More header fixes. (Samuel Serapión)
35950: Implement __readeflags and __writeeflags (Timo Kreuzer)
35951: Remove hacks from __addgsbyte, __addgsword, __addgsdword. (Timo Kreuzer)
36171: Fix TIMERPROC definition. Fix CreateToolbarEx definition. (Samuel Serapión)
36468: Add MemoryBarrier definition for amd64 (Timo Kreuzer)
36469: Fix NetLocalGroupGetMembers prototype. (Samuel Serapión)
36474: Fix ReadProcessMemory and Toolhelp32ReadProcessMemory prototypes. (Samuel Serapión)
36840: fix __rdtsc on amd64 build (Timo Kreuzer)
36898: Fix CryptReleaseContext definition. (Samuel Serapión)
36900: Fix COMBOBOXEXITEA/W noticed by Daniel Verkamp. (Samuel Serapión)
36901: Fix NMHDR definition. noticed by Daniel Verkamp. (Samuel Serapión)
36906: Fix definitions of CDHOOKPROC, PROC, FARPROC, NEARPROC, SYSTEM_INFO, COMPAREITEMSTRUCT, COPYDATASTRUCT, DELETEITEMSTRUCT, DRAWITEMSTRUCT, MENUITEMINFOA/W, HELPINFO, MSGBOXPARAMSA/W, MOUSEHOOKSTRUCT, DROPSTRUCT, KBDLLHOOKSTRUCT, GetProcessAffinityMask, SetProcessAffinityMask, DragObject, InsertMenuA/W, ModifyMenuA/W, WinHelpA/W, RT_GROUP_CURSOR, RT_GROUP_ICON (Daniel Verkamp.)
36953: Fix AFD compilation for 64-bit (treat handles as ULONG_PTR-sized). Also correct Winsock's SOCKET definition (Stefan Ginsberg)
37307: Add UNWIND_HISTORY_TABLE_ENTRY and UNWIND_HISTORY_TABLE. (Timo Kreuzer)
37875: Inlcude excpt.h in winnt.h. (Timo Kreuzer)
37908: Fix definition of SOCKET. (Timo Kreuzer)
37926: fix *HOOKPROC definition. Add 64 bit BitTest functions. (Timo Kreuzer)
38072: Fix FARPROC, NEARPROC, PROC definitions (Samuel Serapión)
38091: Fix some 64bit portability issues. (Samuel Serapión)
38093: Hack for wine specific hack. (Samuel Serapión)
38095: Fix packing for commdlg. (Samuel Serapión)
38260: Fix EDITSTREAM structure. (Samuel Serapión)
38263: Fix definitions of WAVEOPENDESC, WAVEHDR structures. Fix prototypes for DefDriverProc, waveOutMessage, waveOutGetDevCapsA/W, waveInGetDevCapsA/W, waveInMessage, midiStreamOpen, midiOutGetDevCapsA/W, midiOutOpen, midiOutMessage, midiInGetDevCapsA/W, midiInOpen, midiInMessage, auxGetDevCapsA/W, auxOutMessage, mixerGetDevCapsA/W, mixerOpen, timeSetEvent, joyGetDevCapsA/W, mciSendCommandA/W, and mciGetCreatorTask. (Samuel Serapión)
38478: Fix HeapAlloc prototype. (Timo Kreuzer)
39468: Fix some definitions in mmsystem.h (Timo Kreuzer)

svn path=/trunk/; revision=39471
2009-02-08 03:41:29 +00:00
Stefan Ginsberg 2bafd1ffc3 - No need to include winddk.h, ntddk.h includes it for us
svn path=/trunk/; revision=37761
2008-11-30 10:10:19 +00:00
Art Yerkes 4196ecf39b fix a bug reported by aicom: get peer name fails running xitami web server
svn path=/trunk/; revision=37759
2008-11-30 08:26:52 +00:00
Cameron Gutman 0f1167cbc0 - Merge aicom-network-fixes up to r36371
svn path=/trunk/; revision=36372
2008-09-21 12:41:26 +00:00
Art Yerkes 30b9ab966f Merge aicom-network-fixes up to 35260
svn path=/trunk/; revision=35267
2008-08-11 00:02:26 +00:00
Art Yerkes ca26e8cac7 Merge aicom-network-fixes up to
r35014 | cgutman | 2008-08-01 10:21:52 -0700 (Fri, 01 Aug 2008) | 2 lines

- These should no longer be needed now that TDI doesn't give back invalid IRPs
- I'll look into the canceling issue later

svn path=/trunk/; revision=35019
2008-08-01 21:07:09 +00:00
Art Yerkes 011800f50d Mostly revert my earlier attempt at fixing IRP cancellation. I'll attack it
again later.

svn path=/trunk/; revision=30701
2007-11-23 18:06:07 +00:00
Art Yerkes 06220aab9e tcpip:
Factor out common datagram receive code.
Actually implement datagram cancellation.

afd:
Reorganize IRP cancellation and simplify socket shutdown.
Fix datagram recv with no address differently (and better).

Overall: fix hang after ping.

svn path=/trunk/; revision=30693
2007-11-23 13:52:56 +00:00
Maarten Bosma d1c43ae00b rename net to network
svn path=/trunk/; revision=21067
2006-02-17 12:30:29 +00:00
Renamed from reactos/drivers/net/afd/include/afd.h (Browse further)