Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-17521

Winsock API issue (DGRAM connect / sendto failure)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • Networking

    Description

      SYNOPSIS - some ported socket SW opens/connects socket then calls sendto() with socket nbr and no target address. Fails in ROS but works in 2003

      proof of concept hacks to AFD, attaching 4.15-dev-5933-gfdf4814 based source/binaries (WIP) - does not meet coding standards and is not thread safe

      While working on porting SAMBA4 via Cygwin 2.5.2 I found that UDP messaging would not work when running on ReactOS 0.4.15-dev-2039-gca74467. I traced the problem to the use of a slightly uncommon calling sequence for winsock functions. basically the application calls socket() to create a datagram socket, then calls connect() specifying a RemoteAddress, and later calls Sendto() without providing a RemoteAddress value. This sequence works fine under Windows 10, so apparently Windows is retaining the RemoteAddress value from the Connect() call and associating it with the socket even though a connection is not actually made. ReactOS is not storing the RemoteAddress in association with the socket for connectionless mode calls. I do not know if this functionality is found in windows at winsock, AFD, TDI, or the LAN layer, but currently it does not exist in ReactOS so the application fails. I have attached a small test application that demonstrates the issue in source form (I'll attach binaries if it allows me to). I did develop workaround code in the AfdStreamSocketconnect() and AfdPacketSocketWriteData() functions that handles this by storing the information in FCB->ConnectCallInfo->RemoteAddress FCB->ConnectReturnInfo->RemoteAddress and using it if the function to populate TargetAddress fails, but I'm not sure that is the proper way to handle this..

      NOTE: the binaries were built using Delphi by porting the code because I didn't have a working C compiler, but I just passed the code through a converter, patched it up, and added some comments.. It is functionally equivalent.

      Attachments

        1. UDP_Client.c
          2 kB
        2. UDP_Server.c
          2 kB
        3. UDP_Client.exe
          153 kB
        4. UDP_Server.exe
          149 kB
        5. connect.c
          27 kB
        6. tdiconn.c
          9 kB
        7. write.c
          53 kB
        8. CORE-17521-fail.png
          CORE-17521-fail.png
          155 kB
        9. 4.15-afd.zip
          186 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bugdude bugdude
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: