slirp: fix ICMP handling on macOS hosts
commit3d090aefe29846f8606d06bf55526ebb91f4d725
authorAndrew Oates <aoates@google.com>
Thu, 16 Aug 2018 00:18:45 +0000 (15 20:18 -0400)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 7 Oct 2018 17:40:30 +0000 (7 19:40 +0200)
tree92d43314224712415455cd7c3fa56b7a202fd83b
parent632dd719b385016eb62273f12fe51512453624c1
slirp: fix ICMP handling on macOS hosts

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: Andrew Oates <aoates@google.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
slirp/ip_icmp.c