Using the 2.2.16 kernel, after an ICMP port unreachable message is
received for a UDP socket, recvfrom() will return -1 and errno is set
to ECONNREFUSED. However, recvfrom() doesn't fill in the "from"
sockaddr. I'm able to obtain the IP address of the remote host via
the MSG_ERRQUEUE recvmsg() flag. However, the sockaddr_in contained
in the resulting IP_RECVERR data does not contain a valid port (it
appears to be garbage).
Am I doing something wrong? Is there some other way to obtain the
port? Any advice/assistance would be appreciated.
Thanks,
Erik