[svn] commit: r2621 - in /branches/trac289: ./ src/bin/ src/bin/bind10/ src/bin/xfrin/ src/bin/zonemgr/ src/bin/zonemgr/tests/ src/lib/cc/ src/lib/datasrc/ src/lib/dns/ src/lib/dns/rdata/generic/ src/lib/dns/tests/ src/lib/python/isc/datasrc/
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Aug 3 06:36:42 UTC 2010
Author: chenzhengzhang
Date: Tue Aug 3 06:36:42 2010
New Revision: 2621
Log:
merge secondary manager and notifyout
Added:
branches/trac289/src/bin/zonemgr/
- copied from r2619, branches/trac215/src/bin/zonemgr/
Modified:
branches/trac289/ (props changed)
branches/trac289/configure.ac
branches/trac289/src/bin/Makefile.am
branches/trac289/src/bin/bind10/bind10.py.in
branches/trac289/src/bin/bind10/run_bind10.sh.in
branches/trac289/src/bin/xfrin/ (props changed)
branches/trac289/src/bin/xfrin/xfrin.py.in
branches/trac289/src/bin/zonemgr/tests/zonemgr_test.py
branches/trac289/src/bin/zonemgr/zonemgr.py.in
branches/trac289/src/bin/zonemgr/zonemgr.spec.pre.in
branches/trac289/src/lib/cc/ (props changed)
branches/trac289/src/lib/datasrc/ (props changed)
branches/trac289/src/lib/dns/ (props changed)
branches/trac289/src/lib/dns/rdata/generic/rrsig_46.cc (props changed)
branches/trac289/src/lib/dns/tests/ (props changed)
branches/trac289/src/lib/python/isc/datasrc/sqlite3_ds.py
Modified: branches/trac289/configure.ac
==============================================================================
--- branches/trac289/configure.ac (original)
+++ branches/trac289/configure.ac Tue Aug 3 06:36:42 2010
@@ -411,6 +411,8 @@
src/bin/xfrin/tests/Makefile
src/bin/xfrout/Makefile
src/bin/xfrout/tests/Makefile
+ src/bin/zonemgr/Makefile
+ src/bin/zonemgr/tests/Makefile
src/bin/usermgr/Makefile
src/lib/Makefile
src/lib/cc/Makefile
@@ -450,6 +452,10 @@
src/bin/xfrout/xfrout.spec.pre
src/bin/xfrout/tests/xfrout_test
src/bin/xfrout/run_b10-xfrout.sh
+ src/bin/zonemgr/zonemgr.py
+ src/bin/zonemgr/zonemgr.spec.pre
+ src/bin/zonemgr/tests/zonemgr_test
+ src/bin/zonemgr/run_b10-zonemgr.sh
src/bin/bind10/bind10.py
src/bin/bind10/tests/bind10_test
src/bin/bind10/run_bind10.sh
@@ -480,10 +486,12 @@
chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
chmod +x src/bin/xfrin/run_b10-xfrin.sh
chmod +x src/bin/xfrout/run_b10-xfrout.sh
+ chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
chmod +x src/bin/bind10/run_bind10.sh
chmod +x src/bin/cmdctl/tests/cmdctl_test
chmod +x src/bin/xfrin/tests/xfrin_test
chmod +x src/bin/xfrout/tests/xfrout_test
+ chmod +x src/bin/zonemgr/tests/zonemgr_test
chmod +x src/bin/bindctl/tests/bindctl_test
chmod +x src/bin/bindctl/run_bindctl.sh
chmod +x src/bin/loadzone/run_loadzone.sh
Modified: branches/trac289/src/bin/Makefile.am
==============================================================================
--- branches/trac289/src/bin/Makefile.am (original)
+++ branches/trac289/src/bin/Makefile.am Tue Aug 3 06:36:42 2010
@@ -1,1 +1,1 @@
-SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout usermgr
+SUBDIRS = bind10 bindctl cfgmgr loadzone msgq host cmdctl auth xfrin xfrout usermgr zonemgr
Modified: branches/trac289/src/bin/bind10/bind10.py.in
==============================================================================
--- branches/trac289/src/bin/bind10/bind10.py.in (original)
+++ branches/trac289/src/bin/bind10/bind10.py.in Tue Aug 3 06:36:42 2010
@@ -396,6 +396,26 @@
sys.stdout.write("[bind10] Started b10-xfrin (PID %d)\n" %
xfrind.pid)
+ # start b10-zonemgr
+ zonemgr_args = ['b10-zonemgr']
+ if self.verbose:
+ sys.stdout.write("[bind10] Starting b10-zonemgr\n")
+ zonemgr_args += ['-v']
+ try:
+ zonemgr = ProcessInfo("b10-zonemgr", zonemgr_args,
+ c_channel_env)
+ except Exception as e:
+ c_channel.process.kill()
+ bind_cfgd.process.kill()
+ xfrout.process.kill()
+ auth.process.kill()
+ xfrind.process.kill()
+ return "Unable to start b10-zonemgr; " + str(e)
+ self.processes[zonemgr.pid] = zonemgr
+ if self.verbose:
+ sys.stdout.write("[bind10] Started b10-zonemgr(PID %d)\n" %
+ zonemgr.pid)
+
# start the b10-cmdctl
# XXX: we hardcode port 8080
cmdctl_args = ['b10-cmdctl']
@@ -411,6 +431,7 @@
xfrout.process.kill()
auth.process.kill()
xfrind.process.kill()
+ zonemgr.process.kill()
return "Unable to start b10-cmdctl; " + str(e)
self.processes[cmd_ctrld.pid] = cmd_ctrld
if self.verbose:
@@ -429,6 +450,7 @@
self.cc_session.group_sendmsg(cmd, "Boss", "Auth")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrout")
self.cc_session.group_sendmsg(cmd, "Boss", "Xfrin")
+ self.cc_session.group_sendmsg(cmd, "Boss", "Zonemgr")
def stop_process(self, process):
"""Stop the given process, friendly-like."""
Modified: branches/trac289/src/bin/bind10/run_bind10.sh.in
==============================================================================
--- branches/trac289/src/bin/bind10/run_bind10.sh.in (original)
+++ branches/trac289/src/bin/bind10/run_bind10.sh.in Tue Aug 3 06:36:42 2010
@@ -20,7 +20,7 @@
BIND10_PATH=@abs_top_builddir@/src/bin/bind10
-PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:$PATH
+PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:@abs_top_builddir@/src/bin/xfrin:@abs_top_builddir@/src/bin/xfrout:@abs_top_builddir@/src/bin/zonemgr:$PATH
export PATH
PYTHONPATH=@abs_top_builddir@/src/lib/python:@abs_top_builddir@/src/lib/dns/python/.libs:@abs_top_builddir@/src/lib/xfr/.libs
Modified: branches/trac289/src/bin/xfrin/xfrin.py.in
==============================================================================
--- branches/trac289/src/bin/xfrin/xfrin.py.in (original)
+++ branches/trac289/src/bin/xfrin/xfrin.py.in Tue Aug 3 06:36:42 2010
@@ -432,7 +432,7 @@
# it to mount zone poisoning or DoS attacks. We should
# locally identify the appropriate set of master servers.
# For now, we disable the code below.
- master_is_valid = False
+ master_is_valid = False
if master_is_valid:
ret = self.xfrin_start(zone_name, rrclass, db_file,
Modified: branches/trac289/src/bin/zonemgr/tests/zonemgr_test.py
==============================================================================
--- branches/trac289/src/bin/zonemgr/tests/zonemgr_test.py (original)
+++ branches/trac289/src/bin/zonemgr/tests/zonemgr_test.py Tue Aug 3 06:36:42 2010
@@ -70,7 +70,7 @@
class TestZoneRefreshInfo(unittest.TestCase):
def setUp(self):
self.stdout_backup = sys.stdout
- #sys.stdout = open(os.devnull, 'w')
+ sys.stdout = open(os.devnull, 'w')
self.zoneinfo = MyZoneRefreshInfo()
def test_random_jitter(self):
@@ -133,14 +133,6 @@
self.zoneinfo._zones_refresh_info[0]["zone_state"] = ZONE_EXPIRED
self.assertTrue(self.zoneinfo._zone_is_expired(0))
- def test_get_zone_names(self):
- zone_name_list = ["org.cn"]
- def get_zone_names(db_file):
- return zone_name_list
- sqlite3_ds.get_zone_names = get_zone_names
-
- self.assertEqual(zone_name_list, self.zoneinfo._get_zone_names())
-
def test_get_zone_soa_rdata(self):
soa_rdata1 = 'a.dns.cn. root.cnnic.cn. 2009073105 7200 3600 2419200 21600'
soa_rdata2 = 'a.dns.cn. root.cnnic.cn. 2009073112 7200 3600 2419200 21600'
@@ -226,17 +218,17 @@
self.assertTrue(self.zoneinfo._zone_mgr_is_empty())
def test_build_zonemgr_refresh_info(self):
- zone_name_list = ["sd.cn."]
+ zone_name_list = [("sd.cn.", "IN")]
soa_rdata = 'a.dns.cn. root.cnnic.cn. 2009073106 1800 900 2419200 21600'
- def get_zone_names(db_file):
+ def get_zones_info(db_file):
return zone_name_list
def get_zone_soa(zone_name, db_file):
return (1, 2, 'sd.cn.', 'cn.sd.', 21600, 'SOA', None,
'a.dns.cn. root.cnnic.cn. 2009073106 1800 900 2419200 21600')
- sqlite3_ds.get_zone_names = get_zone_names
+ sqlite3_ds.get_zones_info = get_zones_info
sqlite3_ds.get_zone_soa = get_zone_soa
self.zoneinfo._zones_refresh_info = []
Modified: branches/trac289/src/bin/zonemgr/zonemgr.py.in
==============================================================================
--- branches/trac289/src/bin/zonemgr/zonemgr.py.in (original)
+++ branches/trac289/src/bin/zonemgr/zonemgr.py.in Tue Aug 3 06:36:42 2010
@@ -139,7 +139,6 @@
def zone_handle_notify(self, zone_name, master, port):
"""Handle zone notify"""
- self._send_command("Auth", "Notify_response", None)
zone_index = self._get_zone_index(zone_name)
if (-1 == zone_index):
raise ZonemgrException("[b10-zonemgr] Notified zone %s doesn't belong to zonemgr" % zone_name)
@@ -148,11 +147,10 @@
self._set_timer_notify(zone_index)
def _build_zonemgr_refresh_info(self):
- zone_names = self._get_zone_names()
- for i in range(0, len(zone_names)):
+ for zone_name, zone_class in sqlite3_ds.get_zones_info(self._db_file):
zone_info = {}
- self._zone_name_list.append(str(zone_names[i][0]))
- zone_soa = sqlite3_ds.get_zone_soa(str(zone_names[i][0]), self._db_file)
+ self._zone_name_list.append(str(zone_name))
+ zone_soa = sqlite3_ds.get_zone_soa(str(zone_name), self._db_file)
zone_info["zone_soa_rdata"] = zone_soa[7]
zone_info["zone_state"] = ZONE_OK
zone_info["last_refresh_time"] = self._get_current_time()
@@ -175,9 +173,6 @@
return True
return False
-
- def _get_zone_names(self):
- return sqlite3_ds.get_zone_names(self._db_file)
def _get_zone_soa_rdata(self, zone_index):
return self._zones_refresh_info[zone_index]["zone_soa_rdata"]
@@ -311,12 +306,15 @@
try:
(rlist, wlist, xlist) = select.select([self._socket], [], [], timeout)
if rlist:
- msg = self._socket.recv(8096)
+ self._socket.recv(32)
+ except ValueError as e:
+ sys.stderr.write("[b10-zonemgr] Socket has been closed\n")
+ break
except select.error as e:
if e.args[0] == errno.EINTR:
(rlist, wlist, xlist) = ([], [], [])
else:
- sys.stderr.write("[zonemgr] Error with select(): %s\n" % err)
+ sys.stderr.write("[b10-zonemgr] Error with select(): %s\n" % err)
break
@@ -399,7 +397,8 @@
self._zone_refresh_info.shutdown()
try:
- os.unlink(self._sock_file)
+ if (os.path.exists(self._sock_file)):
+ os.unlink(self._sock_file)
self._conn.close()
except Exception as e:
sys.stderr.write(str(e))
Modified: branches/trac289/src/bin/zonemgr/zonemgr.spec.pre.in
==============================================================================
--- branches/trac289/src/bin/zonemgr/zonemgr.spec.pre.in (original)
+++ branches/trac289/src/bin/zonemgr/zonemgr.spec.pre.in Tue Aug 3 06:36:42 2010
@@ -2,6 +2,12 @@
"module_spec": {
"module_name": "Zonemgr",
"config_data":[
+ {
+ "item_name": "transfers_in",
+ "item_type": "integer",
+ "item_optional": false,
+ "item_default": 10
+ }
],
"commands": [
{
Modified: branches/trac289/src/lib/python/isc/datasrc/sqlite3_ds.py
==============================================================================
--- branches/trac289/src/lib/python/isc/datasrc/sqlite3_ds.py (original)
+++ branches/trac289/src/lib/python/isc/datasrc/sqlite3_ds.py Tue Aug 3 06:36:42 2010
@@ -165,7 +165,7 @@
return row[0]
else:
return ''
-
+
#########################################################################
# reverse_name:
# reverse the labels of a DNS name. (for example,
More information about the bind10-changes
mailing list