Skip to content
  • Andrew Baumann's avatar
    b73c1849
    tap-win32: disable broken async write path · b73c1849
    Andrew Baumann authored
    
    
    The code under the TUN_ASYNCHRONOUS_WRITES path makes two incorrect
    assumptions about the behaviour of the WriteFile API for overlapped
    file handles. First, WriteFile does not update the
    lpNumberOfBytesWritten parameter when the write completes
    asynchronously (the number of bytes written is known only when the
    operation completes). Second, the buffer shouldn't be touched (or
    freed) until the operation completes. This led to at least one bug
    where tap_win32_write returned zero bytes written, which in turn
    caused further writes ("receives") to be disabled for that device.
    
    This change disables the asynchronous write path, while keeping most
    of the code around in case someone sees value in resurrecting it. It
    also adds some conditional debug output, similar to the read path.
    
    Signed-off-by: default avatarAndrew Baumann <Andrew.Baumann@microsoft.com>
    Acked-by: default avatarStefan Weil <sw@weilnetz.de>
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    b73c1849
    tap-win32: disable broken async write path
    Andrew Baumann authored
    
    
    The code under the TUN_ASYNCHRONOUS_WRITES path makes two incorrect
    assumptions about the behaviour of the WriteFile API for overlapped
    file handles. First, WriteFile does not update the
    lpNumberOfBytesWritten parameter when the write completes
    asynchronously (the number of bytes written is known only when the
    operation completes). Second, the buffer shouldn't be touched (or
    freed) until the operation completes. This led to at least one bug
    where tap_win32_write returned zero bytes written, which in turn
    caused further writes ("receives") to be disabled for that device.
    
    This change disables the asynchronous write path, while keeping most
    of the code around in case someone sees value in resurrecting it. It
    also adds some conditional debug output, similar to the read path.
    
    Signed-off-by: default avatarAndrew Baumann <Andrew.Baumann@microsoft.com>
    Acked-by: default avatarStefan Weil <sw@weilnetz.de>
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Loading