This repository has been archived by the owner. It is now read-only.

Need a way to detect ICMP errors with UDP. #1985

kirm opened this Issue Nov 1, 2011 · 7 comments


None yet
6 participants

kirm commented Nov 1, 2011

I implemented SIP stack for node. SIP standard requires me to handle ICMP errors properly, but it seems there is no way to detect them in node.js v0.5.

AFAIK most UNIX systems report ICMP errors as errors in recvmsg syscall on connected udp sockets only. Before v0.5 i was able to hack around dgram module and call process.bindings('net').connect on socket and got those error reports.

On windows, system reports icmp errors as error codes in WSARecvFrom, and returns ICMP packet source address in lpFrom parameter, but node.js doesn't pass it to user.

@kirm kirm closed this Nov 1, 2011

@kirm kirm reopened this Nov 1, 2011


bnoordhuis commented Nov 1, 2011

It was a conscious decision to not propagate network errors because Linux is the only supported UNIX flavour that reports them in a reasonable way. SunOS and the BSDs report ICMP errors only in connected mode - which our sockets never are.

I don't really want to add a special case hack to libuv just for this but I can see why it be useful to some.

@piscisaureus: What do you think?

kirm commented Nov 2, 2011

Why not just allow users to connect their udp sockets and handle network errors in portable way?

sh1mmer commented Nov 3, 2011

Since this is a design decision I'm marking this a feature request while it's being considered.

mscdex commented Apr 26, 2013

@bnoordhuis @piscisaureus Any update on this?


bnoordhuis commented Apr 26, 2013

No. I think it's fair to say that (almost) no one cares.

UDP sockets can be connected. I don't see a reason why node should not expose the system call for UDP sockets, just map it 1:1 to ::connect(). It makes it easier to send packets, makes it possible to filter junk out coming from unwanted addresses, and last but not least it makes it possible to report ICMP packets. This is mandatory for SIP IPv6 compliance tests. No big deal IMHO.


jasnell commented May 15, 2015

Closing to apparent lack of interest. Can reopen if new information is received.

@jasnell jasnell closed this May 15, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.