nfsd.c revision 1.25 1 /* $NetBSD: nfsd.c,v 1.25 1998/02/03 04:55:59 perry 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.25 1998/02/03 04:55:59 perry 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 if (debug == 0) {
226 daemon(0, 0);
227 (void)signal(SIGHUP, SIG_IGN);
228 (void)signal(SIGINT, SIG_IGN);
229 (void)signal(SIGQUIT, SIG_IGN);
230 (void)signal(SIGSYS, nonfs);
231 (void)signal(SIGTERM, SIG_IGN);
232 }
233 (void)signal(SIGCHLD, reapchild);
234
235 if (reregister) {
236 if (udpflag &&
237 (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
238 !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)))
239 err(1, "can't register with portmap for UDP.");
240 if (tcpflag &&
241 (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) ||
242 !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT)))
243 err(1, "can't register with portmap for TCP.");
244 exit(0);
245 }
246 openlog("nfsd:", LOG_PID, LOG_DAEMON);
247
248 for (i = 0; i < nfsdcnt; i++) {
249 switch (fork()) {
250 case -1:
251 syslog(LOG_ERR, "fork: %m");
252 exit (1);
253 case 0:
254 break;
255 default:
256 continue;
257 }
258
259 setproctitle("server");
260 nfssvc_flag = NFSSVC_NFSD;
261 nsd.nsd_nfsd = NULL;
262 #ifdef NFSKERB
263 if (sizeof (struct nfsrpc_fullverf) != RPCX_FULLVERF ||
264 sizeof (struct nfsrpc_fullblock) != RPCX_FULLBLOCK)
265 syslog(LOG_ERR, "Yikes NFSKERB structs not packed!");
266 nsd.nsd_authstr = (u_char *)&kt;
267 nsd.nsd_authlen = sizeof (kt);
268 nsd.nsd_verfstr = (u_char *)&kverf;
269 nsd.nsd_verflen = sizeof (kverf);
270 #endif
271 while (nfssvc(nfssvc_flag, &nsd) < 0) {
272 if (errno != ENEEDAUTH) {
273 syslog(LOG_ERR, "nfssvc: %m");
274 exit(1);
275 }
276 nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHINFAIL;
277 #ifdef NFSKERB
278 /*
279 * Get the Kerberos ticket out of the authenticator
280 * verify it and convert the principal name to a user
281 * name. The user name is then converted to a set of
282 * user credentials via the password and group file.
283 * Finally, decrypt the timestamp and validate it.
284 * For more info see the IETF Draft "Authentication
285 * in ONC RPC".
286 */
287 kt.length = ntohl(kt.length);
288 if (gettimeofday(&ktv, (struct timezone *)0) == 0 &&
289 kt.length > 0 && kt.length <=
290 (RPCAUTH_MAXSIZ - 3 * NFSX_UNSIGNED)) {
291 kin.w1 = NFS_KERBW1(kt);
292 kt.mbz = 0;
293 (void)strcpy(inst, "*");
294 if (krb_rd_req(&kt, NFS_KERBSRV,
295 inst, nsd.nsd_haddr, &kauth, "") == RD_AP_OK &&
296 krb_kntoln(&kauth, lnam) == KSUCCESS &&
297 (pwd = getpwnam(lnam)) != NULL) {
298 cr = &nsd.nsd_cr;
299 cr->cr_uid = pwd->pw_uid;
300 cr->cr_groups[0] = pwd->pw_gid;
301 cr->cr_ngroups = 1;
302 setgrent();
303 while ((grp = getgrent()) != NULL) {
304 if (grp->gr_gid == cr->cr_groups[0])
305 continue;
306 for (cpp = grp->gr_mem;
307 *cpp != NULL; ++cpp)
308 if (!strcmp(*cpp, lnam))
309 break;
310 if (*cpp == NULL)
311 continue;
312 cr->cr_groups[cr->cr_ngroups++]
313 = grp->gr_gid;
314 if (cr->cr_ngroups == NGROUPS)
315 break;
316 }
317 endgrent();
318
319 /*
320 * Get the timestamp verifier out of the
321 * authenticator and verifier strings.
322 */
323 kin.t1 = kverf.t1;
324 kin.t2 = kverf.t2;
325 kin.w2 = kverf.w2;
326 memset((caddr_t)kivec, 0, sizeof (kivec));
327 memmove((caddr_t)nsd.nsd_key,
328 (caddr_t)kauth.session,
329 sizeof(kauth.session));
330
331 /*
332 * Decrypt the timestamp verifier in CBC mode.
333 */
334 XXX
335
336 /*
337 * Validate the timestamp verifier, to
338 * check that the session key is ok.
339 */
340 nsd.nsd_timestamp.tv_sec = ntohl(kout.t1);
341 nsd.nsd_timestamp.tv_usec = ntohl(kout.t2);
342 nsd.nsd_ttl = ntohl(kout.w1);
343 if ((nsd.nsd_ttl - 1) == ntohl(kout.w2))
344 nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHIN;
345 }
346 #endif /* NFSKERB */
347 }
348 exit(0);
349 }
350
351 /* If we are serving udp, set up the socket. */
352 if (udpflag) {
353 if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
354 syslog(LOG_ERR, "can't create udp socket");
355 exit(1);
356 }
357 inetaddr.sin_family = AF_INET;
358 inetaddr.sin_addr.s_addr = INADDR_ANY;
359 inetaddr.sin_port = htons(NFS_PORT);
360 inetaddr.sin_len = sizeof(inetaddr);
361 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
362 if (bind(sock,
363 (struct sockaddr *)&inetaddr, sizeof(inetaddr)) < 0) {
364 syslog(LOG_ERR, "can't bind udp addr");
365 exit(1);
366 }
367 if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
368 !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)) {
369 syslog(LOG_ERR, "can't register with udp portmap");
370 exit(1);
371 }
372 nfsdargs.sock = sock;
373 nfsdargs.name = NULL;
374 nfsdargs.namelen = 0;
375 if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
376 syslog(LOG_ERR, "can't Add UDP socket");
377 exit(1);
378 }
379 (void)close(sock);
380 }
381
382 #ifdef ISO
383 /* If we are serving cltp, set up the socket. */
384 if (cltpflag) {
385 if ((sock = socket(AF_ISO, SOCK_DGRAM, 0)) < 0) {
386 syslog(LOG_ERR, "can't create cltp socket");
387 exit(1);
388 }
389 memset(&isoaddr, 0, sizeof(isoaddr));
390 isoaddr.siso_family = AF_ISO;
391 isoaddr.siso_tlen = 2;
392 cp = TSEL(&isoaddr);
393 *cp++ = (NFS_PORT >> 8);
394 *cp = (NFS_PORT & 0xff);
395 isoaddr.siso_len = sizeof(isoaddr);
396 if (bind(sock,
397 (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) {
398 syslog(LOG_ERR, "can't bind cltp addr");
399 exit(1);
400 }
401 #ifdef notyet
402 /*
403 * XXX
404 * Someday this should probably use "rpcbind", the son of
405 * portmap.
406 */
407 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_UDP, NFS_PORT)) {
408 syslog(LOG_ERR, "can't register with udp portmap");
409 exit(1);
410 }
411 #endif /* notyet */
412 nfsdargs.sock = sock;
413 nfsdargs.name = NULL;
414 nfsdargs.namelen = 0;
415 if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
416 syslog(LOG_ERR, "can't add UDP socket");
417 exit(1);
418 }
419 close(sock);
420 }
421 #endif /* ISO */
422
423 /* Now set up the master server socket waiting for tcp connections. */
424 on = 1;
425 FD_ZERO(&sockbits);
426 connect_type_cnt = 0;
427 if (tcpflag) {
428 if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
429 syslog(LOG_ERR, "can't create tcp socket");
430 exit(1);
431 }
432 if (setsockopt(tcpsock,
433 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
434 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
435 inetaddr.sin_family = AF_INET;
436 inetaddr.sin_addr.s_addr = INADDR_ANY;
437 inetaddr.sin_port = htons(NFS_PORT);
438 inetaddr.sin_len = sizeof(inetaddr);
439 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
440 if (bind(tcpsock,
441 (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) {
442 syslog(LOG_ERR, "can't bind tcp addr");
443 exit(1);
444 }
445 if (listen(tcpsock, 5) < 0) {
446 syslog(LOG_ERR, "listen failed");
447 exit(1);
448 }
449 if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_TCP, NFS_PORT) ||
450 !pmap_set(RPCPROG_NFS, 3, IPPROTO_TCP, NFS_PORT)) {
451 syslog(LOG_ERR, "can't register tcp with portmap");
452 exit(1);
453 }
454 FD_SET(tcpsock, &sockbits);
455 maxsock = tcpsock;
456 connect_type_cnt++;
457 }
458
459 #ifdef notyet
460 /* Now set up the master server socket waiting for tp4 connections. */
461 if (tp4flag) {
462 if ((tp4sock = socket(AF_ISO, SOCK_SEQPACKET, 0)) < 0) {
463 syslog(LOG_ERR, "can't create tp4 socket");
464 exit(1);
465 }
466 if (setsockopt(tp4sock,
467 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
468 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
469 memset(&isoaddr, 0, sizeof(isoaddr));
470 isoaddr.siso_family = AF_ISO;
471 isoaddr.siso_tlen = 2;
472 cp = TSEL(&isoaddr);
473 *cp++ = (NFS_PORT >> 8);
474 *cp = (NFS_PORT & 0xff);
475 isoaddr.siso_len = sizeof(isoaddr);
476 if (bind(tp4sock,
477 (struct sockaddr *)&isoaddr, sizeof(isoaddr)) < 0) {
478 syslog(LOG_ERR, "can't bind tp4 addr");
479 exit(1);
480 }
481 if (listen(tp4sock, 5) < 0) {
482 syslog(LOG_ERR, "listen failed");
483 exit(1);
484 }
485 /*
486 * XXX
487 * Someday this should probably use "rpcbind", the son of
488 * portmap.
489 */
490 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) {
491 syslog(LOG_ERR, "can't register tcp with portmap");
492 exit(1);
493 }
494 FD_SET(tp4sock, &sockbits);
495 maxsock = tp4sock;
496 connect_type_cnt++;
497 }
498
499 /* Now set up the master server socket waiting for tpip connections. */
500 if (tpipflag) {
501 if ((tpipsock = socket(AF_INET, SOCK_SEQPACKET, 0)) < 0) {
502 syslog(LOG_ERR, "can't create tpip socket");
503 exit(1);
504 }
505 if (setsockopt(tpipsock,
506 SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
507 syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m");
508 inetaddr.sin_family = AF_INET;
509 inetaddr.sin_addr.s_addr = INADDR_ANY;
510 inetaddr.sin_port = htons(NFS_PORT);
511 inetaddr.sin_len = sizeof(inetaddr);
512 memset(inetaddr.sin_zero, 0, sizeof(inetaddr.sin_zero));
513 if (bind(tpipsock,
514 (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) {
515 syslog(LOG_ERR, "can't bind tcp addr");
516 exit(1);
517 }
518 if (listen(tpipsock, 5) < 0) {
519 syslog(LOG_ERR, "listen failed");
520 exit(1);
521 }
522 /*
523 * XXX
524 * Someday this should probably use "rpcbind", the son of
525 * portmap.
526 */
527 if (!pmap_set(RPCPROG_NFS, NFS_VER2, IPPROTO_TCP, NFS_PORT)) {
528 syslog(LOG_ERR, "can't register tcp with portmap");
529 exit(1);
530 }
531 FD_SET(tpipsock, &sockbits);
532 maxsock = tpipsock;
533 connect_type_cnt++;
534 }
535 #endif /* notyet */
536
537 if (connect_type_cnt == 0)
538 exit(0);
539
540 setproctitle("master");
541
542 /*
543 * Loop forever accepting connections and passing the sockets
544 * into the kernel for the mounts.
545 */
546 for (;;) {
547 ready = sockbits;
548 if (connect_type_cnt > 1) {
549 if (select(maxsock + 1,
550 &ready, NULL, NULL, NULL) < 1) {
551 syslog(LOG_ERR, "select failed: %m");
552 exit(1);
553 }
554 }
555 if (tcpflag && FD_ISSET(tcpsock, &ready)) {
556 len = sizeof(inetpeer);
557 if ((msgsock = accept(tcpsock,
558 (struct sockaddr *)&inetpeer, &len)) < 0) {
559 syslog(LOG_ERR, "accept failed: %m");
560 exit(1);
561 }
562 memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero));
563 if (setsockopt(msgsock, SOL_SOCKET,
564 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
565 syslog(LOG_ERR,
566 "setsockopt SO_KEEPALIVE: %m");
567 nfsdargs.sock = msgsock;
568 nfsdargs.name = (caddr_t)&inetpeer;
569 nfsdargs.namelen = sizeof(inetpeer);
570 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
571 (void)close(msgsock);
572 }
573 #ifdef notyet
574 if (tp4flag && FD_ISSET(tp4sock, &ready)) {
575 len = sizeof(isopeer);
576 if ((msgsock = accept(tp4sock,
577 (struct sockaddr *)&isopeer, &len)) < 0) {
578 syslog(LOG_ERR, "accept failed: %m");
579 exit(1);
580 }
581 if (setsockopt(msgsock, SOL_SOCKET,
582 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
583 syslog(LOG_ERR,
584 "setsockopt SO_KEEPALIVE: %m");
585 nfsdargs.sock = msgsock;
586 nfsdargs.name = (caddr_t)&isopeer;
587 nfsdargs.namelen = len;
588 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
589 (void)close(msgsock);
590 }
591 if (tpipflag && FD_ISSET(tpipsock, &ready)) {
592 len = sizeof(inetpeer);
593 if ((msgsock = accept(tpipsock,
594 (struct sockaddr *)&inetpeer, &len)) < 0) {
595 syslog(LOG_ERR, "Accept failed: %m");
596 exit(1);
597 }
598 if (setsockopt(msgsock, SOL_SOCKET,
599 SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0)
600 syslog(LOG_ERR, "setsockopt SO_KEEPALIVE: %m");
601 nfsdargs.sock = msgsock;
602 nfsdargs.name = (caddr_t)&inetpeer;
603 nfsdargs.namelen = len;
604 nfssvc(NFSSVC_ADDSOCK, &nfsdargs);
605 (void)close(msgsock);
606 }
607 #endif /* notyet */
608 }
609 }
610
611 void
612 usage()
613 {
614 (void)fprintf(stderr, "usage: nfsd %s\n", USAGE);
615 exit(1);
616 }
617
618 void
619 nonfs(signo)
620 int signo;
621 {
622
623 syslog(LOG_ERR, "missing system call: NFS not available.");
624 }
625
626 void
627 reapchild(signo)
628 int signo;
629 {
630
631 while (wait3(NULL, WNOHANG, NULL) > 0);
632 }
633