nfsd.c revision 1.28.2.1 1 /* $NetBSD: nfsd.c,v 1.28.2.1 1999/09/29 07:15:26 he Exp $ */
2
3 /*
4 * Copyright (c) 1989, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 */
38
39 #include <sys/cdefs.h>
40 #ifndef lint
41 __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
42 The Regents of the University of California. All rights reserved.\n");
43 #endif not lint
44
45 #ifndef lint
46 #if 0
47 static char sccsid[] = "@(#)nfsd.c 8.9 (Berkeley) 3/29/95";
48 #else
49 __RCSID("$NetBSD: nfsd.c,v 1.28.2.1 1999/09/29 07:15:26 he Exp $");
50 #endif
51 #endif /* not lint */
52
53 #include <sys/param.h>
54 #include <sys/ioctl.h>
55 #include <sys/stat.h>
56 #include <sys/wait.h>
57 #include <sys/uio.h>
58 #include <sys/ucred.h>
59 #include <sys/mount.h>
60 #include <sys/socket.h>
61 #include <sys/socketvar.h>
62
63 #include <rpc/rpc.h>
64 #include <rpc/pmap_clnt.h>
65 #include <rpc/pmap_prot.h>
66
67 #ifdef ISO
68 #include <netiso/iso.h>
69 #endif
70 #include <nfs/rpcv2.h>
71 #include <nfs/nfsproto.h>
72 #include <nfs/nfs.h>
73
74 #ifdef NFSKERB
75 #include <kerberosIV/des.h>
76 #include <kerberosIV/krb.h>
77 #endif
78
79 #include <err.h>
80 #include <errno.h>
81 #include <fcntl.h>
82 #include <grp.h>
83 #include <pwd.h>
84 #include <signal.h>
85 #include <stdio.h>
86 #include <stdlib.h>
87 #include <string.h>
88 #include <syslog.h>
89 #include <unistd.h>
90
91 /* Global defs */
92 #ifdef DEBUG
93 #define syslog(e, s) fprintf(stderr,(s))
94 int debug = 1;
95 #else
96 int debug = 0;
97 #endif
98
99 struct nfsd_srvargs nsd;
100
101 #ifdef NFSKERB
102 char lnam[ANAME_SZ];
103 KTEXT_ST kt;
104 AUTH_DAT kauth;
105 char inst[INST_SZ];
106 struct nfsrpc_fullblock kin, kout;
107 struct nfsrpc_fullverf kverf;
108 NFSKERBKEY_T kivec;
109 struct timeval ktv;
110 NFSKERBKEYSCHED_T kerb_keysched;
111 #endif
112
113 int main __P((int, char **));
114 void nonfs __P((int));
115 void reapchild __P((int));
116 void usage __P((void));
117
118 /*
119 * Nfs server daemon mostly just a user context for nfssvc()
120 *
121 * 1 - do file descriptor and signal cleanup
122 * 2 - fork the nfsd(s)
123 * 3 - create server socket(s)
124 * 4 - register socket with portmap
125 *
126 * For connectionless protocols, just pass the socket into the kernel via
127 * nfssvc().
128 * For connection based sockets, loop doing accepts. When you get a new
129 * socket from accept, pass the msgsock into the kernel via nfssvc().
130 * The arguments are:
131 * -c - support iso cltp clients
132 * -r - reregister with portmapper
133 * -t - support tcp nfs clients
134 * -u - support udp nfs clients
135 * followed by "n" which is the number of nfsds' to fork off
136 */
137 int
138 main(argc, argv)
139 int argc;
140 char *argv[];
141 {
142 struct nfsd_args nfsdargs;
143 struct sockaddr_in inetaddr, inetpeer;
144 #ifdef ISO
145 struct sockaddr_iso isoaddr, isopeer;
146 #endif
147 fd_set ready, sockbits;
148 int ch, cltpflag, connect_type_cnt, i, len, maxsock, msgsock;
149 int nfsdcnt, nfssvc_flag, on, reregister, sock, tcpflag, tcpsock;
150 int tp4cnt, tp4flag, tpipcnt, tpipflag, udpflag;
151 #ifdef NFSKERB
152 struct group *grp;
153 struct passwd *pwd;
154 struct ucred *cr;
155 struct timeval ktv;
156 int tp4sock, tpipsock;
157 char *cp, **cpp;
158 #endif
159
160 #define MAXNFSDCNT 20
161 #define DEFNFSDCNT 4
162 nfsdcnt = DEFNFSDCNT;
163 cltpflag = reregister = tcpflag = tp4cnt = tp4flag = tpipcnt = 0;
164 tpipflag = udpflag = 0;
165 maxsock = tcpsock = 0;
166 #ifdef ISO
167 #define GETOPT "cn:rtu"
168 #define USAGE "[-crtu] [-n num_servers]"
169 #else
170 #define GETOPT "n:rtu"
171 #define USAGE "[-rtu] [-n num_servers]"
172 #endif
173 while ((ch = getopt(argc, argv, GETOPT)) != -1)
174 switch (ch) {
175 case 'n':
176 nfsdcnt = atoi(optarg);
177 if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) {
178 warnx("nfsd count %d; reset to %d", nfsdcnt, DEFNFSDCNT);
179 nfsdcnt = DEFNFSDCNT;
180 }
181 break;
182 case 'r':
183 reregister = 1;
184 break;
185 case 't':
186 tcpflag = 1;
187 break;
188 case 'u':
189 udpflag = 1;
190 break;
191 #ifdef ISO
192 case 'c':
193 cltpflag = 1;
194 break;
195 #ifdef notyet
196 case 'i':
197 tp4cnt = 1;
198 break;
199 case 'p':
200 tpipcnt = 1;
201 break;
202 #endif /* notyet */
203 #endif /* ISO */
204 default:
205 case '?':
206 usage();
207 };
208 argv += optind;
209 argc -= optind;
210
211 /*
212 * XXX
213 * Backward compatibility, trailing number is the count of daemons.
214 */
215 if (argc > 1)
216 usage();
217 if (argc == 1) {
218 nfsdcnt = atoi(argv[0]);
219 if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) {
220 warnx("nfsd count %d; reset to %d", nfsdcnt, DEFNFSDCNT);
221 nfsdcnt = DEFNFSDCNT;
222 }
223 }
224
225 /*
226 * If none of TCP or UDP are specified, default to UDP only.
227 */
228 if (tcpflag == 0 && udpflag == 0)
229 udpflag = 1;
230
231 if (debug == 0) {
232 daemon(0, 0);
233 (void)signal(SIGHUP, SIG_IGN);
234 (void)signal(SIGINT, SIG_IGN);
235 (void)signal(SIGQUIT, SIG_IGN);
236 (void)signal(SIGSYS, nonfs);
237 }
238 (void)signal(SIGCHLD, reapchild);
239
240 if (reregister) {
241 if (udpflag &&
242 (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
243 !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)))
244 err(1, "can't register with portmap for UDP.");
245 if (tcpflag &&
246 (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) ||
247 !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT)))
248 err(1, "can't register with portmap for TCP.");
249 exit(0);
250 }
251 openlog("nfsd:", LOG_PID, LOG_DAEMON);
252
253 for (i = 0; i < nfsdcnt; i++) {
254 switch (fork()) {
255 case -1:
256 syslog(LOG_ERR, "fork: %m");
257 exit (1);
258 case 0:
259 break;
260 default:
261 continue;
262 }
263
264 setproctitle("server");
265 nfssvc_flag = NFSSVC_NFSD;
266 nsd.nsd_nfsd = NULL;
267 #ifdef NFSKERB
268 if (sizeof (struct nfsrpc_fullverf) != RPCX_FULLVERF ||
269 sizeof (struct nfsrpc_fullblock) != RPCX_FULLBLOCK)
270 syslog(LOG_ERR, "Yikes NFSKERB structs not packed!");
271 nsd.nsd_authstr = (u_char *)&kt;
272 nsd.nsd_authlen = sizeof (kt);
273 nsd.nsd_verfstr = (u_char *)&kverf;
274 nsd.nsd_verflen = sizeof (kverf);
275 #endif
276 while (nfssvc(nfssvc_flag, &nsd) < 0) {
277 if (errno != ENEEDAUTH) {
278 syslog(LOG_ERR, "nfssvc: %m");
279 exit(1);
280 }
281 nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHINFAIL;
282 #ifdef NFSKERB
283 /*
284 * Get the Kerberos ticket out of the authenticator
285 * verify it and convert the principal name to a user
286 * name. The user name is then converted to a set of
287 * user credentials via the password and group file.
288 * Finally, decrypt the timestamp and validate it.
289 * For more info see the IETF Draft "Authentication
290 * in ONC RPC".
291 */
292 kt.length = ntohl(kt.length);
293 if (gettimeofday(&ktv, (struct timezone *)0) == 0 &&
294 kt.length > 0 && kt.length <=
295 (RPCAUTH_MAXSIZ - 3 * NFSX_UNSIGNED)) {
296 kin.w1 = NFS_KERBW1(kt);
297 kt.mbz = 0;
298 (void)strcpy(inst, "*");
299 if (krb_rd_req(&kt, NFS_KERBSRV,
300 inst, nsd.nsd_haddr, &kauth, "") == RD_AP_OK &&
301 krb_kntoln(&kauth, lnam) == KSUCCESS &&
302 (pwd = getpwnam(lnam)) != NULL) {
303 cr = &nsd.nsd_cr;
304 cr->cr_uid = pwd->pw_uid;
305 cr->cr_groups[0] = pwd->pw_gid;
306 cr->cr_ngroups = 1;
307 setgrent();
308 while ((grp = getgrent()) != NULL) {
309 if (grp->gr_gid == cr->cr_groups[0])
310 continue;
311 for (cpp = grp->gr_mem;
312 *cpp != NULL; ++cpp)
313 if (!strcmp(*cpp, lnam))
314 break;
315 if (*cpp == NULL)
316 continue;
317 cr->cr_groups[cr->cr_ngroups++]
318 = grp->gr_gid;
319 if (cr->cr_ngroups == NGROUPS)
320 break;
321 }
322 endgrent();
323
324 /*
325 * Get the timestamp verifier out of the
326 * authenticator and verifier strings.
327 */
328 kin.t1 = kverf.t1;
329 kin.t2 = kverf.t2;
330 kin.w2 = kverf.w2;
331 memset((caddr_t)kivec, 0, sizeof (kivec));
332 memmove((caddr_t)nsd.nsd_key,
333 (caddr_t)kauth.session,
334 sizeof(kauth.session));
335
336 /*
337 * Decrypt the timestamp verifier in CBC mode.
338 */
339 XXX
340
341 /*
342 * Validate the timestamp verifier, to
343 * check that the session key is ok.
344 */
345 nsd.nsd_timestamp.tv_sec = ntohl(kout.t1);
346 nsd.nsd_timestamp.tv_usec = ntohl(kout.t2);
347 nsd.nsd_ttl = ntohl(kout.w1);
348 if ((nsd.nsd_ttl - 1) == ntohl(kout.w2))
349 nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHIN;
350 }
351 #endif /* NFSKERB */
352 }
353 exit(0);
354 }
355
356 /* If we are serving udp, set up the socket. */
357 if (udpflag) {
358 if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
359 syslog(LOG_ERR, "can't create udp socket");
360 exit(1);
361 }
362 inetaddr.sin_family = AF_INET;
363 inetaddr.sin_addr.s_addr = INADDR_ANY;
364 inetaddr.sin_port = htons(NFS_PORT);
365 inetaddr.sin_len = sizeof(inetaddr);
366 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
367 if (bind(sock,
368 (struct sockaddr *)&inetaddr, sizeof(inetaddr)) < 0) {
369 syslog(LOG_ERR, "can't bind udp addr");
370 exit(1);
371 }
372 if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
373 !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)) {
374 syslog(LOG_ERR, "can't register with udp portmap");
375 exit(1);
376 }
377 nfsdargs.sock = sock;
378 nfsdargs.name = NULL;
379 nfsdargs.namelen = 0;
380 if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
381 syslog(LOG_ERR, "can't Add UDP socket");
382 exit(1);
383 }
384 (void)close(sock);
385 }
386
387 #ifdef ISO
388 /* If we are serving cltp, set up the socket. */
389 if (cltpflag) {
390 if ((sock = socket(AF_ISO, SOCK_DGRAM, 0)) < 0) {
391 syslog(LOG_ERR, "can't create cltp socket");
392 exit(1);
393 }
394 memset(&isoaddr, 0, sizeof(isoaddr));
395 isoaddr.siso_family = AF_ISO;
396 isoaddr.siso_tlen = 2;
397 cp = TSEL(&isoaddr);
398 *cp++ = (NFS_PORT >> 8);
399 *cp = (NFS_PORT & 0xff);
400 isoaddr.siso_len = sizeof(isoaddr);
401 if (bind(sock,
402 (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) {
403 syslog(LOG_ERR, "can't bind cltp addr");
404 exit(1);
405 }
406 #ifdef notyet
407 /*
408 * XXX
409 * Someday this should probably use "rpcbind", the son of
410 * portmap.
411 */
412 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_UDP, NFS_PORT)) {
413 syslog(LOG_ERR, "can't register with udp portmap");
414 exit(1);
415 }
416 #endif /* notyet */
417 nfsdargs.sock = sock;
418 nfsdargs.name = NULL;
419 nfsdargs.namelen = 0;
420 if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
421 syslog(LOG_ERR, "can't add UDP socket");
422 exit(1);
423 }
424 close(sock);
425 }
426 #endif /* ISO */
427
428 /* Now set up the master server socket waiting for tcp connections. */
429 on = 1;
430 FD_ZERO(&sockbits);
431 connect_type_cnt = 0;
432 if (tcpflag) {
433 if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
434 syslog(LOG_ERR, "can't create tcp socket");
435 exit(1);
436 }
437 if (setsockopt(tcpsock,
438 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
439 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
440 inetaddr.sin_family = AF_INET;
441 inetaddr.sin_addr.s_addr = INADDR_ANY;
442 inetaddr.sin_port = htons(NFS_PORT);
443 inetaddr.sin_len = sizeof(inetaddr);
444 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
445 if (bind(tcpsock,
446 (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) {
447 syslog(LOG_ERR, "can't bind tcp addr");
448 exit(1);
449 }
450 if (listen(tcpsock, 5) < 0) {
451 syslog(LOG_ERR, "listen failed");
452 exit(1);
453 }
454 if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) ||
455 !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT)) {
456 syslog(LOG_ERR, "can't register tcp with portmap");
457 exit(1);
458 }
459 FD_SET(tcpsock, &sockbits);
460 maxsock = tcpsock;
461 connect_type_cnt++;
462 }
463
464 #ifdef notyet
465 /* Now set up the master server socket waiting for tp4 connections. */
466 if (tp4flag) {
467 if ((tp4sock = socket(AF_ISO, SOCK_SEQPACKET, 0)) < 0) {
468 syslog(LOG_ERR, "can't create tp4 socket");
469 exit(1);
470 }
471 if (setsockopt(tp4sock,
472 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
473 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
474 memset(&isoaddr, 0, sizeof(isoaddr));
475 isoaddr.siso_family = AF_ISO;
476 isoaddr.siso_tlen = 2;
477 cp = TSEL(&isoaddr);
478 *cp++ = (NFS_PORT >> 8);
479 *cp = (NFS_PORT & 0xff);
480 isoaddr.siso_len = sizeof(isoaddr);
481 if (bind(tp4sock,
482 (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) {
483 syslog(LOG_ERR, "can't bind tp4 addr");
484 exit(1);
485 }
486 if (listen(tp4sock, 5) < 0) {
487 syslog(LOG_ERR, "listen failed");
488 exit(1);
489 }
490 /*
491 * XXX
492 * Someday this should probably use "rpcbind", the son of
493 * portmap.
494 */
495 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) {
496 syslog(LOG_ERR, "can't register tcp with portmap");
497 exit(1);
498 }
499 FD_SET(tp4sock, &sockbits);
500 maxsock = tp4sock;
501 connect_type_cnt++;
502 }
503
504 /* Now set up the master server socket waiting for tpip connections. */
505 if (tpipflag) {
506 if ((tpipsock = socket(AF_INET, SOCK_SEQPACKET, 0)) < 0) {
507 syslog(LOG_ERR, "can't create tpip socket");
508 exit(1);
509 }
510 if (setsockopt(tpipsock,
511 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
512 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
513 inetaddr.sin_family = AF_INET;
514 inetaddr.sin_addr.s_addr = INADDR_ANY;
515 inetaddr.sin_port = htons(NFS_PORT);
516 inetaddr.sin_len = sizeof(inetaddr);
517 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
518 if (bind(tpipsock,
519 (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) {
520 syslog(LOG_ERR, "can't bind tcp addr");
521 exit(1);
522 }
523 if (listen(tpipsock, 5) < 0) {
524 syslog(LOG_ERR, "listen failed");
525 exit(1);
526 }
527 /*
528 * XXX
529 * Someday this should probably use "rpcbind", the son of
530 * portmap.
531 */
532 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) {
533 syslog(LOG_ERR, "can't register tcp with portmap");
534 exit(1);
535 }
536 FD_SET(tpipsock, &sockbits);
537 maxsock = tpipsock;
538 connect_type_cnt++;
539 }
540 #endif /* notyet */
541
542 if (connect_type_cnt == 0)
543 exit(0);
544
545 setproctitle("master");
546
547 /*
548 * Loop forever accepting connections and passing the sockets
549 * into the kernel for the mounts.
550 */
551 for (;;) {
552 ready = sockbits;
553 if (connect_type_cnt > 1) {
554 if (select(maxsock + 1,
555 &ready, NULL, NULL, NULL) < 1) {
556 syslog(LOG_ERR, "select failed: %m");
557 exit(1);
558 }
559 }
560 if (tcpflag && FD_ISSET(tcpsock, &ready)) {
561 len = sizeof(inetpeer);
562 if ((msgsock = accept(tcpsock,
563 (struct sockaddr *)&inetpeer, &len)) < 0) {
564 syslog(LOG_ERR, "accept failed: %m");
565 exit(1);
566 }
567 memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero));
568 if (setsockopt(msgsock, SOL_SOCKET,
569 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
570 syslog(LOG_ERR,
571 "setsockopt SO_KEEPALIVE: %m");
572 nfsdargs.sock = msgsock;
573 nfsdargs.name = (caddr_t)&inetpeer;
574 nfsdargs.namelen = sizeof(inetpeer);
575 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
576 (void)close(msgsock);
577 }
578 #ifdef notyet
579 if (tp4flag && FD_ISSET(tp4sock, &ready)) {
580 len = sizeof(isopeer);
581 if ((msgsock = accept(tp4sock,
582 (struct sockaddr *)&isopeer, &len)) < 0) {
583 syslog(LOG_ERR, "accept failed: %m");
584 exit(1);
585 }
586 if (setsockopt(msgsock, SOL_SOCKET,
587 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
588 syslog(LOG_ERR,
589 "setsockopt SO_KEEPALIVE: %m");
590 nfsdargs.sock = msgsock;
591 nfsdargs.name = (caddr_t)&isopeer;
592 nfsdargs.namelen = len;
593 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
594 (void)close(msgsock);
595 }
596 if (tpipflag && FD_ISSET(tpipsock, &ready)) {
597 len = sizeof(inetpeer);
598 if ((msgsock = accept(tpipsock,
599 (struct sockaddr *)&inetpeer, &len)) < 0) {
600 syslog(LOG_ERR, "Accept failed: %m");
601 exit(1);
602 }
603 if (setsockopt(msgsock, SOL_SOCKET,
604 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
605 syslog(LOG_ERR, "setsockopt SO_KEEPALIVE: %m");
606 nfsdargs.sock = msgsock;
607 nfsdargs.name = (caddr_t)&inetpeer;
608 nfsdargs.namelen = len;
609 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
610 (void)close(msgsock);
611 }
612 #endif /* notyet */
613 }
614 }
615
616 void
617 usage()
618 {
619
620 (void)fprintf(stderr, "usage: nfsd %s\n", USAGE);
621 exit(1);
622 }
623
624 void
625 nonfs(signo)
626 int signo;
627 {
628
629 syslog(LOG_ERR, "missing system call: NFS not available.");
630 }
631
632 void
633 reapchild(signo)
634 int signo;
635 {
636
637 while (wait3(NULL, WNOHANG, NULL) > 0);
638 }
639