Hu wrote:If you are sending normal TCP or UDP traffic and expecting ICMP responses for exceptional errors
This is exactly what I am doing. I plan to preform normal communications using UDP. I want to know of ICMP responses as they signify something is very wrong or I have a bug in my firmware.
Hu wrote:You should be able to get the error back as a failure on your next read of the socket.
This is what I expected, but the man page doesn't show the returned errnos as being very verbose. I'm probably just not looking in the right place for documentation. I suppose the distilled version of this question would be "What does the kernel do with ICMP error responses and how does my program check for errors it caused?"
Hu wrote:Try echo | strace socat udp4:ip:port - where ip:port points to a machine which is up, but not providing UDP service on that port. Compare the strace output with a tcpdump collected at the same time.
.....yea, but there are a couple things I don't like about going that route. The main one is I'd really like to find some documentation on the proper error codes returned. I don't want to take the old "suck it and see" approach for this project. I can if I must, I'd prefer not to. Also, I plan to write my applications in C, so I'd expect to catch the problem through errno on a failed read. Will the strace output give me the errnos?
patrikas wrote:A question, why avoiding raw sockets ?
Well, for two reasons. First, I don't believe I should have to. In this situation an ICMP response will signify some kind of major error or bug. I have no problems with my program failing because it received an ICMP response. I just want to know how I can receive the details of the message, or at least what the specific message was so I can debug. Secondly, and this may be an incorrect assumption on my part, since raw sockets happen below the TCP/UDP layer they should receive all IP traffic for the system. I would expect this to be a security risk and as such require some elevated privileges. I don't want to need elevated privileges, and I don't want to have to preform the packet filtering myself.