Problem:
When an NFS server is port-scanned nfsd sometimes exits. This has happened 3 times the last few weeks. Nfsd has been written to exit when accept(2) fails. Unfortunately accept can sometimes make a "normal" return with errno ECONNABORTED and in this case nfsd exits prematurely. Solution: Check for ECONNABORTED (and also EINTR, since nfsd uses signals) and continue. Submitted by: Bjoern Groenvall <bg@sics.se> PR: 61084
This commit is contained in:
parent
28c30c8315
commit
0be1e825d6
@ -658,6 +658,8 @@ main(argc, argv, envp)
|
||||
if (select(maxsock + 1,
|
||||
&ready, NULL, NULL, NULL) < 1) {
|
||||
syslog(LOG_ERR, "select failed: %m");
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
nfsd_exit(1);
|
||||
}
|
||||
}
|
||||
@ -668,6 +670,9 @@ main(argc, argv, envp)
|
||||
if ((msgsock = accept(tcpsock,
|
||||
(struct sockaddr *)&inetpeer, &len)) < 0) {
|
||||
syslog(LOG_ERR, "accept failed: %m");
|
||||
if (errno == ECONNABORTED ||
|
||||
errno == EINTR)
|
||||
continue;
|
||||
nfsd_exit(1);
|
||||
}
|
||||
memset(inetpeer.sin_zero, 0,
|
||||
@ -688,6 +693,9 @@ main(argc, argv, envp)
|
||||
&len)) < 0) {
|
||||
syslog(LOG_ERR,
|
||||
"accept failed: %m");
|
||||
if (errno == ECONNABORTED ||
|
||||
errno == EINTR)
|
||||
continue;
|
||||
nfsd_exit(1);
|
||||
}
|
||||
if (setsockopt(msgsock, SOL_SOCKET,
|
||||
|
Loading…
Reference in New Issue
Block a user