Commit 3363091b authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

sync with trunk


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac345@3099 e5f2f494-b856-4b98-b285-d166d9295462
parents c5e4d427 c2eb613d
101. [func] jinmei
src/lib/dns: Completed Opcode and Rcode implementation with more
tests and documentation. API is mostly the same but the
validation was a bit tightened. (Trac #351, svn r3056)
100. [func] Michal Vaner
Python processes: support naming of python processes so
they're not all called python3.
(Trac #322, svn r3052)
99. [func]* jinmei
Introduced a separate EDNS class to encapsulate EDNS related
information more cleanly. The related APIs are changed a bit,
although it won't affect most of higher level applications.
(Trac #311, svn r3020)
98. [build] jinmei
The ./configure script now tries to search some common include
paths for boost header files to minimize the need for explicit
configuration with --with-boost-include. (Trac #323, svn r3006)
97. [func] jinmei
Added a micro benchmark test for query processing of b10-auth.
(Trac #308, svn r2982)
......
......@@ -48,6 +48,12 @@ if test $enable_shared = no; then
AC_MSG_ERROR([BIND 10 requires shared libraries to be built])
fi
# allow configuring without setproctitle.
AC_ARG_ENABLE(setproctitle-check,
AC_HELP_STRING([--disable-setproctitle-check],
[do not check for python setproctitle module (used to give nice names to python processes)]),
setproctitle_check=$enableval, setproctitle_check=yes)
# OS dependent configuration
SET_ENV_LIBRARY_PATH=no
ENV_LIBRARY_PATH=LD_LIBRARY_PATH
......@@ -162,6 +168,18 @@ fi
AC_SUBST(PYTHON_LIB)
LDFLAGS=$LDFLAGS_SAVED
# Check for the setproctitle module
if test "$setproctitle_check" = "yes" ; then
AC_MSG_CHECKING(for setproctitle module)
if "$PYTHON" -c 'import setproctitle' 2>/dev/null ; then
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT(missing)
AC_MSG_ERROR([Missing setproctitle module. Either install it or provide --disable-setproctitle-check.
In that case we will continue, but naming of python processes will not work.])
fi
fi
# TODO: check for _sqlite3.py module
# Compiler dependent settings: define some mandatory CXXFLAGS here.
......@@ -277,14 +295,31 @@ if test "$lcov" != "no"; then
fi
AC_SUBST(USE_LCOV)
#
# Configure Boost header path
#
# If explicitly specified, use it.
AC_ARG_WITH([boost-include],
AC_HELP_STRING([--with-boost-include=PATH],
[specify exact directory for Boost headers]),
[boost_include_path="$withval"])
# If not specified, try some common paths.
if test -z "$with_boost_include"; then
boostdirs="/usr/local /usr/pkg /opt /opt/local"
for d in $boostdirs
do
if test -f $d/include/boost/shared_ptr.hpp; then
boost_include_path=$d/include
break
fi
done
fi
if test "${boost_include_path}" ; then
BOOST_INCLUDES="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
fi
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
AC_MSG_ERROR([Missing required header files.]))
AC_SUBST(BOOST_INCLUDES)
#
......@@ -399,10 +434,6 @@ if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_DEV_POLL=1"
fi
# Check for headers from required devel kits.
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp],,
AC_MSG_ERROR([Missing required header files.]))
AC_ARG_ENABLE(man, [AC_HELP_STRING([--enable-man],
[regenerate man pages [default=no]])] ,enable_man=yes, enable_man=no)
......@@ -433,6 +464,7 @@ AC_CONFIG_FILES([Makefile
src/bin/msgq/tests/Makefile
src/bin/auth/Makefile
src/bin/auth/tests/Makefile
src/bin/auth/tests/testdata/Makefile
src/bin/auth/benchmarks/Makefile
src/bin/xfrin/Makefile
src/bin/xfrin/tests/Makefile
......@@ -441,6 +473,7 @@ AC_CONFIG_FILES([Makefile
src/bin/zonemgr/Makefile
src/bin/zonemgr/tests/Makefile
src/bin/usermgr/Makefile
src/bin/tests/Makefile
src/lib/Makefile
src/lib/bench/Makefile
src/lib/bench/example/Makefile
......@@ -449,6 +482,8 @@ AC_CONFIG_FILES([Makefile
src/lib/cc/tests/Makefile
src/lib/python/Makefile
src/lib/python/isc/Makefile
src/lib/python/isc/utils/Makefile
src/lib/python/isc/utils/tests/Makefile
src/lib/python/isc/datasrc/Makefile
src/lib/python/isc/cc/Makefile
src/lib/python/isc/cc/tests/Makefile
......@@ -463,6 +498,7 @@ AC_CONFIG_FILES([Makefile
src/lib/config/testdata/Makefile
src/lib/dns/Makefile
src/lib/dns/tests/Makefile
src/lib/dns/tests/testdata/Makefile
src/lib/dns/python/Makefile
src/lib/dns/python/tests/Makefile
src/lib/exceptions/Makefile
......@@ -506,6 +542,7 @@ AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
src/bin/msgq/run_msgq.sh
src/bin/auth/auth.spec.pre
src/bin/auth/spec_config.h.pre
src/bin/tests/process_rename_test.py
src/lib/config/tests/data_def_unittests_config.h
src/lib/python/isc/config/tests/config_test
src/lib/python/isc/cc/tests/cc_test
......
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout usermgr zonemgr
SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout \
usermgr zonemgr tests
check-recursive: all-recursive
......@@ -24,10 +24,13 @@
#include <exceptions/exceptions.h>
#include <dns/buffer.h>
#include <dns/edns.h>
#include <dns/exceptions.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/question.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
#include <dns/rrset.h>
#include <dns/rrttl.h>
#include <dns/message.h>
......@@ -164,7 +167,6 @@ makeErrorMessage(Message& message, MessageRenderer& renderer,
message.setQid(qid);
message.setOpcode(opcode);
message.setHeaderFlag(MessageFlag::QR());
message.setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
if (rd) {
message.setHeaderFlag(MessageFlag::RD());
}
......@@ -302,14 +304,21 @@ bool
AuthSrvImpl::processNormalQuery(const IOMessage& io_message, Message& message,
MessageRenderer& response_renderer)
{
const bool dnssec_ok = message.isDNSSECSupported();
const uint16_t remote_bufsize = message.getUDPSize();
ConstEDNSPtr remote_edns = message.getEDNS();
const bool dnssec_ok = remote_edns && remote_edns->getDNSSECAwareness();
const uint16_t remote_bufsize = remote_edns ? remote_edns->getUDPSize() :
Message::DEFAULT_MAX_UDPSIZE;
message.makeResponse();
message.setHeaderFlag(MessageFlag::AA());
message.setRcode(Rcode::NOERROR());
message.setDNSSECSupported(dnssec_ok);
message.setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
if (remote_edns) {
EDNSPtr local_edns = EDNSPtr(new EDNS());
local_edns->setDNSSECAwareness(dnssec_ok);
local_edns->setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
message.setEDNS(local_edns);
}
try {
Query query(message, cache_, dnssec_ok);
......
SUBDIRS = testdata .
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/bin
AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc
AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(top_builddir)/src/bin/auth/tests/testdata\"
AM_CXXFLAGS = $(B10_CXXFLAGS)
......@@ -36,25 +39,3 @@ run_unittests_LDADD += $(top_builddir)/src/lib/xfr/libxfr.la
endif
noinst_PROGRAMS = $(TESTS)
EXTRA_DIST = testdata/badExampleQuery_fromWire
EXTRA_DIST += testdata/badExampleQuery_fromWire.spec
EXTRA_DIST += testdata/example.com
EXTRA_DIST += testdata/examplequery_fromWire
EXTRA_DIST += testdata/examplequery_fromWire.spec
EXTRA_DIST += testdata/example.sqlite3
EXTRA_DIST += testdata/iqueryresponse_fromWire
EXTRA_DIST += testdata/iqueryresponse_fromWire.spec
EXTRA_DIST += testdata/multiquestion_fromWire
EXTRA_DIST += testdata/multiquestion_fromWire.spec
EXTRA_DIST += testdata/queryBadEDNS_fromWire
EXTRA_DIST += testdata/queryBadEDNS_fromWire.spec
EXTRA_DIST += testdata/shortanswer_fromWire
EXTRA_DIST += testdata/shortanswer_fromWire.spec
EXTRA_DIST += testdata/shortmessage_fromWire
EXTRA_DIST += testdata/shortquestion_fromWire
EXTRA_DIST += testdata/shortresponse_fromWire
EXTRA_DIST += testdata/simplequery_fromWire
EXTRA_DIST += testdata/simplequery_fromWire.spec
EXTRA_DIST += testdata/simpleresponse_fromWire
EXTRA_DIST += testdata/simpleresponse_fromWire.spec
......@@ -22,6 +22,8 @@
#include <dns/name.h>
#include <dns/message.h>
#include <dns/messagerenderer.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
#include <dns/rrclass.h>
#include <dns/rrtype.h>
......@@ -114,7 +116,7 @@ protected:
AuthSrvTest() : server(true, xfrout),
request_message(Message::RENDER),
parse_message(Message::PARSE), default_qid(0x1035),
opcode(Opcode(Opcode::QUERY())), qname("www.example.com"),
opcode(Opcode::QUERY()), qname("www.example.com"),
qclass(RRClass::IN()), qtype(RRType::A()),
io_message(NULL), endpoint(NULL), request_obuffer(0),
request_renderer(request_obuffer),
......@@ -280,6 +282,7 @@ AuthSrvTest::createRequestMessage(const Opcode& opcode,
{
request_message.clear(Message::RENDER);
request_message.setOpcode(opcode);
request_message.setRcode(Rcode::NOERROR());
request_message.setQid(default_qid);
request_message.addQuestion(Question(request_name, rrclass, rrtype));
}
......@@ -341,7 +344,7 @@ TEST_F(AuthSrvTest, unsupportedRequest) {
i == Opcode::NOTIFY().getCode()) {
continue;
}
createDataFromFile("simplequery_fromWire");
createDataFromFile("simplequery_fromWire.wire");
data[2] = ((i << 3) & 0xff);
parse_message.clear(Message::PARSE);
......@@ -363,7 +366,7 @@ TEST_F(AuthSrvTest, verbose) {
// Multiple questions. Should result in FORMERR.
TEST_F(AuthSrvTest, multiQuestion) {
createDataFromFile("multiquestion_fromWire");
createDataFromFile("multiquestion_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
headerCheck(parse_message, default_qid, Rcode::FORMERR(), opcode.getCode(),
......@@ -393,7 +396,7 @@ TEST_F(AuthSrvTest, shortMessage) {
// or malformed or could otherwise cause a protocol error.
TEST_F(AuthSrvTest, response) {
// A valid (although unusual) response
createDataFromFile("simpleresponse_fromWire");
createDataFromFile("simpleresponse_fromWire.wire");
EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
response_renderer));
......@@ -404,7 +407,7 @@ TEST_F(AuthSrvTest, response) {
response_renderer));
// A response to iquery. must be dropped rather than returning NOTIMP.
createDataFromFile("iqueryresponse_fromWire");
createDataFromFile("iqueryresponse_fromWire.wire");
EXPECT_EQ(false, server.processMessage(*io_message, parse_message,
response_renderer));
}
......@@ -422,7 +425,7 @@ TEST_F(AuthSrvTest, shortQuestion) {
// Query with a broken answer section
TEST_F(AuthSrvTest, shortAnswer) {
createDataFromFile("shortanswer_fromWire");
createDataFromFile("shortanswer_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
......@@ -441,17 +444,24 @@ TEST_F(AuthSrvTest, shortAnswer) {
// Query with unsupported version of EDNS.
TEST_F(AuthSrvTest, ednsBadVers) {
createDataFromFile("queryBadEDNS_fromWire");
createDataFromFile("queryBadEDNS_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
// The response must have an EDNS OPT RR in the additional section.
// The response must have an EDNS OPT RR in the additional section, but
// it will be added automatically at the render time.
// Note that the DNSSEC DO bit is cleared even if this bit in the query
// is set. This is a limitation of the current implementation.
headerCheck(parse_message, default_qid, Rcode::BADVERS(), opcode.getCode(),
QR_FLAG, 1, 0, 0, 1);
EXPECT_EQ(4096, parse_message.getUDPSize());
EXPECT_FALSE(parse_message.isDNSSECSupported());
EXPECT_FALSE(parse_message.getEDNS()); // EDNS isn't added at this point
parse_message.clear(Message::PARSE);
InputBuffer ib(response_renderer.getData(), response_renderer.getLength());
parse_message.fromWire(ib);
EXPECT_EQ(Rcode::BADVERS(), parse_message.getRcode());
EXPECT_TRUE(parse_message.getEDNS());
EXPECT_FALSE(parse_message.getEDNS()->getDNSSECAwareness());
}
TEST_F(AuthSrvTest, AXFROverUDP) {
......@@ -577,6 +587,7 @@ TEST_F(AuthSrvTest, notifyForCHClass) {
TEST_F(AuthSrvTest, notifyEmptyQuestion) {
request_message.clear(Message::RENDER);
request_message.setOpcode(Opcode::NOTIFY());
request_message.setRcode(Rcode::NOERROR());
request_message.setHeaderFlag(MessageFlag::AA());
request_message.setQid(default_qid);
request_message.toWire(request_renderer);
......@@ -715,7 +726,7 @@ TEST_F(AuthSrvTest, updateConfig) {
// query for existent data in the installed data source. The resulting
// response should have the AA flag on, and have an RR in each answer
// and authority section.
createDataFromFile("examplequery_fromWire");
createDataFromFile("examplequery_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
headerCheck(parse_message, default_qid, Rcode::NOERROR(), opcode.getCode(),
......@@ -729,7 +740,7 @@ TEST_F(AuthSrvTest, datasourceFail) {
// tool and the data source itself naively accept it). This will result
// in a SERVFAIL response, and the answer and authority sections should
// be empty.
createDataFromFile("badExampleQuery_fromWire");
createDataFromFile("badExampleQuery_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
headerCheck(parse_message, default_qid, Rcode::SERVFAIL(),
......@@ -744,7 +755,7 @@ TEST_F(AuthSrvTest, updateConfigFail) {
updateConfig(&server, BADCONFIG_TESTDB, false);
// The original data source should still exist.
createDataFromFile("examplequery_fromWire");
createDataFromFile("examplequery_fromWire.wire");
EXPECT_EQ(true, server.processMessage(*io_message, parse_message,
response_renderer));
headerCheck(parse_message, default_qid, Rcode::NOERROR(), opcode.getCode(),
......
......@@ -23,6 +23,7 @@ main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR);
return (RUN_ALL_TESTS());
}
CLEANFILES = *.wire
BUILT_SOURCES = badExampleQuery_fromWire.wire examplequery_fromWire.wire
BUILT_SOURCES += iqueryresponse_fromWire.wire multiquestion_fromWire.wire
BUILT_SOURCES += queryBadEDNS_fromWire.wire shortanswer_fromWire.wire
BUILT_SOURCES += simplequery_fromWire.wire simpleresponse_fromWire.wire
# NOTE: keep this in sync with real file listing
# so is included in tarball
EXTRA_DIST = badExampleQuery_fromWire.spec
EXTRA_DIST += examplequery_fromWire.spec
EXTRA_DIST += iqueryresponse_fromWire.spec
EXTRA_DIST += multiquestion_fromWire.spec
EXTRA_DIST += queryBadEDNS_fromWire.spec
EXTRA_DIST += shortanswer_fromWire.spec
EXTRA_DIST += shortmessage_fromWire
EXTRA_DIST += shortquestion_fromWire
EXTRA_DIST += shortresponse_fromWire
EXTRA_DIST += simplequery_fromWire.spec
EXTRA_DIST += simpleresponse_fromWire.spec
EXTRA_DIST += example.com
EXTRA_DIST += example.sqlite3
.spec.wire:
$(abs_top_builddir)/src/lib/dns/tests/testdata/gen-wiredata.py -o $@ $<
###
### This data file was auto-generated from badExampleQuery_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=broken.example.com QTYPE=AAAA(28) QCLASS=IN(1)
0662726f6b656e076578616d706c6503636f6d00 001c 0001
###
### This data file was auto-generated from examplequery_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=ns.example.com QTYPE=A(1) QCLASS=IN(1)
026e73076578616d706c6503636f6d00 0001 0001
###
### This data file was auto-generated from iqueryresponse_fromWire.spec
###
# Header Section
# ID=4149 QR=Response Opcode=IQUERY(1) Rcode=NOERROR(0)
1035 c000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
###
### This data file was auto-generated from multiquestion_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=2, ANCNT=0, NSCNT=0, ARCNT=0
0002 0000 0000 0000
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
# Question Section
# QNAME=example.com. QTYPE=AAAA(28) QCLASS=IN(1)
076578616d706c6503636f6d00 001c 0001
###
### This data file was auto-generated from queryBadEDNS_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=1
0001 0000 0000 0001
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
# EDNS OPT RR
# NAME=. TYPE=OPT(41) UDPSize=4096 ExtRcode=0 Version=1 DO=1
00 0029 1000 0001 8000
# RDLEN=0
0000
###
### This data file was auto-generated from shortanswer_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=1, ANCNT=1, NSCNT=0, ARCNT=0
0001 0001 0000 0000
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
###
### This data file was auto-generated from simplequery_fromWire.spec
###
# Header Section
# ID=4149 QR=Query Opcode=QUERY(0) Rcode=NOERROR(0)
1035 0000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
###
### This data file was auto-generated from simpleresponse_fromWire.spec
###
# Header Section
# ID=4149 QR=Response Opcode=QUERY(0) Rcode=NOERROR(0)
1035 8000
# QDCNT=1, ANCNT=0, NSCNT=0, ARCNT=0
0001 0000 0000 0000
# Question Section
# QNAME=example.com. QTYPE=A(1) QCLASS=IN(1)
076578616d706c6503636f6d00 0001 0001
SUBDIRS = tests
SUBDIRS = . tests
sbin_SCRIPTS = bind10
CLEANFILES = bind10 bind10.pyc
......
'\" t
.\" Title: bind10
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Generator: DocBook XSL Stylesheets v1.76.0 <http://docbook.sf.net/>
.\" Date: July 29, 2010
.\" Manual: BIND10
.\" Source: BIND10
......@@ -9,6 +9,15 @@
.\"
.TH "BIND10" "8" "July 29, 2010" "BIND10" "BIND10"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
......@@ -22,7 +31,7 @@
bind10 \- BIND 10 boss process
.SH "SYNOPSIS"
.HP \w'\fBbind10\fR\ 'u
\fBbind10\fR [\fB\-a\ \fR\fB\fIaddress\fR\fR] [\fB\-m\ \fR\fB\fIfile\fR\fR] [\fB\-n\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-\-address\ \fR\fB\fIaddress\fR\fR] [\fB\-\-msgq\-socket\-file\ \fR\fB\fIfile\fR\fR] [\fB\-\-no\-cache\fR] [\fB\-\-port\ \fR\fB\fInumber\fR\fR] [\fB\-\-user\ \fR\fB\fIuser\fR\fR] [\fB\-\-verbose\fR]
\fBbind10\fR [\fB\-a\ \fR\fB\fIaddress\fR\fR] [\fB\-m\ \fR\fB\fIfile\fR\fR] [\fB\-n\fR] [\fB\-p\ \fR\fB\fInumber\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-\-address\ \fR\fB\fIaddress\fR\fR] [\fB\-\-msgq\-socket\-file\ \fR\fB\fIfile\fR\fR] [\fB\-\-no\-cache\fR] [\fB\-\-port\ \fR\fB\fInumber\fR\fR] [\fB\-\-user\ \fR\fB\fIuser\fR\fR] [\fB\-\-pretty\-name\ \fR\fB\fIname\fR\fR] [\fB\-\-verbose\fR]
.SH "DESCRIPTION"
.PP
The
......@@ -86,6 +95,15 @@ to run as\&.
must be initially ran as the root user to use this option\&. The default is to run as the current user\&.
.RE
.PP
\fB\-\-pretty\-name \fR\fB\fIname\fR\fR
.RS 4
The name this process should have in tools like
\fBps\fR
or
\fBtop\fR\&. This is handy if you have multiple versions/installations of
\fBbind10\fR\&.
.RE
.PP
\fB\-v\fR, \fB\-\-verbose\fR
.RS 4
Display more about what is going on for
......
......@@ -63,6 +63,10 @@ import pwd
import posix
import isc.cc
import isc.utils.process
# Assign this process some longer name
isc.utils.process.rename(sys.argv[0])
# This is the version that gets displayed to the user.
# The VERSION string consists of the module name, the module version
......@@ -620,7 +624,11 @@ def check_addr(option, opt_str, value, parser):
parser.values.address = value
else:
raise OptionValueError("Unknown option " + opt_str)
def process_rename(option, opt_str, value, parser):
"""Function that renames the process if it is requested by a option."""
isc.utils.process.rename(value)
def main():
global options
global boss_of_bind
......@@ -646,6 +654,9 @@ def main():
help="Change user after startup (must run as root)")
parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
help="display more about what is going on")
parser.add_option("--pretty-name", type="string", action="callback",
callback=process_rename,
help="Set the process name (displayed in ps, top, ...)")
(options, args) = parser.parse_args()
if args:
parser.print_help()
......
......@@ -56,6 +56,7 @@
<arg><option>--no-cache</option></arg>
<arg><option>--port <replaceable>number</replaceable></option></arg>
<arg><option>--user <replaceable>user</replaceable></option></arg>
<arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
<arg><option>--verbose</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
......@@ -148,6 +149,17 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--pretty-name <replaceable>name</replaceable></option></term>
<listitem>
<para>The name this process should have in tools like
<command>ps</command> or <command>top</command>. This
is handy if you have multiple versions/installations
of <command>bind10</command>.</para>
</listitem>
</varlistentry>
<varlistentry>