diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-01-11 01:29:03 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-01-11 01:29:03 +0000 |
commit | 6f9fb3945a17afac34f7d29ccadd96b595b91ab8 (patch) | |
tree | 776117a72add2511ce87ca8b75697d2132faf29a /usr.sbin/nfsd/nfsd.c | |
parent | c9f1de7c196837a6440f02e0e65fbb013066008e (diff) | |
download | FreeBSD-src-6f9fb3945a17afac34f7d29ccadd96b595b91ab8.zip FreeBSD-src-6f9fb3945a17afac34f7d29ccadd96b595b91ab8.tar.gz |
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
Diffstat (limited to 'usr.sbin/nfsd/nfsd.c')
-rw-r--r-- | usr.sbin/nfsd/nfsd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c index fcf53db..c8f3a42 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -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, |