Sorry, I misunderstood how writes to network file discriptors work.

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, November 9, 2018 3:10 PM, Guilhem Moulin <guil...@debian.org> wrote:

> On Fri, 09 Nov 2018 at 19:16:39 +0000, Mendelmunkis wrote:
>
> > > Which error(s) do you have in mind?
> >
> > “destination unreachable” comes to mind.
> > Right now it only checks for connection refused
>
> I'm confused, if write(2) returns -1 and sets errno to ‘ECONNREFUSED’,
> it might be because an ICMP “Destination unreachable” message was just
> received on the socket.
>
> E.g, for the following trace
>
> $ strace -e trace=write nc -vuN 127.0.0.1 12345
> write(3, "X", 1) = 1
> write(3, "X", 1) = -1 ECONNREFUSED (Connection refused)
> +++ exited with 1 +++
>
> I captured these UDP & ICMP packets on the loopback interface:
>
> 21:04:31.475446 IP 127.0.0.1.55080 > 127.0.0.1.12345: UDP, length 1
>
>     21:04:31.475469 IP 127.0.0.1 > 127.0.0.1: ICMP 127.0.0.1 udp port 12345 
> unreachable, length 37
>
>
> (using`tcpdump -n -i lo "icmp or udp dst portrange 12345"`). The
> received ICMP packet is what caused the second write to fail with
> ‘ECONNREFUSED’.
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Guilhem.

Reply via email to