Subject: RPC over UDP: connect the socket?
To: None <email@example.com>
From: Matthias Drochner <firstname.lastname@example.org>
Date: 04/10/1999 13:26:32
There was a report about the lossage happening if "portmap"
is not present or not reachable.
The RPC client function (pmap_set() in this case) times out
when it doesn't get a response. The timeout is rather large,
in the range of minutes. (In one disables "portmap" in rc.conf
because he thinks there are no RPC servers on the system but
misses the RPC services handled by inetd, inetd will become
unresponsive for perhaps 10 minutes. The error messages don't
help much for the simple reason that the RPC functions
generally don't set errno.)
"connect()"ing the UDP socket before send/recv helps a lot,
one gets errors from the network layer immediately.
Would it break anything to connect() the UDP socket in
clnt_udp.c:clntudp_bufcreate() or clntudp_call()?
How to deal with user-supplied sockets (*sockp >= 0)?
I think the clean way would be to connect only
implicitely created sockets, but then clntudp_call() would
have to use sendto() or send() conditionally.
(I believe to remember that a sendto() to a connected
socket fails. Is this still true?)
Otoh, the user shouldn't have connected his socket
anyway, so it should be no problem to connect all
sockets in clnt_udp.c.