Repeated ICMP packets are generated when poll() keeps returning SLIRP_POLL_HUP revent for UDP sockets
I’m seeing many copies of the same ICMP packet generated by libslirp when poll() keeps returning revent POLLHUP(SLIRP_POLL_HUP) for UDP sockets. Those ICMP packets are for the same latest outbound UDP packet. This problem is found on iPhone intermittently.
Questions:
- Is there a reason why libslirp doesn’t close the UDP socket for revent SLIRP_POLL_HUP but only generating an ICMP?
- Can this problem be addressed in libslirp? Or any suggestions on how to handle in my application?
Here are some details when the issue happens.
- When my app calls slirp_pollfds_fill(), add_poll() callback receives the fds with event SLIRP_POLL_IN | SLIRP_POLL_HUP | SLIRP_POLL_ERR.
- My app calls poll().
- Poll() returns immediately.
- My app calls slirp_pollfds_poll() with revent SLIRP_POLL_IN | SLIRP_POLL_HUP received on those fds.
- Libslirp attempts to read from recvfrom(), gets -1, then generates the ICMP packet.
- The UDP sockets are not closed. When my app calls slirp_pollfds_fill() in the next round, the same thing happens again.