[svn] commit: r2457 - in /branches/trac275: ./ src/bin/bindctl/ src/bin/xfrin/ src/bin/xfrout/ src/lib/cc/ src/lib/datasrc/ src/lib/datasrc/tests/ src/lib/dns/ src/lib/dns/python/ src/lib/dns/rdata/generic/ src/lib/dns/tests/ src/lib/python/isc/config/ src/lib/python/isc/datasrc/ src/lib/python/isc/log/ src/lib/xfr/
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jul 9 18:54:45 UTC 2010
Author: jinmei
Date: Fri Jul 9 18:54:44 2010
New Revision: 2457
Log:
sync with trunk
Modified:
branches/trac275/ (props changed)
branches/trac275/ChangeLog
branches/trac275/configure.ac
branches/trac275/src/bin/bindctl/bindcmd.py
branches/trac275/src/bin/xfrin/ (props changed)
branches/trac275/src/bin/xfrout/xfrout.py.in
branches/trac275/src/lib/cc/ (props changed)
branches/trac275/src/lib/datasrc/ (props changed)
branches/trac275/src/lib/datasrc/cache.cc (props changed)
branches/trac275/src/lib/datasrc/cache.h (props changed)
branches/trac275/src/lib/datasrc/tests/sqlite3_unittest.cc
branches/trac275/src/lib/datasrc/tests/static_unittest.cc
branches/trac275/src/lib/dns/ (props changed)
branches/trac275/src/lib/dns/python/rrttl_python.cc
branches/trac275/src/lib/dns/python/rrtype_python.cc
branches/trac275/src/lib/dns/rdata/generic/rrsig_46.cc (props changed)
branches/trac275/src/lib/dns/tests/ (props changed)
branches/trac275/src/lib/dns/tests/base64_unittest.cc
branches/trac275/src/lib/python/isc/config/ccsession.py
branches/trac275/src/lib/python/isc/datasrc/master.py
branches/trac275/src/lib/python/isc/log/log.py
branches/trac275/src/lib/xfr/Makefile.am
Modified: branches/trac275/ChangeLog
==============================================================================
--- branches/trac275/ChangeLog (original)
+++ branches/trac275/ChangeLog Fri Jul 9 18:54:44 2010
@@ -1,3 +1,14 @@
+ 73. [bug] jelte
+ Fixed a bug where in bindctl, locally changed settings were
+ reset when the list of running modules is updated. (Trac #285,
+ r2452)
+
+ 72. [build] jinmei
+ Added -R when linking python wrapper modules to libpython when
+ possible. This helps build BIND 10 on platforms that install
+ libpython whose path is unknown to run-time loader. NetBSD is a
+ known such platform. (Trac #148, r2427)
+
71. [func] each
Add "-a" (address) option to bind10 to specify an address for
the auth server to listen on.
Modified: branches/trac275/configure.ac
==============================================================================
--- branches/trac275/configure.ac (original)
+++ branches/trac275/configure.ac Fri Jul 9 18:54:44 2010
@@ -17,6 +17,20 @@
# Identify the compiler: this check must be after AC_PROG_CXX and AC_LANG.
AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes")
AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"])
+
+# Linker options
+
+# check -R rather than gcc specific -rpath to be as portable as possible.
+AC_MSG_CHECKING([whether -R flag is available in linker])
+LDFLAGS_SAVED="$LDFLAGS"
+LDFLAGS="$LDFLAGS -R/usr/lib"
+AC_TRY_LINK([],[],
+ [ AC_MSG_RESULT(yes)
+ rpath_available=yes
+ ],[ AC_MSG_RESULT(no)
+ rpath_available=no
+ ])
+LDFLAGS=$LDFLAGS_SAVED
# OS dependent compiler flags
case "$host" in
@@ -83,6 +97,20 @@
AC_MSG_WARN([${PYTHON}-config does not exist or is not executable, so we could not detect python development environment. Your system may require an additional package (e.g. "python3-dev"). Alternatively, if you are sure you have python headers and libraries, define PYTHON_INCLUDES and PYTHON_LDFLAGS and run this script.])
fi
fi
+
+# Some OSes including NetBSD don't install libpython.so in a well known path.
+# To avoid requiring dynamic library path with our python wrapper loadable
+# modules, we embed the path to the modules when possible. We do this even
+# when the path is known in the common operational environment (e.g. when
+# it's stored in a common "hint" file) for simplicity.
+if test $rpath_available = yes; then
+ python_rpath=
+ for flag in ${PYTHON_LDFLAGS}; do
+ python_rpath="${python_rpath} `echo $flag | sed -ne 's/^\(\-L\)/-R/p'`"
+ done
+ PYTHON_LDFLAGS="${PYTHON_LDFLAGS} ${python_rpath}"
+fi
+
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LDFLAGS)
@@ -91,9 +119,7 @@
AC_CHECK_HEADERS([Python.h],, AC_MSG_ERROR([Missing Python.h]))
CPPFLAGS="$CPPFLAGS_SAVED"
-
-# Check for python library (not absolutely mandatory, but needed for
-# Boost.Python when we use it. See below.)
+# Check for python library. Needed for Python-wrapper libraries.
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
python_bin="python${PYTHON_VERSION}"
@@ -102,6 +128,7 @@
PYTHON_LIB="-l$python_lib"
fi
AC_SUBST(PYTHON_LIB)
+LDFLAGS=$LDFLAGS_SAVED
# TODO: check for _sqlite3.py module
@@ -143,6 +170,7 @@
B10_CXXFLAGS="$B10_CXXFLAGS -Werror"],
[AC_MSG_RESULT(yes)])
CXXFLAGS="$CXXFLAGS_SAVED"
+
fi dnl GXX = yes
AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
@@ -235,8 +263,6 @@
BOOST_LDFLAGS="-L$withval"
fi])
AC_SUBST(BOOST_LDFLAGS)
-
-# Check availability of the Boost Python library
#
# Check availability of gtest, which will be used for unit tests.
@@ -487,8 +513,10 @@
CXXFLAGS: $CXXFLAGS
B10_CXXFLAGS: $B10_CXXFLAGS
dnl includes too
- Boost Python: $BOOST_PYTHON_LIB
- SQLite: $SQLITE_CFLAGS
+ Python: ${PYTHON_INCLUDES}
+ ${PYTHON_LDFLAGS}
+ ${PYTHON_LIB}
+ SQLite: $SQLITE_CFLAGS
$SQLITE_LIBS
Features:
Modified: branches/trac275/src/bin/bindctl/bindcmd.py
==============================================================================
--- branches/trac275/src/bin/bindctl/bindcmd.py (original)
+++ branches/trac275/src/bin/bindctl/bindcmd.py Fri Jul 9 18:54:44 2010
@@ -102,7 +102,8 @@
self.conn = ValidatedHTTPSConnection(self.server_port,
ca_certs=pem_file)
self.session_id = self._get_session_id()
-
+ self.config_data = None
+
def _get_session_id(self):
'''Generate one session id for the connection. '''
rand = os.urandom(16)
@@ -252,7 +253,10 @@
should be called before interpreting command line or complete-key
is entered. This may not be the best way to keep bindctl
and cmdctl share same modules information, but it works.'''
- self.config_data = isc.config.UIModuleCCSession(self)
+ if self.config_data is not None:
+ self.config_data.update_specs_and_config()
+ else:
+ self.config_data = isc.config.UIModuleCCSession(self)
self._update_commands()
def precmd(self, line):
Modified: branches/trac275/src/bin/xfrout/xfrout.py.in
==============================================================================
--- branches/trac275/src/bin/xfrout/xfrout.py.in (original)
+++ branches/trac275/src/bin/xfrout/xfrout.py.in Fri Jul 9 18:54:44 2010
@@ -79,10 +79,17 @@
sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
try:
self.dns_xfrout_start(sock, msgdata)
+ #TODO, avoid catching all exceptions
except Exception as e:
self._log.log_message("error", str(e))
- sock.shutdown(socket.SHUT_RDWR)
+ try:
+ sock.shutdown(socket.SHUT_RDWR)
+ except socket.error:
+ # Avoid socket error caused by shutting down
+ # one non-connected socket.
+ pass
+
sock.close()
os.close(fd)
pass
Modified: branches/trac275/src/lib/datasrc/tests/sqlite3_unittest.cc
==============================================================================
--- branches/trac275/src/lib/datasrc/tests/sqlite3_unittest.cc (original)
+++ branches/trac275/src/lib/datasrc/tests/sqlite3_unittest.cc Fri Jul 9 18:54:44 2010
@@ -376,8 +376,8 @@
DataSrcMatch match(www_name, rrclass);
data_source.findClosestEnclosure(match);
- EXPECT_EQ(NULL, match.getEnclosingZone());
- EXPECT_EQ(NULL, match.getDataSource());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getEnclosingZone());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getDataSource());
}
TEST_F(Sqlite3DataSourceTest, openFail) {
@@ -441,15 +441,15 @@
TEST_F(Sqlite3DataSourceTest, findClosestEnclosureNoMatch) {
DataSrcMatch match(nomatch_name, rrclass);
data_source.findClosestEnclosure(match);
- EXPECT_EQ(NULL, match.getEnclosingZone());
- EXPECT_EQ(NULL, match.getDataSource());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getEnclosingZone());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getDataSource());
}
TEST_F(Sqlite3DataSourceTest, findClosestClassMismatch) {
DataSrcMatch match(nomatch_name, rrclass);
data_source.findClosestEnclosure(match);
- EXPECT_EQ(NULL, match.getEnclosingZone());
- EXPECT_EQ(NULL, match.getDataSource());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getEnclosingZone());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getDataSource());
}
// If the query class is ANY, the result should be the same as the case where
Modified: branches/trac275/src/lib/datasrc/tests/static_unittest.cc
==============================================================================
--- branches/trac275/src/lib/datasrc/tests/static_unittest.cc (original)
+++ branches/trac275/src/lib/datasrc/tests/static_unittest.cc Fri Jul 9 18:54:44 2010
@@ -214,8 +214,8 @@
TEST_F(StaticDataSourceTest, findClosestEnclosureForVersionClassMismatch) {
DataSrcMatch match(version_name, RRClass::IN());
data_source.findClosestEnclosure(match);
- EXPECT_EQ(NULL, match.getEnclosingZone());
- EXPECT_EQ(NULL, match.getDataSource());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getEnclosingZone());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getDataSource());
}
TEST_F(StaticDataSourceTest, findClosestEnclosureForVersionPartial) {
@@ -242,8 +242,8 @@
TEST_F(StaticDataSourceTest, findClosestEnclosureNoMatch) {
DataSrcMatch match(nomatch_name, rrclass);
data_source.findClosestEnclosure(match);
- EXPECT_EQ(NULL, match.getEnclosingZone());
- EXPECT_EQ(NULL, match.getDataSource());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getEnclosingZone());
+ EXPECT_EQ(static_cast<void*>(NULL), match.getDataSource());
}
TEST_F(StaticDataSourceTest, findRRsetVersionTXT) {
Modified: branches/trac275/src/lib/dns/python/rrttl_python.cc
==============================================================================
--- branches/trac275/src/lib/dns/python/rrttl_python.cc (original)
+++ branches/trac275/src/lib/dns/python/rrttl_python.cc Fri Jul 9 18:54:44 2010
@@ -14,7 +14,11 @@
// $Id$
+#include <vector>
+
#include <dns/rrttl.h>
+
+using namespace std;
using namespace isc::dns;
//
@@ -160,14 +164,15 @@
PyErr_Clear();
self->rrttl = new RRTTL(i);
return (0);
- } else if (PyArg_ParseTuple(args, "O", &bytes) && PySequence_Check(bytes)) {
+ } else if (PyArg_ParseTuple(args, "O", &bytes) &&
+ PySequence_Check(bytes)) {
Py_ssize_t size = PySequence_Size(bytes);
- uint8_t data[size];
- int result = readDataFromSequence(data, size, bytes);
+ vector<uint8_t> data(size);
+ int result = readDataFromSequence(&data[0], size, bytes);
if (result != 0) {
return (result);
}
- InputBuffer ib(data, size);
+ InputBuffer ib(&data[0], size);
self->rrttl = new RRTTL(ib);
PyErr_Clear();
return (0);
Modified: branches/trac275/src/lib/dns/python/rrtype_python.cc
==============================================================================
--- branches/trac275/src/lib/dns/python/rrtype_python.cc (original)
+++ branches/trac275/src/lib/dns/python/rrtype_python.cc Fri Jul 9 18:54:44 2010
@@ -14,7 +14,11 @@
// $Id$
+#include <vector>
+
#include <dns/rrtype.h>
+
+using namespace std;
using namespace isc::dns;
//
@@ -203,12 +207,12 @@
return (0);
} else if (PyArg_ParseTuple(args, "O", &bytes) && PySequence_Check(bytes)) {
Py_ssize_t size = PySequence_Size(bytes);
- uint8_t data[size];
- int result = readDataFromSequence(data, size, bytes);
+ vector<uint8_t> data(size);
+ int result = readDataFromSequence(&data[0], size, bytes);
if (result != 0) {
return (result);
}
- InputBuffer ib(data, size);
+ InputBuffer ib(&data[0], size);
self->rrtype = new RRType(ib);
PyErr_Clear();
return (0);
Modified: branches/trac275/src/lib/dns/tests/base64_unittest.cc
==============================================================================
--- branches/trac275/src/lib/dns/tests/base64_unittest.cc (original)
+++ branches/trac275/src/lib/dns/tests/base64_unittest.cc Fri Jul 9 18:54:44 2010
@@ -54,8 +54,7 @@
EXPECT_EQ(expected, string(&output[0], &output[0] + output.size()));
}
-TEST_F(Base64Test, decode)
-{
+TEST_F(Base64Test, decode) {
for (vector<StringPair>::const_iterator it = test_sequence.begin();
it != test_sequence.end();
++it) {
@@ -82,8 +81,7 @@
EXPECT_THROW(decodeBase64("Zm==", decoded_data), BadBase64String);
}
-TEST_F(Base64Test, encode)
-{
+TEST_F(Base64Test, encode) {
for (vector<StringPair>::const_iterator it = test_sequence.begin();
it != test_sequence.end();
++it) {
Modified: branches/trac275/src/lib/python/isc/config/ccsession.py
==============================================================================
--- branches/trac275/src/lib/python/isc/config/ccsession.py (original)
+++ branches/trac275/src/lib/python/isc/config/ccsession.py Fri Jul 9 18:54:44 2010
@@ -323,6 +323,10 @@
for module in specs.keys():
self.set_specification(isc.config.ModuleSpec(specs[module]))
+ def update_specs_and_config(self):
+ self.request_specifications();
+ self.request_current_config();
+
def request_current_config(self):
"""Requests the current configuration from the configuration
manager through b10-cmdctl, and stores those as CURRENT"""
@@ -330,6 +334,7 @@
if 'version' not in config or config['version'] != 1:
raise ModuleCCSessionError("Bad config version")
self._set_current_config(config)
+
def add_value(self, identifier, value_str):
"""Add a value to a configuration list. Raises a DataTypeError
Modified: branches/trac275/src/lib/python/isc/datasrc/master.py
==============================================================================
--- branches/trac275/src/lib/python/isc/datasrc/master.py (original)
+++ branches/trac275/src/lib/python/isc/datasrc/master.py Fri Jul 9 18:54:44 2010
@@ -228,7 +228,7 @@
percent = (self.__cur * 100)/self.__filesize
sys.stdout.write("\r" + (80 * " "))
- sys.stdout.write("\r%d RR(s) loaded in %d second(s) (%.2f%% of %s%s)"\
+ sys.stdout.write("\r%d RR(s) loaded in %.2f second(s) (%.2f%% of %s%s)"\
% (MasterFile.__records_num, interval, percent, MasterFile.__file_type, self.__datafile))
def __del__(self):
Modified: branches/trac275/src/lib/python/isc/log/log.py
==============================================================================
--- branches/trac275/src/lib/python/isc/log/log.py (original)
+++ branches/trac275/src/lib/python/isc/log/log.py Fri Jul 9 18:54:44 2010
@@ -70,7 +70,7 @@
predetermined log file size
"""
dir = os.path.split(file_name)
- if(os.path.exists(dir[0])):
+ if (os.path.exists(dir[0])):
self.baseFilename = file_name
self.maxBytes = max_bytes
self.backupCount = backup_count
@@ -158,7 +158,7 @@
max_bytes : limit log growth
backup_count : max backup count
"""
- if(log_file != 0 and log_file != ''):
+ if (log_file != 0 and log_file != ''):
try:
self._file_handler = NSFileLogHandler(filename = log_file,
maxBytes = max_bytes, backupCount = backup_count)
@@ -194,7 +194,7 @@
configuration, or add it to the logger.
"""
if (self._file_handler in self.handlers):
- if(log_file != 0 and log_file != ''):
+ if (log_file != 0 and log_file != ''):
self._file_handler.update_config(log_file, backup_count, max_bytes)
else:
"""If log file is empty, the handler will be removed."""
@@ -208,19 +208,19 @@
"""Get config data from module configuration"""
log_file_str = config_data.get('log_file')
- if(log_file_str):
+ if (log_file_str):
self._log_file = log_file_str
severity_str = config_data.get('log_severity')
- if(severity_str):
+ if (severity_str):
self._severity = severity_str
versions_str = config_data.get('log_versions')
- if(versions_str):
+ if (versions_str):
self._versions = int(versions_str)
max_bytes_str = config_data.get('log_max_bytes')
- if(max_bytes_str):
+ if (max_bytes_str):
self._max_bytes = int(max_bytes_str)
def update_config(self, config_data):
@@ -231,7 +231,7 @@
self._get_config(config_data)
logLevel = LEVELS.get(self._severity, logging.NOTSET)
- if(logLevel != self.getEffectiveLevel()):
+ if (logLevel != self.getEffectiveLevel()):
self.setLevel(logLevel)
self._update_rotate_handler(self._log_file, self._versions, self._max_bytes)
Modified: branches/trac275/src/lib/xfr/Makefile.am
==============================================================================
--- branches/trac275/src/lib/xfr/Makefile.am (original)
+++ branches/trac275/src/lib/xfr/Makefile.am Fri Jul 9 18:54:44 2010
@@ -17,12 +17,3 @@
libxfr_python_la_SOURCES = fdshare_python.cc fd_share.cc fd_share.h
libxfr_python_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
libxfr_python_la_CXXFLAGS = $(AM_CXXFLAGS)
-
-#bind10_xfr_la_LDFLAGS = $(BOOST_LDFLAGS) $(PYTHON_LDFLAGS)
-
-# Python prefers .so, while some OSes (specifically MacOS) use a different
-# suffix for dynamic objects. -module is necessary to work this around.
-#bind10_xfr_la_LDFLAGS += -module
-#bind10_xfr_la_LIBADD = $(BOOST_PYTHON_LIB) $(PYTHON_LIB)
-#endif
-
More information about the bind10-changes
mailing list