Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nfs-utils / utils / statd / simu.c
bloba7ecb85c275509e687c4351955c4c5b4d1e3c03d
1 /*
2 * Copyright (C) 1995, 1997-1999 Jeffrey A. Uphoff
4 * NSM for Linux.
5 */
7 #ifdef HAVE_CONFIG_H
8 #include <config.h>
9 #endif
11 #include <arpa/inet.h>
13 #include "rpcmisc.h"
14 #include "statd.h"
15 #include "notlist.h"
17 extern void my_svc_exit (void);
21 * Services SM_SIMU_CRASH requests.
23 void *
24 sm_simu_crash_1_svc (void *argp, struct svc_req *rqstp)
26 struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
27 static char *result = NULL;
28 struct in_addr caller;
30 if (sin->sin_family != AF_INET) {
31 note(N_WARNING, "Call to statd from non-AF_INET address");
32 goto failure;
35 caller = sin->sin_addr;
36 if (caller.s_addr != htonl(INADDR_LOOPBACK)) {
37 note(N_WARNING, "Call to statd from non-local host %s",
38 inet_ntoa(caller));
39 goto failure;
42 if (ntohs(sin->sin_port) >= 1024) {
43 note(N_WARNING, "Call to statd-simu-crash from unprivileged port");
44 goto failure;
47 note (N_WARNING, "*** SIMULATING CRASH! ***");
48 my_svc_exit ();
50 if (rtnl)
51 nlist_kill (&rtnl);
53 failure:
54 return ((void *)&result);