Reviewed by: David Greenman
Back out the 'help NIS rebind faster' hack. This change used a connect()/send() pair rather than the original sendto() to allow RPC to pass ICMP host unreachable and similar errors up to RPC programs that use UDP. This is not a terrible thing by itself, but it can cause trouble in environments with multi-homed hosts: if the portmapper on the multi-homed machine sends a reply with a source address that's different than the one associated with the connection by connect(), the kernel will send a port unreachable message and drop the reply. For the sake of compatibility with everybody else on the planet, it's best to revert to the old behavior. *long, heavy sigh*
This commit is contained in:
parent
b60de1afb0
commit
19f61b3433
@ -30,7 +30,7 @@
|
|||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$Id: clnt_udp.c,v 1.2 1995/04/02 20:05:20 wpaul Exp $";
|
static char *rcsid = "$Id: clnt_udp.c,v 1.3 1995/05/30 05:41:19 rgrimes Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -258,20 +258,10 @@ call_again:
|
|||||||
return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
|
return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
|
||||||
outlen = (int)XDR_GETPOS(xdrs);
|
outlen = (int)XDR_GETPOS(xdrs);
|
||||||
|
|
||||||
/*
|
|
||||||
* Give error (ECONNREFUSED/EHOSTUNREACH) instead of timeout.
|
|
||||||
* Gives much faster NIS rebinding.
|
|
||||||
* Errors are not detected here, but in the recvfrom()
|
|
||||||
* following the select().
|
|
||||||
*/
|
|
||||||
if (connect(cu->cu_sock, (struct sockaddr *)(&cu->cu_raddr),
|
|
||||||
cu->cu_rlen) != 0) {
|
|
||||||
cu->cu_error.re_errno = errno;
|
|
||||||
return (cu->cu_error.re_status = RPC_CANTSEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
send_again:
|
send_again:
|
||||||
if (send(cu->cu_sock, cu->cu_outbuf, outlen, 0) != outlen) {
|
if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0,
|
||||||
|
(struct sockaddr *)&(cu->cu_raddr), cu->cu_rlen)
|
||||||
|
!= outlen) {
|
||||||
cu->cu_error.re_errno = errno;
|
cu->cu_error.re_errno = errno;
|
||||||
return (cu->cu_error.re_status = RPC_CANTSEND);
|
return (cu->cu_error.re_status = RPC_CANTSEND);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user