Messages in this thread | | | Subject | Re: linux recvfrom differencies | From | Andi Kleen <> | Date | 09 Apr 1999 18:26:27 +0200 |
| |
fygrave@tigerteam.net (CyberPsychotic) writes:
> There was a sort of discussion raised at euro-coders mailing list recently > which related to the differencies in implementation of recvfrom() call in > linux socket API and the rest of Unixes (Solaris and two BSD clones (BSDi > and FreeBSD were tested). > > We played with a sort of self-made udp echo daemon, which basically was > listening to the udp packets on certain port and was sending them back to > the same IP:port-no. The curious thing is that if the packet is spoofed, and > no port is being listened on remote machine (and icmp port unreachable goes > back) linux returns -1 for next recvfrom with herrno(?) set to REFUSED, > while BSD/Solaris just ignore this. > > The question is: > is there any paper/RFC/FYI which puts a standard on such things, or this is > basically `the matter of taste' of OS developers, and thus just should being > watched carefully, while developing multi-platform applications?
The Linux behaviour is strictly correct according to RFC1122.
BSD only passes the error when the socket is connect()ed [understandable because it is otherwise hard to find out who caused the error].
Linux 2.2 added a new API to fix it: IP_RECVERR, which allows the application to reliably process asynchronous network errors.
My new network man pages snapshot includes a discussion of the issue in ip.4 and udp.4, see ftp://zero.aec.at/pub/ak/netman-19990409.tgz or available via the samba anonymous CVS server (/vger/netman/)
-Andi -- This is like TV. I don't like TV.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |