]> git.pld-linux.org Git - packages/rpcbind.git/blame - rpcbind-warmstart.patch
- rel 5; disable broken ipv6
[packages/rpcbind.git] / rpcbind-warmstart.patch
CommitLineData
300b16f1
JR
1diff --git a/configure.in b/configure.in
2index 9a64b45..0e2f163 100644
3--- a/configure.in
4+++ b/configure.in
5@@ -18,6 +21,23 @@ AC_ARG_ENABLE(debug,[ --enable-debug Turns on rpcbind debugging],
6 esac],[debug=false])
7 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
a7f45529 8
300b16f1
JR
9+AC_ARG_ENABLE(warmstarts,[ --enable-warmstarts Enables Warm Starts],
10+ [case "${enableval}" in
11+ yes) warmstarts=true ;;
12+ no) warmstarts=no ;;
13+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-warmstarts) ;;
14+ esac],[warmstarts=false])
15+AM_CONDITIONAL(WARMSTART, test x$warmstarts = xtrue)
a7f45529 16+
300b16f1
JR
17+if test "$warmstarts" = "true" ; then
18+ AC_ARG_WITH(statedir,
19+ [ --with-statedir=/foo use state dir /foo [/tmp]],
20+ statedir=$withval,
21+ statedir=/tmp)
22+ AC_SUBST(statedir)
23+ AC_DEFINE_UNQUOTED(RPCBIND_STATEDIR, "$statedir", [This defines the location where the state files will be kept for warm starts])
24+fi
25+
26 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h \
27 netinet/in.h stdlib.h string.h \
28 sys/param.h sys/socket.h \
29diff --git a/man/rpcbind.8 b/man/rpcbind.8
30index 2d59ce8..7985f0f 100644
31--- a/man/rpcbind.8
32+++ b/man/rpcbind.8
33@@ -131,6 +131,14 @@ to use non-privileged ports for outgoing connections, preventing non-privileged
34 clients from using
35 .Nm
36 to connect to services from a privileged port.
37+.It Fl w
38+Cause
39+.Nm
40+to do a "warm start" by read a state file when
41+.Nm
42+starts up. The state file is created when
43+.Nm
44+terminates.
45 .El
46 .Sh NOTES
47 All RPC servers must be restarted if
48diff --git a/src/Makefile.am b/src/Makefile.am
49index 52d3857..fd80847 100644
50--- a/src/Makefile.am
51+++ b/src/Makefile.am
52@@ -1,5 +1,14 @@
53 INCLUDES = -I$(srcdir)/tirpc -DPORTMAP -DINET6 -DVERSION="\"$(VERSION)\"" \
54 -D_GNU_SOURCE -Wall -pipe
55+if DEBUG
56+INCLUDES += -DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
57+INCLUDES += -DND_DEBUG -DBIND_DEBUG
58+endif
59+
60+if WARMSTART
61+INCLUDES += -DWARMSTART
62+endif
a7f45529 63+
a7f45529 64
300b16f1
JR
65 bin_PROGRAMS = rpcbind rpcinfo
66
67@@ -18,10 +27,6 @@ rpcbind_LDFLAGS = -lpthread -ltirpc
68 rpcbind_LDADD = $(LIB_TIRPC)
69 AM_CPPFLAGS = -I/usr/include/tirpc -DCHECK_LOCAL -DPORTMAP \
70 -DFACILITY=LOG_MAIL -DSEVERITY=LOG_INFO
71-if DEBUG
72-INCLUDES += -DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
73-INCLUDES += -DND_DEBUG -DBIND_DEBUG
74-endif
75
76 $(rpcbind_OBJECTS) : security.o util.o check_bound.o pmap_svc.o \
77 rpcb_svc.o rpcb_svc_com.o rpcb_svc_4.o \
78diff --git a/src/warmstart.c b/src/warmstart.c
79index 4a40639..6a50c41 100644
80--- a/src/warmstart.c
81+++ b/src/warmstart.c
82@@ -46,17 +46,21 @@
83 #include <syslog.h>
84 #include <unistd.h>
a7f45529 85
300b16f1
JR
86+#include "config.h"
87 #include "rpcbind.h"
a7f45529 88
300b16f1
JR
89 /*
90 * XXX this code is unsafe and is not used. It should be made safe.
91 */
50cb7eec 92
300b16f1
JR
93+#ifndef RPCBIND_STATEDIR
94+#define RPCBIND_STATEDIR "/tmp"
95+#endif
50cb7eec
JR
96
97 /* These files keep the pmap_list and rpcb_list in XDR format */
98-#define RPCBFILE "/tmp/rpcbind.file"
300b16f1 99+#define RPCBFILE RPCBIND_STATEDIR "/rpcbind.file"
50cb7eec
JR
100 #ifdef PORTMAP
101-#define PMAPFILE "/tmp/portmap.file"
300b16f1 102+#define PMAPFILE RPCBIND_STATEDIR "/portmap.file"
50cb7eec
JR
103 #endif
104
105 static bool_t write_struct __P((char *, xdrproc_t, void *));
This page took 0.097217 seconds and 4 git commands to generate.