Simply ignore unsupported protocols listed in /etc/netconfig and

abort only if no transport is available.  This fixes
(INET && !INET6) and (!INET && INET6) case, for example.
This commit is contained in:
Hiroki Sato 2010-01-20 16:50:13 +00:00
parent 4135f5cf7d
commit cbf58894c1

View File

@ -450,6 +450,7 @@ main(int argc, char *argv[])
{ {
int ch; int ch;
int error; int error;
int ntrans;
void *nc_handle; void *nc_handle;
struct netconfig *nconf; struct netconfig *nconf;
@ -527,12 +528,13 @@ main(int argc, char *argv[])
/* /*
* Create RPC service for each transport. * Create RPC service for each transport.
*/ */
ntrans = 0;
while((nconf = getnetconfig(nc_handle))) { while((nconf = getnetconfig(nc_handle))) {
if ((nconf->nc_flag & NC_VISIBLE)) { if ((nconf->nc_flag & NC_VISIBLE)) {
if (__rpc_nconf2sockinfo(nconf, &si) == 0) { if (__rpc_nconf2sockinfo(nconf, &si) == 0) {
_msgout("cannot get information for %s", _msgout("cannot get information for %s. "
nconf->nc_netid); "Ignored.", nconf->nc_netid);
exit(1); continue;
} }
if (_rpcpmstart) { if (_rpcpmstart) {
if (si.si_socktype != _rpcfdtype || if (si.si_socktype != _rpcfdtype ||
@ -545,12 +547,16 @@ main(int argc, char *argv[])
endnetconfig(nc_handle); endnetconfig(nc_handle);
exit(1); exit(1);
} }
ntrans++;
} }
} }
endnetconfig(nc_handle); endnetconfig(nc_handle);
while(!(SLIST_EMPTY(&ble_head))) while(!(SLIST_EMPTY(&ble_head)))
SLIST_REMOVE_HEAD(&ble_head, ble_next); SLIST_REMOVE_HEAD(&ble_head, ble_next);
if (ntrans == 0) {
_msgout("no transport is available. Aborted.");
exit(1);
}
if (_rpcpmstart) { if (_rpcpmstart) {
(void) signal(SIGALRM, (SIG_PF) closedown); (void) signal(SIGALRM, (SIG_PF) closedown);
(void) alarm(_RPCSVC_CLOSEDOWN/2); (void) alarm(_RPCSVC_CLOSEDOWN/2);