1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

TT RPC server: Don't search 538 million transients trying to allocate one.

Currently, mp_rpc_server.C tries 538 million ports to acquire an
available transient rpcbind port number.  This is bad when rpcbind is
running in secure mode (and you are not using tirpc) - Xsession will
'hang' at the dthello (blue) screen filling up your error logs with
RPC errors.

Now, just try +- 50 (for a total of 100 ports) before bailing.  The
dthello 'blue screen of death' is the most common problem in starting
CDE when rpcbind isn't set up properly.  This should at least not
cause the appearance of a 'hang'.
This commit is contained in:
Jon Trulson 2013-05-17 16:16:17 -06:00
parent 86e5dc1f10
commit a198d898e8

View file

@ -417,8 +417,19 @@ gettransient(int proto, int vers, int *sockp)
// if you try to grab a number for udp and we have it grabbed // if you try to grab a number for udp and we have it grabbed
// for tcp). // for tcp).
// search up in the range 0x4fffffff - 0x5fffffff // JET - this is way too many pnums to search, and causes what
for (prognum = 0x4fffffff; prognum <= 0x5fffffff; prognum++) { // appears to be an infinite loop (though it isn't) if the
// user is running an rpcbind in secure mode and not using
// libtirpc - a common error. The end result is staring at
// the dthello welcome screen. So - rather than search this
// immense space, we will only search from start to +-50
// before bailing. If a hundred attmepts to get a transient
// fail, I don't see that doing approximately 537 million
// attempts are worth it :)
#define MAX_TRANS_RANGE 50
// search up in the range 0x4fffffff to 0x4fffffff + MAX_TRANS_RANGE
for (prognum = 0x4fffffff; prognum <= (0x4fffffff + MAX_TRANS_RANGE); prognum++) {
/* XXX: pmap_set allows the same prognum for different */ /* XXX: pmap_set allows the same prognum for different */
/* protocols so we hack around that by attemptint to */ /* protocols so we hack around that by attemptint to */
/* set both tcp and udp. */ /* set both tcp and udp. */
@ -447,7 +458,7 @@ gettransient(int proto, int vers, int *sockp)
} }
// search down in the range 0x4ffffffe - 0x40000000 // search down in the range 0x4ffffffe - 0x40000000
for (prognum = 0x4ffffffe; prognum >= 0x40000000; prognum--) { for (prognum = 0x4ffffffe; prognum >= (0x4ffffffe - MAX_TRANS_RANGE); prognum--) {
/* XXX: pmap_set allows the same prognum for different */ /* XXX: pmap_set allows the same prognum for different */
/* protocols so we hack around that by attemptint to */ /* protocols so we hack around that by attemptint to */
/* set both tcp and udp. */ /* set both tcp and udp. */