AM_CFLAGS = -Wstrict-prototypes
-rundir = $(localstatedir)/run
-AM_CPPFLAGS += -DRUNDIR=\"$(rundir)\"
-
-logdir = $(localstatedir)/log/$(PACKAGE)
-AM_CPPFLAGS += -DLOGDIR=\"$(logdir)\"
-
if NDEBUG
AM_CPPFLAGS += -DNDEBUG
AM_CFLAGS += -fomit-frame-pointer
noinst_PROGRAMS =
noinst_SCRIPTS =
-do_subst = sed -e 's,[@]pkidir[@],$(pkidir),g' \
- -e 's,[@]rundir[@],$(rundir),g' \
+do_subst = sed -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
+ -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
-e 's,[@]PERL[@],$(PERL),g'
ro_script = sed "`printf '1a\\' && printf '\\n\# -*- buffer-read-only: t -*-'`"
ro_man = printf '.\\" Local\040variables:\n.\\" buffer-read-only: t\n.\\" End:\n'
+ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
EXTRA_DIST += README.hwtables
Causes a file (by default, \fBcontroller.pid\fR) to be created indicating
the PID of the running process. If \fIpidfile\fR is not specified, or
if it does not begin with \fB/\fR, then it is created in
-\fB@rundir@\fR.
+\fB@RUNDIR@\fR.
.TP
\fB-f\fR, \fB--force\fR
include/daemon.h \
include/dhcp-client.h \
include/dhcp.h \
+ include/dirs.h \
include/dynamic-string.h \
include/dpif.h \
include/fatal-signal.h \
--- /dev/null
+/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+ * Junior University
+ *
+ * We are making the OpenFlow specification and associated documentation
+ * (Software) available for public use and benefit with the expectation
+ * that others will use, modify and enhance the Software and contribute
+ * those enhancements back to the community. However, since we would
+ * like to make the Software available for broadest use, with as few
+ * restrictions as possible permission is hereby granted, free of
+ * charge, to any person obtaining a copy of this Software to deal in
+ * the Software under the copyrights without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * The name and trademarks of copyright holder(s) may NOT be used in
+ * advertising or publicity pertaining to the Software or any
+ * derivatives without specific, written prior permission.
+ */
+
+#ifndef DIRS_H
+#define DIRS_H 1
+
+extern const char ofp_rundir[]; /* /usr/local/var/run */
+extern const char ofp_logdir[]; /* /usr/local/var/log */
+
+#endif /* dirs.h */
lib/vconn-stream.c \
lib/vconn.c \
lib/vlog-socket.c \
+ lib/dirs.c \
lib/vlog.c
if HAVE_NETLINK
lib/dh2048.pem \
lib/dh4096.pem \
lib/dhparams.h
+
+lib/dirs.c: Makefile
+ ($(ro_c) && \
+ echo 'const char ofp_rundir[] = "@RUNDIR@";' && \
+ echo 'const char ofp_logdir[] = "@LOGDIR@";') > lib/dirs.c.tmp
+ mv lib/dirs.c.tmp lib/dirs.c
#include <string.h>
#include <unistd.h>
#include "fatal-signal.h"
+#include "dirs.h"
#include "util.h"
#define THIS_MODULE VLM_daemon
char *
make_pidfile_name(const char *name)
{
- return (!name ? xasprintf("%s/%s.pid", RUNDIR, program_name)
+ return (!name ? xasprintf("%s/%s.pid", ofp_rundir, program_name)
: *name == '/' ? xstrdup(name)
- : xasprintf("%s/%s", RUNDIR, name));
+ : xasprintf("%s/%s", ofp_rundir, name));
}
/* Sets up a following call to daemonize() to create a pidfile named 'name'.
" -D, --detach run in background as daemon\n"
" -P, --pidfile[=FILE] create pidfile (default: %s/%s.pid)\n"
" -f, --force with -P, start even if already running\n",
- RUNDIR, program_name);
+ ofp_rundir, program_name);
}
+# -*- autoconf -*-
+
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford
# Junior University
#
[AC_CHECK_LIB([socket], [connect])
AC_SEARCH_LIBS([gethostbyname], [resolv], [RESOLVER_LIBS=-lresolv])])
+dnl Checks for the directory in which to store the PKI.
+AC_DEFUN([OFP_CHECK_PKIDIR],
+ [AC_ARG_WITH(
+ [pkidir],
+ AC_HELP_STRING([--with-pkidir=DIR],
+ [PKI hierarchy directory [[DATADIR/openflow/pki]]]),
+ [PKIDIR=$withval],
+ [PKIDIR='${pkgdatadir}/pki'])
+ AC_SUBST([PKIDIR])])
+
+dnl Checks for the directory in which to store pidfiles.
+AC_DEFUN([OFP_CHECK_RUNDIR],
+ [AC_ARG_WITH(
+ [rundir],
+ AC_HELP_STRING([--with-rundir=DIR],
+ [directory used for pidfiles [[LOCALSTATEDIR/run]]]),
+ [RUNDIR=$withval],
+ [RUNDIR='${localstatedir}/run'])
+ AC_SUBST([RUNDIR])])
+
+dnl Checks for the directory in which to store logs.
+AC_DEFUN([OFP_CHECK_LOGDIR],
+ [AC_ARG_WITH(
+ [logdir],
+ AC_HELP_STRING([--with-logdir=DIR],
+ [directory used for logs [[LOCALSTATEDIR/log/PACKAGE]]]),
+ [LOGDIR=$withval],
+ [LOGDIR='${localstatedir}/log/${PACKAGE}'])
+ AC_SUBST([LOGDIR])])
dnl Runs the checks required to include the headers in include/ and
dnl link against lib/libopenflow.a.
AC_REQUIRE([OFP_CHECK_SNAT])
AC_REQUIRE([OFP_CHECK_FAULT_LIBS])
AC_REQUIRE([OFP_CHECK_SOCKET_LIBS])
+ AC_REQUIRE([OFP_CHECK_PKIDIR])
+ AC_REQUIRE([OFP_CHECK_RUNDIR])
+ AC_REQUIRE([OFP_CHECK_LOGDIR])
AC_CHECK_FUNCS([strlcpy])])
Causes a file (by default, \fBsecchan.pid\fR) to be created indicating
the PID of the running process. If \fIpidfile\fR is not specified, or
if it does not begin with \fB/\fR, then it is created in
-\fB@rundir@\fR.
+\fB@RUNDIR@\fR.
.TP
\fB-f\fR, \fB--force\fR
Causes a file (by default, \fBswitch.pid\fR) to be created indicating
the PID of the running process. If \fIpidfile\fR is not specified, or
if it does not begin with \fB/\fR, then it is created in
-\fB@rundir@\fR.
+\fB@RUNDIR@\fR.
.TP
\fB-f\fR, \fB--force\fR
utilities_ofp_kill_SOURCES = utilities/ofp-kill.c
utilities_ofp_kill_LDADD = lib/libopenflow.a
-pkidir = $(pkgdatadir)/pki
-
utilities/ofp-pki: utilities/ofp-pki.in Makefile
$(do_subst) < $(srcdir)/utilities/ofp-pki.in \
| $(ro_script) > utilities/ofp-pki
Causes a file (by default, \fBofp\-discover.pid\fR) to be created indicating
the PID of the running process. If \fIpidfile\fR is not specified, or
if it does not begin with \fB/\fR, then it is created in
-\fB@rundir@\fR.
+\fB@RUNDIR@\fR.
The \fIpidfile\fR is created when \fBofp\-discover\fR detaches, so
this this option has no effect when one of \fB--exit-without-bind\fR,
#include "daemon.h"
#include "dhcp-client.h"
#include "dhcp.h"
+#include "dirs.h"
#include "dynamic-string.h"
#include "fatal-signal.h"
#include "netdev.h"
" -v, --verbose set maximum verbosity level\n"
" -h, --help display this help message\n"
" -V, --version display version information\n",
- program_name, program_name, RUNDIR, program_name);
+ program_name, program_name, ofp_rundir, program_name);
exit(EXIT_SUCCESS);
}
owns a lock on \fIpidfile\fR before it sends the signal.
A \fIpidfile\fR whose name begins with \fB/\fR is used literally.
-Otherwise, \fB@rundir@/\fR is prefixed.
+Otherwise, \fB@RUNDIR@/\fR is prefixed.
This program exists for use by \fBofp\-switch\-setup\fR, which cannot
easily implement its functionality since Perl has no portable
use strict;
use warnings;
-my $pkidir = '@pkidir@';
+my $pkidir = '@PKIDIR@';
my $q = new CGI;
die unless $q->request_method() eq 'POST';
.TP
\fBinit\fR
-Initializes a new PKI (by default in directory \fB@pkidir@\fR) and populates
+Initializes a new PKI (by default in directory \fB@PKIDIR@\fR) and populates
it with a pair of certificate authorities for controllers and
switches.
When DSA keys are used (as specified with \fB\-\^\-key=dsa\fR), \fBreq\fR
needs access to the \fBdsaparam.pem\fR file created as part of the PKI
hierarchy (but not to other files in that tree). By default,
-\fBofp\-pki\fR looks for this file in \fB@pkidir@/dsaparam.pem\fR, but
+\fBofp\-pki\fR looks for this file in \fB@PKIDIR@/dsaparam.pem\fR, but
the \fB\-D\fR or \fB\-\^\-dsaparam\fR option (see below) may be used to
specify an alternate location.
.TP
\fB\-d\fR \fIdir\fR | \fB\-\^\-dir=\fR\fIdir\fR
Specifies the location of the PKI hierarchy to be used or created by
-the command (default: \fB@pkidir@\fR). All commands, except \fBreq\fR,
+the command (default: \fB@PKIDIR@\fR). All commands, except \fBreq\fR,
need access to a PKI hierarchy.
.TP
#! /bin/sh -e
-pkidir='@pkidir@'
+pkidir='@PKIDIR@'
command=
prev=
force=no