Skip to content
Snippets Groups Projects
  1. Oct 09, 2018
  2. Oct 08, 2018
  3. Oct 07, 2018
    • Gavin Grant's avatar
      slirp: Propagate host TCP RST packet to the guest after socket disconnected · 93a972f8
      Gavin Grant authored
      
      Commit 27d92ebc handled the case where the TCP
      connection is abruptly closed via a RST packet, by checking for the ECONNRESET
      errno. However it does not consider the case where the connection has been
      half-closed by the host (FIN/ACK), then the host socket is disconnected. For
      example, if the host application calls close() on the socket, then the
      application exits.
      
      In this case, the socket still exists due to the file descriptor in SLIRP, but
      it is disconnected. recv() does not indicate an error since an orderly socket
      close has previously occurred. The socket will then be stuck in FIN_WAIT_2,
      until the peer sends FIN/ACK or a timeout occurs. Instead we can send a RST
      to the peer and transition to the CLOSED state.
      
      Signed-off-by: default avatarGavin Grant <gavingrant@protonmail.com>
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      93a972f8
    • Andrew Oates's avatar
      slirp: fix ICMP handling on macOS hosts · 3d090aef
      Andrew Oates authored
      
      On Linux, SOCK_DGRAM+IPPROTO_ICMP sockets give only the ICMP packet when
      read from.  On macOS, however, the socket acts like a SOCK_RAW socket
      and includes the IP header as well.
      
      This change strips the extra IP header from the received packet on macOS
      before sending it to the guest.  SOCK_DGRAM ICMP sockets aren't
      supported on other BSDs, but we enable this behavior for them as well to
      treat the sockets the same as raw sockets.
      
      Signed-off-by: default avatarAndrew Oates <aoates@google.com>
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      3d090aef
Loading